http://stackoverflow.com/comment/40619563
score: 0
type: Comment
type: QuestionComment
has text: You may use free unix/linux standard MTA/server server reconfigured to redirect all outgoing email to single (local) mailbox. I am 100% sure `sendmail` can be configured in such way. IMHO it is the best option if you use unix/linux anyway.
comment on: http://stackoverflow.com/q/25944326

http://stackoverflow.com/q/26033966
has comment: http://stackoverflow.com/comment/40780539
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/26037479
tagged with: eclipse
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/40784028
has title: Eclipse development - change FieldEditor based on new value of other FieldEditor inside FieldEditorPreferencePage
tagged with: eclipse-plugin
has body: In Nodeclipse preference Page I want that expressVersion is updated when expressPath is changed. I am adding code below, however it does not fire PropertyChangeEvent so this logic does not get executed. What is wrong here? expressPath = new FileFieldEditor(PreferenceConstants.EXPRESS_PATH, "Express path:", getFieldEditorParent()); //TODO update expressVersion on expressPath selection IPropertyChangeListener listener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { String newValue = (String) event.getNewValue(); expressVersion.setStringValue( ProcessUtils.getCurrentVersionOf(newValue) ); } } }; expressPath.setPropertyChangeListener(listener); addField(expressPath); expressVersion = new StringFieldEditor(PreferenceConstants.EXPRESS_VERSION, "Selected Express version:", getFieldEditorParent()); expressVersion.setEnabled(false, getFieldEditorParent()); addField(expressVersion);
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/40784512
answer count: 1
has comment: http://stackoverflow.com/comment/40781961
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/25943035
has comment: http://stackoverflow.com/comment/40620223
upvote count: 1
has body: As stated by Narmer, you put all your database configuration in servlet-context.xml when it should go in root-context.xml. But the real cause of the problem (or a symptom of it) is that you use no transactional proxy as it can be seen in stacktrace : GradeController.saveGrade directly calls GradeServiceImpl.addGrade that in turn directly calls GradeDaoImpl.addGrade. Normally, you should put the @Transactional annotation only in service layer, and not in dao layer (only one transactional layer). And you should verify that you autowire the service from the controller as @Autowired private GradeService gradeService; Please try to use only one transactional layer and say if stacktrace shows a transactional proxy usage. Edit : There is another problem in your config : you have no &lt;tx:annotation-driven/&gt; tag, when it is necessary for spring to correctly process @Transactional annotations.
answers question: http://stackoverflow.com/q/25937477
type: Answer
has comment: http://stackoverflow.com/comment/40620468
has comment: http://stackoverflow.com/comment/40632383
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40625368

http://stackoverflow.com/comment/40651401
comment on: http://stackoverflow.com/q/25963588
has text: Could you post the logcat output with the error?
score: 0
type: Comment
type: QuestionComment

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

http://stackoverflow.com/a/25962949
type: Answer
has body: Here is a clue: Email messages with attachments are not some text + discrete files. Think of it as one continuous file, where each section is identified by a header to indicate each of these parts. The helper methods you may have used simply parse through the message and deliver it's content in separated blocks as identified by each section's header. If others want to drop other clues or open up the discussion to specific examples, I'll leave this response as a "community wiki".
score: 0
has comment: http://stackoverflow.com/comment/40682274
accepted answer of: http://stackoverflow.com/q/25951058
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25951058

http://stackoverflow.com/comment/41970308
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26673023
has text: I am using struts2 for displaying data in jsp. Is to use `hibernateTransactionManager` spring is required?

http://stackoverflow.com/q/25989680
has body: I would like to instrument queries executed via datastax java driver in Cassandra. Is extending com.datastax.driver.core.SessionManager is the way? Also if extending SessionManager I have to Instantiate it in com.datastax.driver.core.Cluster by modifying Cluster source too ? is this the best way or is there any other possible way to achieve this ?
tagged with: datastax
has title: How to extend cassandra SessionManager for Instrumentation
answer count: 1
favorite count: 0
tagged with: driver
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26000191
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: cassandra
score: 0

http://stackoverflow.com/comment/40518436
type: Comment
comment on: http://stackoverflow.com/a/25887829
has text: I try to stay away from RuntimeExceptions just for personal preference. The try-catch-block however is exactly what I'm looking for, similar to Nikola's answer. Awesome
score: 0
type: AnswerComment

http://stackoverflow.com/a/25885908
accepted answer of: http://stackoverflow.com/q/25884414
answers question: http://stackoverflow.com/q/25884414
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: Regarding ModelMap, model map is used to pass certain data from you controller to the view which you delegate from that controller. You add attributes from controller and later on get attributes from view page. Regarding commandName, commandName="user" this is something that the controller uses to map the form fields to a particular bean or POJO fields. So you do not have to manually get all the request parameters and set it yo pojos when a form is submitted and controller receives the event. Regarding @ModelAttribute, since you use @ModelAttribute("user") as method parameter, spring container will look for a a command name user from request object and map it's properties to the pojos defined in @ModelAttribute viz in your case User class. Regarding difference between Model and ModelMap : ModelMap subclasses LinkedHashMap, and provides some additional conveniences to make it a bit easier to use by controllers addAttribute can be called with just a value, and the map key is then inferred from the type. The addAttribute methods all return the ModelMap, so you can chain method called together, e.g. modelMap.addAttribute('x', x).addAttribute('y',y) The addAttribute methods checks that the values aren't null The generic type of ModelMap is fixed at Map&lt;String, Object&gt;, which is the only one that makes sense for a view model. So nothing earth-shattering, but enough to make it a bit nicer than a raw Map. Spring will let you use either one. You can also use the Model interface, which provides nothing other than the addAttribute methods, and is implemented by the ExtendedModelMap class which itself adds further conveniences.
type: AcceptedAnswer

http://stackoverflow.com/comment/96838521
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/29419369
type: Comment
has text: Btw, you don't have to annotate class with `@Configuration` if it has `@EnableWebSecurity` annotation

http://stackoverflow.com/comment/40566143
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25914979
has text: A Map is useful when you have Key-Value pairs (for example Key: 1, Value: "myProduct"). In this way you can get rapidly the value having the key: `map.get(1)` --> "myProduct"

http://stackoverflow.com/q/25980237
has comment: http://stackoverflow.com/comment/40681809
tagged with: java
tagged with: file
possible better answer: http://stackoverflow.com/a/25983398
linked to: http://stackoverflow.com/q/128038
type: Question
has comment: http://stackoverflow.com/comment/40681884
has answer: http://stackoverflow.com/a/25980344
has comment: http://stackoverflow.com/comment/40681865
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25980544
accepted answer: http://stackoverflow.com/a/25980544
has answer: http://stackoverflow.com/a/25983398
has body: I have a Java application that watches a directory and when XML files are added to that directory, it parses out data from the XML file. It works file as a single-threaded application, but I'm thinking out making it multi-threaded so multiple files can be processed simultaneously. Question is, when thread #1 finds a file and starts processing it, how can I mark the file as 'in progress' so thread #2 doesn't try to process it to? I was thinking that the thread could simply rename the file once it starts working on it, to myfile.xml.inprogress, and then myfile.xml.finished when done. But if I do that, is it possible that two threads will see the file at the same time and both will try to rename it simultaneously? I might also want to run two instances of this application reading files in the same directory, so whatever path I take supports multiple processes. Thanks!
tagged with: multithreading
has title: How can my thread mark a file as in use so other threads won't read it?
type: AnsweredQuestion

http://stackoverflow.com/q/25874942
has answer: http://stackoverflow.com/a/25875974
has comment: http://stackoverflow.com/comment/40493315
score: 1
tagged with: java
has body: I have a bean1(With Getter and Setter) with hundreds of properties and another bean2(Implementing Builder Pattern i.e. using Getters and Builder Pattern). I want to copy properties from bean1 to bean2. How should I achieve that ? Note:- BeanUtils.copyProperties(source, target); not working on Builder pattern bean. Bean1 :- package net.test.etest.dto; import java.io.Serializable; import java.util.List; import org.apache.commons.lang.builder.ToStringBuilder; import com.thoughtworks.xstream.annotations.XStreamAlias; @XStreamAlias("POLICYDMO") public class PolicyDTO implements Serializable { /** * */ private static final long serialVersionUID = 5293821325394812329L; @XStreamAlias("POLICYKEY") private long policyKey; @XStreamAlias("ADDRESSES") private List&lt;AddressDTO&gt; addresses; @XStreamAlias("POLICY_INFO") private PolicyInfoDTO policyInfo; @XStreamAlias("ELIGIBILITIES") private List&lt;EligibilityDTO&gt; eligibility; @XStreamAlias("POLICY_AGENCY") private PolicyAgencyDTO policyAgency; @XStreamAlias("PARTICIPANTS") private List&lt;ParticipantDTO&gt; participants; @XStreamAlias("VEHICLES") private List&lt;VehicleDTO&gt; vehicles; @XStreamAlias("PREFILLEDVEHICLES") private List&lt;VehicleDTO&gt; prefilledVehicles; @XStreamAlias("DRIVERS") private List&lt;DriverDTO&gt; drivers; @XStreamAlias("PRIOR_CARRIER") private PriorCarrierDTO priorCarrier; @XStreamAlias("DISCOUNTS") private List&lt;DiscountDTO&gt; discounts; @XStreamAlias("COMPANIONPOLICY") private CompanionPolicyDTO companionPolicy; @XStreamAlias("PAYMENT") private PaymentDTO payment; // @XStreamAlias("BILLING") //private BillingDTO billing; @XStreamAlias("PAYMENT_PLAN") private PaymentPlanDTO paymentPlan; @XStreamAlias("POLICYTHIRDPARTYSTATUSES") private List&lt;PolicyThirdPartyDTO&gt; policyThirdParty; @XStreamAlias("UW_RULE_RESULTS") private List&lt;UWRuleResultDTO&gt; uwRuleResults; private String violationsCallStatus; private String claimsCallStatus; public PriorCarrierDTO getPriorCarrier() { return priorC…
possible better answer: http://stackoverflow.com/a/25875974
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40493091
tagged with: javabeans
tagged with: copy
has answer: http://stackoverflow.com/a/25877393
has comment: http://stackoverflow.com/comment/40493513
has comment: http://stackoverflow.com/comment/40496568
has title: Copy properties from one bean to another Bean implementing builder pattern
favorite count: 0
has comment: http://stackoverflow.com/comment/40492906
tagged with: builder
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/40496676
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25877393

http://stackoverflow.com/a/26016973
has body: Maybe you just missed it. Look at the documentation here: https://www.playframework.com/documentation/2.3.x/JavaDatabase There is a sub-chapter for SQLite # Default database configuration using SQLite database engine db.default.driver=org.sqlite.JDBC db.default.url="jdbc:sqlite:/path/to/db-file" Notice that you can use the H2 in memory database for development (so that everything goes fast) and then switch to your database of choice when you are in production mode.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26016604
score: 2
downvote count: 0

http://stackoverflow.com/a/26022287
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26022054
has body: One way to do it is to synchronize your threads over a common monitor: Object monitor = new Object(); int jobCount = 0; public void f1(){ for (int v = 0; v &lt; 10; v++) { new Thread(new Runnable() { @Override public void run() { try { doFirst(); check(); doSecond(); } catch (Throwable e) { e.printStackTrace(); } } }).start(); } } public void sleep(){} public void check(){ synchronized(monitor){ jobCount++; if(jobCount==10){ monitor.notifyAll(); return; } } monitor.wait(); } Things to consider: When you call monitor.wait(), the thread where that invocation was made will go to sleep, synchronized over monitor notifyAll() will awaken all threads that are sleeping and synch. over its recipient. When one thread enters a synchronized block, it will take a lock over monitor. notifyAll() can only be invoked if a lock exists on its recipient

http://stackoverflow.com/q/25911710
has comment: http://stackoverflow.com/comment/40558665
has comment: http://stackoverflow.com/comment/40558392
has body: I am having a problem in changing images rapidly on click. I have made an image button I want to change the image when the button is clicked and back to the previous image. I have searched a lot but cant find the solution. public class Buttonone extends Activity { ImageButton btonImage; boolean isPressed = true; MediaPlayer mp; boolean isPlay = false; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.button_one); btonImage = (ImageButton) findViewById(R.id.btonImage); btonImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playSound();toggleImage(); } }); } private void toggleImage() { // TODO Auto-generated method stub btonImage.setImageResource(R.drawable.image2); } } this is the layout xml for image button &lt;ImageButton android:id="@+id/btonImage" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:contentDescription="@null" android:background="#080808" android:src="@drawable/image1" /&gt;
type: AnsweredQuestion
tagged with: onclicklistener
tagged with: java
has comment: http://stackoverflow.com/comment/40559905
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25912053
score: -1
accepted answer: http://stackoverflow.com/a/25912053
tagged with: image
answer count: 2
has title: changing images rapidly in java android
upvote count: 0
possible better answer: http://stackoverflow.com/a/25912023
has answer: http://stackoverflow.com/a/25912023
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/40701961
comment on: http://stackoverflow.com/q/25991191
score: 0
type: Comment
type: QuestionComment
has text: As far as I am aware (and please correct me if I am wrong as I probably am) the bean is specified in the application context and then used (with the same name) in the OurLogger instance. The only grey area I see there is the creation of the new OurLogger instance, but surely it must be ok to use an autowired service inside an instance of an object like this. Thanks for your comment thus far.

http://stackoverflow.com/comment/40518498
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25888631
score: 0
has text: Oops! Got logic wrong way round, should have been !equals(""). I've now corrected.

http://stackoverflow.com/q/25930306
has comment: http://stackoverflow.com/comment/40592657
has comment: http://stackoverflow.com/comment/40593131
has comment: http://stackoverflow.com/comment/40595763
has body: I want to set java path to a specified java directory in eclipse, not the default installed java path. I want to run eclipse by using java from my specified path. But all the time eclipse runs by using the default installed java path. I have specified the Path in the "eclipse.ini" file but this path is not used by eclipse to run.. Please hep me... This is my "eclipse.ini" file -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.200.v20120913-144807 -product com.android.ide.eclipse.adt.package.adtproduct -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vm /home/bibin/Documents/ADTBUNDLE/jdk1.6.0_17/bin/java -vmargs -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms512m -Xmx1024m
has title: how to run eclipse by using a specified java path directory in eclipse not by the default Java path
has comment: http://stackoverflow.com/comment/40595916
has comment: http://stackoverflow.com/comment/40594097
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40592959
has answer: http://stackoverflow.com/a/52537411
favorite count: 0
has comment: http://stackoverflow.com/comment/40593270
has comment: http://stackoverflow.com/comment/40592738
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40594568
has comment: http://stackoverflow.com/comment/40592803
has comment: http://stackoverflow.com/comment/40595532
score: 2
has comment: http://stackoverflow.com/comment/40593219
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40592765
has comment: http://stackoverflow.com/comment/40595602
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40593341
has comment: http://stackoverflow.com/comment/40593786

http://stackoverflow.com/comment/40775019
has text: Your filter will filter ALL columns, you should supply the column index(s) you want to filter by...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26031383

http://stackoverflow.com/comment/40698461
has text: Yes. But please see my question "Is any way there to retain its existing values unchanged and update only the given attribute without fetching the object from DB??"
type: Comment
comment on: http://stackoverflow.com/a/25988477
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40527590
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25873796
has text: remove the onlistitemclick function. instead after initiating listview add this after setting the adapter lv.setOnItemClickListener(new OnItemClickListener() { @Override public boolean onItemClick(AdapterView<?> parent, View view, int position, long id) { //Your Code, what happens when you click this item of the listview. return true; } });
score: 0

http://stackoverflow.com/q/25889278
has answer: http://stackoverflow.com/a/25889374
upvote count: 1
tagged with: collections
downvote count: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/7574311
type: Question
has body: I am looking many of the queries on how to get intersection set of 2 sets in a efficent time. And looking for very efficient way. Before approching my own way why can not ask Java to build a method to perform the same. Why Java has not build a menthod like intersection on Collections class like sort method or somewhere in Collections? Any reason behind this? Please consider this is a discussion on fit-falls of intersection on sets. Thanks,
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/7574311
favorite count: 0
has title: Intersection with Java collection
type: UnansweredQuestion
tagged with: set-intersection

http://stackoverflow.com/comment/40622065
comment on: http://stackoverflow.com/q/25947134
type: Comment
type: QuestionComment
has text: arrays do not have toString methods built in
score: 0

http://stackoverflow.com/q/25892563
tagged with: java
type: Question
answer count: 2
has title: jdbc result set with if then statements
downvote count: 0
has answer: http://stackoverflow.com/a/25892626
favorite count: 0
has body: My goal: I am trying to query my fire/rescue database to determine the current status of ambulances. Once I have this current disposition I generate a scalable vector graphic based on that disposition. For example, a working ambulance would have a red rectangle around the information. An available ambulance would have a white rectangle with a green border, etc. The problem: I am able to reach into my database and print out a result set. However my IF THEN statement does not work properly. All of the printed out put conforms to the final ELSE statement. In other words, although I am checking for a disposition == "Working" the program does not recognize it and skips right over to the final ELSE statement. Shown below is my code which has been simplified to remove the SVG and just print out a line of text. package javaDatabase; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class CurrentDisposition3 { public static void main(String[] args) throws SQLException, ClassNotFoundException { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection conn = DriverManager .getConnection("jdbc:sqlserver://999.99.99.99;database=myDatabase;integratedsecurity=false;user=myUser;password=myPassword"); Statement sta = conn.createStatement(); String qryCurrentDisposition = "SELECT Ambulance, FinalTimeStamp, UnitStatus, Disposition FROM EMSDatabase"; ResultSet rs = sta.executeQuery(qryCurrentDisposition); while (rs.next()) { String truck = rs.getString("Ambulance"); String timeStamp = rs.getString("FinalTimeStamp"); String unitStatus = rs.getString("UnitStatus"); String disposition = rs.getString("Disposition"); System.out.println(truck + ", " + timeStamp + ", " + unitStatus + ", " + disposition); if (disposition == "Working") { System.out.println("This truck is working"); } else if (disposition == "Free") { System.out.println("This truck is free"); } else if (dispositio…
tagged with: resultset
linked to: http://stackoverflow.com/q/513832
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/25893102
has answer: http://stackoverflow.com/a/25893102
score: 1
has comment: http://stackoverflow.com/comment/40524212
accepted answer: http://stackoverflow.com/a/25892626
upvote count: 1
type: AnsweredQuestion
tagged with: if-statement

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

http://stackoverflow.com/a/26022104
has body: Something like Jinq? database.customerStream().where(customer -&gt; customer.getName().equals("Alice"));
score: 4
has comment: http://stackoverflow.com/comment/40759430
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25989449

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/25951019
tags question: http://stackoverflow.com/q/26030886
tags question: http://stackoverflow.com/q/25993430
tags question: http://stackoverflow.com/q/26004659
tag name: jfreechart

http://stackoverflow.com/q/25927430
tagged with: ejb
tagged with: jndi
linked to: http://stackoverflow.com/q/25828542
tagged with: glassfish
score: 0
answer count: 1
has body: After fighting passwords on Glassfish 4.x remotely on Ubuntu 14.04 Tahr, I'm ready to proceed to installing my first remote EJB module -- just want make sure I'm on the right path. Going from the Netbeans example Creating and Running an Application Client on the GlassFish Server, How would I make a client for the EJB module which is deployed remotely? The Netbeans example assumes that Glassfish is running on the localhost. The exact mechanics are unclear to me, as it's not explicitly configured for localhost. Presumably it's implicitly configured for localhost... I would like to use the ACC to connect to, not a local, but rather a remote Glassfish server. For context, the ACC is: Introducing the Application Client Container The Application Client Container (ACC) includes a set of Java classes, libraries, and other files that are required for and distributed with Java client programs that execute in their own Java Virtual Machine (JVM). The ACC manages the execution of Java EE application client components (application clients), which are used to access a variety of Java EE services (such as JMS resources, EJB components, web services, security, and so on.) from a JVM outside the Oracle GlassFish Server. The ACC communicates with the GlassFish Server using RMI-IIOP protocol and manages the details of RMI-IIOP communication using the client ORB that is bundled with it. Compared to other Java EE containers, the ACC is lightweight. For information about debugging application clients, see Application Client Debugging. GlassFish Server Open Source Edition Application Development Guide Release 4.0 see also: https://stackoverflow.com/questions/25830149/how-to-package-a-stand-alone-remote-ejb-application-client From a client application, how does the ACC remotely invoke the EJB module? There must be a configuration. Does the ACC pick this up from jndi.properties? I can't find much documentation or examples on ACC usage. If the ACC is unsuitable, then, of course, I'll use a d…
has comment: http://stackoverflow.com/comment/40589647
accepted answer: http://stackoverflow.com/a/25928187
type: AnsweredQuestion
tagged with: java
has title: glassfish: remotely invoke EJB module with Application Client Container
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/25928187

http://stackoverflow.com/comment/40824362
score: 0
has text: @WingedPanther I do not understand what is the relation with the problem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26031243

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

http://stackoverflow.com/q/25984932
has answer: http://stackoverflow.com/a/25984953
answer count: 1
downvote count: 0
tagged with: android-activity
has body: I would like to convert the following number into a double. Number mMax_Distance = ParseUser.getCurrentUser().getNumber("Maximum_Distance"); I am using Parse, and in it I have a column known as Maximum_distance and that is classified as a number. I need to convert it into a number because I would like to use in the following line: query.whereWithinKilometers("location", point, mMax_Distance); where mMax_Distance has to be a double The other way to resolve it is to store it directly as a double instead of a number. However, it was classified using a seekbar value, where users determines their maximum distance through a seekbar, and I believe seekbar only stores numbers. currentUser.put("Maximum_Distance", seekBarDistance.getProgress()); Any help would be greatly appreciated. If you require clarification, let me know.
favorite count: 0
tagged with: parse-platform
tagged with: android
accepted answer: http://stackoverflow.com/a/25984953
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
type: Question
upvote count: 4
score: 4
has title: Convert number into double

http://stackoverflow.com/comment/40685978
has text: Thanks for your answer. I was looking at the possibility of setting the queue size based on this document: https://wiki.eclipse.org/Jetty/Howto/High_Load, as well as in trying to reproduce this bug on my dev box: https://bugs.eclipse.org/bugs/show_bug.cgi?id=444031. Anyway with regards to actually updating the thread pool, I had tried what jetty.xml suggests, but I get this warning: WARN:oejx.XmlConfiguration:main: Ignored arg: <New id="threadpool" class="org.eclipse.jetty.util.thread.QueuedThreadPool"/>
type: AnswerComment
comment on: http://stackoverflow.com/a/25943743
score: 0
type: Comment

http://stackoverflow.com/q/25940975
type: UnansweredQuestion
tagged with: glassfish
has answer: http://stackoverflow.com/a/25941197
linked to: http://stackoverflow.com/q/25928969
tagged with: ear
tagged with: jar
type: Question
has body: Does one JAR depend upon another for the ACC? The documentation isn't crystal clear on this, at least so far as I've read. My understanding is that I need to build an EAR from existing code which I can deploy remotely. This EAR should contain the existing client. All of the code: 1.) the client, 2.) the EJB module and 3.) the remote interface runs on localhost. I've deployed the EJB to a remote Glassfish server. How do I create an "ant-java-ee project" from Creating and Running an Application Client on the GlassFish Server? The sample I created packages very oddly. Netbeans doesn't seem to have a "ant jar" option which builds it in a familiar way for me. There's no ant jar target as is typical with Netbeans applications; ant dist results in: dist: BUILD SUCCESSFUL Total time: 6 seconds thufir@dur:~/NetBeansProjects/HelloClient$ ll total 32 drwxrwxr-x 7 thufir thufir 4096 Sep 19 11:51 ./ drwxrwxr-x 16 thufir thufir 4096 Sep 16 09:22 ../ drwxrwxr-x 5 thufir thufir 4096 Sep 19 11:51 build/ -rw-rw-r-- 1 thufir thufir 3654 Sep 13 20:40 build.xml drwxrwxr-x 2 thufir thufir 4096 Sep 19 11:51 dist/ drwxrwxr-x 3 thufir thufir 4096 Sep 13 20:38 nbproject/ drwxrwxr-x 4 thufir thufir 4096 Sep 13 20:38 src/ drwxrwxr-x 2 thufir thufir 4096 Sep 13 20:38 test/ thufir@dur:~/NetBeansProjects/HelloClient$ ll dist/ total 12 drwxrwxr-x 2 thufir thufir 4096 Sep 19 11:51 ./ drwxrwxr-x 7 thufir thufir 4096 Sep 19 11:51 ../ -rw-rw-r-- 1 thufir thufir 1848 Sep 19 11:51 HelloClient.jar thufir@dur:~/NetBeansProjects/HelloClient$ thufir@dur:~/NetBeansProjects/HelloClient$ thufir@dur:~/NetBeansProjects/HelloClient$ java -jar dist/HelloClient.jar Exception in thread "main" java.lang.NoClassDefFoundError: hello/HelloBeanRemote at helloclient.Main.main(Main.java:11) Caused by: java.lang.ClassNotFoundException: hello.HelloBeanRemote at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native…
linked to: http://stackoverflow.com/q/25828542
tagged with: netbeans
has title: build ear for remote deployment with Application Client Container (ACC) on Glassfish
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/25887584
has comment: http://stackoverflow.com/comment/40514601
downvote count: 1
answer count: 7
has body: I have a java web service which returns a list of strings type result as below. 12341.0 4578231.0 25.0 4785555.0 347895666.0 Now how can I remove trialing zeroes? what I want is list of strings as: 12341 4578231 25 4785555 347895666 how can i do it?
favorite count: 0
has answer: http://stackoverflow.com/a/25887732
accepted answer: http://stackoverflow.com/a/25887732
has answer: http://stackoverflow.com/a/25887679
has answer: http://stackoverflow.com/a/25887711
has answer: http://stackoverflow.com/a/25887676
type: AnsweredQuestion
upvote count: 0
has title: Removing trialing zeros from String?
tagged with: java
has comment: http://stackoverflow.com/comment/40514548
has answer: http://stackoverflow.com/a/25887675
type: Question
score: -1
possible better answer: http://stackoverflow.com/a/25887675
has answer: http://stackoverflow.com/a/25887705
has answer: http://stackoverflow.com/a/25887717

http://stackoverflow.com/a/25972015
answers question: http://stackoverflow.com/q/25971950
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40666568
has body: Your getaddress() and setaddress() methods are the same, so I think it's just copy-paste typo. Valid setaddress() should be as the following: @Override public void setaddress(String address) { this.address = address; } Don't forget to change return type at the abstract class also.
has comment: http://stackoverflow.com/comment/40666761
type: Answer

http://stackoverflow.com/q/25949730
upvote count: 0
score: -2
has title: How to retrieve data from a table in a database and print it in a table in a GUI form in Java
has body: I have a database with tables in it which contains information. I would like to retrieve data from the table which is on the database to the table which I have made on a GUI form. I have tried retrieving the data using system.out.print method and I get results, meaning the database connection works and recognizes the table. Only problem is I do not know how to that for tables in the code. Please keep in mind that the GUI I made, the code was generated automatically so I do not have 100% access to the code.
answer count: 1
tagged with: jdbc
has answer: http://stackoverflow.com/a/25949923
favorite count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/q/25956540
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40638418
type: Question
has comment: http://stackoverflow.com/comment/40638577
has comment: http://stackoverflow.com/comment/40638630
tagged with: java
tagged with: bigdecimal
has body: I have made a scientific calculator which uses BigDecimal. It has a particularly resource-hungry feature, factorial. Now, typing ANY number fires up the calculation.Depending on the device that this code is being run on , the answer is displayed at different times. Typing huge values like 50000! (factorial) causes the device to freeze up. Is there anyway to pre-calculate the time that each BigDecimal operation takes? these factors should vary with processing speed, RAM etc.
has answer: http://stackoverflow.com/a/25956639
has comment: http://stackoverflow.com/comment/40638692
score: 0
answer count: 1
has title: Estimate BigDecimal Calculation time
has comment: http://stackoverflow.com/comment/40638555

http://stackoverflow.com/comment/40596910
type: Comment
comment on: http://stackoverflow.com/a/25930286
has text: @MSach, that is not correct I guess, the queries are issued to DB in my opinion and from logs I have seen. Even the API says that `Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.` Here persistence store represents the database not memory. Once you call clear then the objects are no more in memory. Can you provide some link that supports your statement.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25980566
type: Answer
has comment: http://stackoverflow.com/comment/46126368
downvote count: 0
answers question: http://stackoverflow.com/q/25880866
score: 1
accepted answer of: http://stackoverflow.com/q/25880866
upvote count: 1
type: AcceptedAnswer
has body: Turns out that cordova ships with its own version of okhttp, currently v1.3 - which is old, and has largely different APIs. Namely, Request and Response classes aren't public. My problem was that the jar of okhttp v2 I was including in my cordova plugin wasn't being used by the compiler. Not wanting to deal with those problems, I've updated my code to be inline with v1.3, and filed a bug for updating version of okhttp to 2+ in Cordova's issue tracker.

http://stackoverflow.com/a/25992630
answers question: http://stackoverflow.com/q/25974338
has comment: http://stackoverflow.com/comment/40738998
upvote count: 1
has body: Here is the link from where you can download Stanford parser: nlp.stanford.edu/software/lex-parser.shtml I hope you have already working Java environment. So go in the directory where you have put the parser files. java -mx200m edu.stanford.nlp.parser.lexparser.LexicalizedParser -retainTMPSubcategories -outputFormat "wordsAndTags,penn,typedDependencies" englishPCFG.ser.gz mumbai.txt mumbai.txt is the input file. But I found berkeley parse better. You can download from https://code.google.com/p/berkeleyparser/downloads/list Download parser jar file and gramar for Arabic text. Then execute simple command: java -jar BerkeleyParser-1.7gr eng_sm6.gr Now enter any sentence that you want to parse. For POS, you can get downloads from http://nlp.stanford.edu/software/tagger.shtml
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/26011746
tagged with: matrix
upvote count: 1
has comment: http://stackoverflow.com/comment/40739252
has comment: http://stackoverflow.com/comment/40739458
answer count: 1
has comment: http://stackoverflow.com/comment/40739514
has title: Maximum sum when going through matrix for number of turns
favorite count: 0
accepted answer: http://stackoverflow.com/a/26011997
has comment: http://stackoverflow.com/comment/40739355
has comment: http://stackoverflow.com/comment/40739441
has comment: http://stackoverflow.com/comment/40739099
has comment: http://stackoverflow.com/comment/40739209
has answer: http://stackoverflow.com/a/26011997
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has body: You have a matrix and you may start at any point. You can go in any one of the 8 directions(down,down-left,left,left-up etc.). For every position you're at, you add that position's value to a sum. After you've been to a position, it's value becomes 0. The challenge consists of creating a recursive algorithm for returning the highest sum starting from the given point. My question is: My method doesn't work.Can you help me modify my method so it can work? This is my code: public int travel (int i, int j,int k,int sum) { //value temporarily takes the position's value int value; //if position is out of matrix bounds if(i&gt;=x||j&gt;=y||i&lt;0||j&lt;0) { return 0; } else { //makes the value in point (i,j) = 0 value=M[i][j]; M[i][j]=0; //if the number of turns has been reached if(k==turns) { //restores value at position M[i][j]=value; return M[i][j]; } else { //loop for going to all 8 neighbors for(int line=-1;line&lt;2;line++) { for(int col=-1;col&lt;2;col++) { //if the position is the same if(!(col==0&amp;&amp;line==0)) { sum=Math.max(travel(i+line,j+col,k+1,sum), sum); } } } //restores value at position M[i][j]=value; //returns sum so far return sum+M[i][j]; } } } For matrix: 9 2 7 4 2 8 3 7 5 1 2 4 1 9 8 3 turns: 3 starting point: (0,0) (of value 9) It should return 31. The path is down-right,up-right,down-right (9+8+7+7=31)
has comment: http://stackoverflow.com/comment/40739302
score: 0
has comment: http://stackoverflow.com/comment/40739595

http://stackoverflow.com/q/26025642
accepted answer: http://stackoverflow.com/a/26025678
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/40765111
has answer: http://stackoverflow.com/a/26026000
possible better answer: http://stackoverflow.com/a/26025688
has answer: http://stackoverflow.com/a/26025688
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26025678
upvote count: 3
downvote count: 2
has body: I'm trying to get better grips of function overloading. I've this test program (pardon me for my C inspired Java). public class Test { static void f(int x, double y) { System.out.printf("%d, %f",x,y); } static void f(double x, int y) { System.out.printf("%f, %d", x, y); } public static void main(String args[]) { f(1, 2); } } now if I call, f(1, 2); There is compiler error, *reference to f is ambiguous* Why this error? Are we not calling f(int, int)? But no such method is declared. I was expecting "no suitable method found for f" instead, but I did not get one, why?
type: Question
tagged with: overloading
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40764866
has title: Method overloading - reference to is ambiguous

http://stackoverflow.com/a/25949118
answers question: http://stackoverflow.com/q/25949092
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/40625225
downvote count: 0
has comment: http://stackoverflow.com/comment/40625271
has body: The code to change that genre field can contain null public String toString() { return "Title: "+ title + "\n" + "Genre: "+ (genre==null?"":genre) + "\n" + "Artist: "+ artist; }
type: Answer

http://stackoverflow.com/q/25891244
type: AnsweredQuestion
tagged with: java
tagged with: spring-tool-suite
tagged with: vaadin
has title: netbeans project loading issues
has answer: http://stackoverflow.com/a/25893044
accepted answer: http://stackoverflow.com/a/25893044
answer count: 1
score: 0
tagged with: netbeans
has body: I was trying to transfer one of my projects from NetBeans to STS. Is there any good (proven) way of doing that?For example, the problems is: sept. 17, 2014 2:40:42 PM com.springsource.tcserver.security.PropertyDecoder &lt;init&gt; Infos: tc Runtime property decoder using memory-based key sept. 17, 2014 2:40:42 PM com.springsource.tcserver.security.PropertyDecoder &lt;init&gt; Infos: tcServer Runtime property decoder has been initialized in 164 ms sept. 17, 2014 2:40:42 PM org.apache.coyote.AbstractProtocol init Infos: Initializing ProtocolHandler ["http-bio-8080"] sept. 17, 2014 2:40:42 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init Infos: Started up JMX registry on 127.0.0.1:6969 in 88 ms sept. 17, 2014 2:40:42 PM org.apache.catalina.startup.Catalina load Infos: Initialization processed in 577 ms sept. 17, 2014 2:40:42 PM org.apache.catalina.core.StandardService startInternal Infos: Démarrage du service Catalina sept. 17, 2014 2:40:42 PM org.apache.catalina.core.StandardEngine startInternal Infos: Starting Servlet Engine: VMware vFabric tc Runtime 2.9.6.RELEASE/7.0.53.B.RELEASE sept. 17, 2014 2:40:42 PM org.apache.catalina.startup.HostConfig deployDescriptor Infos: Déploiement du descripteur de configuration C:\Users\Ashwath\Desktop\sts-bundle\vfabric-tc-server-developer-2.9.6.RELEASE\base-instance\conf\Catalina\localhost\Vaadin7.xml sept. 17, 2014 2:40:42 PM org.apache.catalina.startup.SetContextPropertiesRule begin Avertissement: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Vaadin7' did not find a matching property. sept. 17, 2014 2:40:43 PM org.apache.catalina.core.ContainerBase addChildInternal Grave: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Vaadin7]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChi…
type: Question

http://stackoverflow.com/a/25961249
answers question: http://stackoverflow.com/q/25959449
has body: The problem is that the folder, where the .java file is located in is not added as a source folder. To do this, go to File | Project Structure | Modules. If you have several modules, select the one in which the folder you want to add as source folder is located. Then, on the right side you can see a list of folders. Select the one which contains the java files and click on mark as: Sources (or Alt+S).
score: 0
type: Answer

http://stackoverflow.com/q/25981328
has title: Possible to store encrypted credentials in a PKCS12 keystore?
tagged with: pkcs#12
tagged with: api
answer count: 1
downvote count: 0
has body: I am trying to find a way I can ensure security of credentials within my system. One requirement is that once the passwords are encrypted I need to be able to provide an API that can be used by both Java and C projects. One way to achieve this is to have a PKCS12 keystore which works for not just Java (unlike the JKS) but also for other languages. So the question is can a PKCS12 keystore be used to store encrypted passwords?
has answer: http://stackoverflow.com/a/26852710
favorite count: 0
tagged with: credentials
type: UnansweredQuestion
tagged with: encryption
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/40565856
comment on: http://stackoverflow.com/a/25914959
score: 0
type: AnswerComment
type: Comment
has text: Okay I'll try that one.

jersey-2.0
tags question: http://stackoverflow.com/q/25906976
tags question: http://stackoverflow.com/q/25892831
tags question: http://stackoverflow.com/q/25899226
type: Tag
tags question: http://stackoverflow.com/q/25953055
tags question: http://stackoverflow.com/q/26002462
tag name: jersey-2.0

http://stackoverflow.com/q/25962250
tagged with: junit
favorite count: 0
type: UnansweredQuestion
tagged with: maven
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: libgdx
has body: I've been trying for a while to get some JUnit tests to work in a project using the Maven version of Libgdx, but did not manage to succeed. In my project I have a class that handles the audio for my game. For now the class is quite simple, and does not do much more than looking for an audio file in a folder, and playing it. I use the Gdx.app.internal() to get the file that I need, and it workd perfectly fine when running the game. Now when I write a test file, which is in the root/core/target/test-classes/.... folder, the Gdx.app.internal() immediately throws an exception. When using FileHandle.exists(), it returns true when running from the game, but false when I run it from tests. My guess is that it might have to do with some dependencies that Libgdx needs, and when running the game normally all is set for you. Thus I tried looking up some other topics that discuss this, but did not manage to find much information about it. So to summarize my question: Is it allowed to call for Gdx.files.internal() in a JUnit test case? If not, what is the best way to go about testing classes in your Libgdx project?
downvote count: 0
has title: NullPointerException with a class using Gdx.files.internal() during test (maven version)

http://stackoverflow.com/q/25986822
tagged with: javafx
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/30060236
upvote count: 3
downvote count: 1
favorite count: 0
type: UnansweredQuestion
score: 2
has title: Is it possible to display a VolatileImage in a JavaFX scene?
has body: I'm working with a VolatileImage to utilize hardware acceleration and was wondering if its possible to display the image in a JavaFX scene. I have used SwingFXUtils.toFXImage() for a BufferedImage in the past but this does not seem to support VolatileImage.
tagged with: java

http://stackoverflow.com/q/25890937
tagged with: java
has comment: http://stackoverflow.com/comment/41410796
score: 12
answer count: 2
upvote count: 12
has answer: http://stackoverflow.com/a/74518452
downvote count: 0
has body: OK, I'll start with an elaborated use-case and will explain my question: I use a 3rd party web analytics platform which utilizes AWS Kinesis streams in order to pass data from the client into the final destination - a Kinesis stream; The web analytics platform uses 2 streams: A data collector stream (single shard stream); A second stream to enrich the raw data from the collector stream (single shard stream); Most importantly, this stream consumes the raw data from the first stream using TRIM_HORIZON iterator type; I consume the data from the stream using AWS Java SDK, secifically using the GetShardIteratorRequest class; I'm currently developing the extraction class, so this is done synchronously, meaning I consume data only when I compile my class; The class surprisingly works, although there are some things that I fail to understand, specifically with respect to how the data is consumed from the stream and the meaning of each one of iterator types; My problem is that the data I retrieve is inconsistent and has no chronological logic in it. When I use AT_SEQUENCE_NUMBER and provide the first sequence number from the shard with .getSequenceNumberRange().getStartingSequenceNumber(); ... as the ``, I'm not getting all records. Similarly, AFTER_SEQUENCE_NUMBER; When I use LATEST, I'm getting zero results; When I use TRIM_HORIZON, which should make sense to use, it doesn't seem to be working fine. It used to provide me the data, and then I've added new "events" (records to the final stream) and I received zero records. Mystery. My questions are: How can I safely consume data from the stream, without having to worry about missed records? Is there an alternative to the ShardIteratorRequest? If there is, how can I just "browse" the stream and see what's inside it for debugging references? What am I missing with the TRIM_HORIZON method? Thanks in advance, I'd really love to learn a bit more about data consumption from a Kinesis stream.
has title: Explain Kinesis Shard Iterator - AWS Java SDK
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/41342768
has comment: http://stackoverflow.com/comment/46572964
favorite count: 0
has answer: http://stackoverflow.com/a/29201989
has comment: http://stackoverflow.com/comment/41347452
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41382804
tagged with: amazon-kinesis
type: Question
has comment: http://stackoverflow.com/comment/41346028

http://stackoverflow.com/a/25974672
has comment: http://stackoverflow.com/comment/40673323
has comment: http://stackoverflow.com/comment/40671785
score: 0
has comment: http://stackoverflow.com/comment/40671520
type: Answer
has comment: http://stackoverflow.com/comment/40671716
has comment: http://stackoverflow.com/comment/40671797
has comment: http://stackoverflow.com/comment/40671399
has body: Start the ProgressDialog where your process begins ProgressDialog progressDialog = ProgressDialog.show(yourActivity.this, "Connecting .....",". Please wait...", true); and when your process is over call dismiss() like progressDialog.dismiss();
answers question: http://stackoverflow.com/q/25974573

http://stackoverflow.com/q/25912339
linked to: http://stackoverflow.com/q/16459196
linked to: http://stackoverflow.com/q/13757859
tagged with: java
has comment: http://stackoverflow.com/comment/40566145
linked to: http://stackoverflow.com/q/6919292
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40559842
has title: Two ViewPagers in one activity
type: UnansweredQuestion
tagged with: android
has body: I have two questions about ViewPager. I have in my activity 2 ViewPagers, one for each week (of date). For example, one for 14/9/14 - 20/9/14, and the the other one for the next week 21/9/14 - 27/9/14. When I slide the ViewPager to it's next one, it will change each on of the ViewPagers to the next week of itself (21/9/14 - 27/9/14, 28/9/14 - 4/10/14). When I change the data f the second ViewPager and then slide the first ViewPager to it's next one (and this is the same week like the second view pager data that I changed), it won't show the changes that I made, unless I slide two more times and then return to the changed week (because of the memory of the ViewPager). I tried mPager1.setOffscreenPageLimit(0); , but it didn't helped. What can I do in order to solve that? I want that when I slide one of my ViewPagers, so the other one will animate itself exactly like my finger is sliding the other ViewPager. Any ideas how to do that?
score: 2
has comment: http://stackoverflow.com/comment/40559843
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/25926134
tagged with: android-viewpager
tagged with: android-fragments

distance
tags question: http://stackoverflow.com/q/25881877
tag name: distance
type: Tag
tags question: http://stackoverflow.com/q/25935659

http://stackoverflow.com/a/26127882
type: Answer
answers question: http://stackoverflow.com/q/25894559
score: 1
has body: I found solution. public static JSONObject setProperty(JSONObject js1, String keys, String valueNew) throws JSONException { String[] keyMain = keys.split("\\."); for (String keym : keyMain) { Iterator iterator = js1.keys(); String key = null; while (iterator.hasNext()) { key = (String) iterator.next(); if ((js1.optJSONArray(key) == null) &amp;&amp; (js1.optJSONObject(key) == null)) { if ((key.equals(keym))) { js1.put(key, valueNew); return js1; } } if (js1.optJSONObject(key) != null) { if ((key.equals(keym))) { js1 = js1.getJSONObject(key); break; } } if (js1.optJSONArray(key) != null) { JSONArray jArray = js1.getJSONArray(key); for (int i = 0; i &lt; jArray.length(); i++) { js1 = jArray.getJSONObject(i); } break; } } } return js1; } public static void main(String[] args) throws IOException, JSONException { FileInputStream inFile = new FileInputStream("/home/ermek/Internship/labs/java/task/test5.json"); byte[] str = new byte[inFile.available()]; inFile.read(str); String text = new String(str); JSONObject json = new JSONObject(text); setProperty(json, "rpc_server_type", "555"); System.out.println(json.toString(4));
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25894559
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/40711566
type: Comment
has text: You can provide the **full** file name with file path, e.g. `c:/project_folder/src/some/path/data.in`).
type: QuestionComment
comment on: http://stackoverflow.com/q/25995969
score: 0

http://stackoverflow.com/comment/40718379
score: 0
has text: Yes that is true. I never had to deal with java unicode. But I knew basically the output was saying unknown characters.
type: Comment
comment on: http://stackoverflow.com/a/25999885
type: AnswerComment

http://stackoverflow.com/a/25977846
has comment: http://stackoverflow.com/comment/40677880
upvote count: 1
answers question: http://stackoverflow.com/q/25976055
has body: Short answer: the setEditable(false) and replaceSelection() wont work together. Long answer: Check replaceSelection() method in JTextPane. It will work only for an editable JTextPane. @Override public void replaceSelection(String content) { replaceSelection(content, true); } private void replaceSelection(String content, boolean checkEditable) { if (checkEditable &amp;&amp; !isEditable()) { UIManager.getLookAndFeel().provideErrorFeedback(JTextPane.this); return; } ... } The simplest solution is to set the pane to editable, make the changes and set back to uneditable. But this is ugly. A better solution is to manipulate the underlying Document.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/25913629
score: 0
has comment: http://stackoverflow.com/comment/40580485
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40566570
has comment: http://stackoverflow.com/comment/40566555
tagged with: java
has title: How to use Trident Animation Library Samples
type: Question
has answer: http://stackoverflow.com/a/25923543
has body: I can't, for the life of me, figure out how to use the Trident Animation Library sample code. I've downloaded their archive (located at here), trident-all.zip, which has sample code that I would like to run. I imported it as an archive file into one of my Projects where I have added to the build path the two other files, trident.jar and trident-tst.jar. However, whenever I try to compile and run one of their source files, I always get an "Editor does not have a main type" alert. I realize that this is because after importing the trident-all.zip, I had a folder named "src" but it's not a source folder. I right-clicked it and made it a source a folder but this just made more trouble than good. I can't find any tutorials on how to do these things. I believe there is some way to import the trident-all.zip properly so that it would be properly arranged and the folder named "src" would actually be a source folder without any error. I hope you guys can enlighten me about this. Thanks in advance!

http://stackoverflow.com/q/25958995
has title: Where to put @Nullable on methods with nullable return types?
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25960096
has body: When using javax.annotation.Nullable to mark methods as "potentially returning null value", where to put the @Nullable annotation? On the method, or return type? Is there any technical difference, or is this strictly a style issue? Style A: @Nullable public Object blah() { ... } Style B: public @Nullable Object blah() { ... }
duplicate of: http://stackoverflow.com/q/22838634
linked to: http://stackoverflow.com/q/22838634
tagged with: nullable
tagged with: annotations
upvote count: 21
has answer: http://stackoverflow.com/a/25960096
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26398881
accepted answer: http://stackoverflow.com/a/26398881
score: 21
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/77489657

http://stackoverflow.com/comment/40762299
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26023750
score: 1
has text: @cornuz If the collections are small that's true, but for large collections improving the `m` queries to each take `O(1)` time instead of `O(n)` time is absolutely worth it because you go from `O(n*m)` to `O(n+m)`. Short-circuiting lets you do even better when there's a lot of overlap.

http://stackoverflow.com/q/25888892
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25889141
answer count: 1
favorite count: 0
upvote count: 2
tagged with: interface
has title: Purpose of the injection of an interface with multiple implementations
accepted answer: http://stackoverflow.com/a/25889141
tagged with: factory
tagged with: inject
type: AnsweredQuestion
score: 2
has body: Consider a factory like the following: public interface SomeFactory { public SomeValue createSomething(SomeKey key); } Furthermore we got some implementation of SomeFactory: public class SomeFactoryImpl implements SomeFactory { @Override public SomeValue createSomething(Key key) { // some logic } } Let us consider a class which wants to use this factory: public class SomeClass{ @Inject private SomeFactory someFactory; public String someMethod(Key someKey) { someFactory.createSomething(someKey); // some more logic } } What is the advantage of using an interface for the factory in this situation? I thought the following: Let us assume I want to use another implementation for my factory: public class AnotherFactoryImpl implements SomeFactory { @Override public SomeValue createSomething(Key key) { // some logic } } Which factory will then be used with the @Inject-annotation? Would it be more appropriate to Inject the implementation itself, or do we always have just one implementation for the factory? Another possible answer: Is it not appropriate to use an interface for the factory?

http://stackoverflow.com/a/27366199
has body: You may need to actually use the object. Hibernate/Envers will return a lazy initialized object, and debuggers will probably not be able to see the values. Once you call the getters in code, the proper values should be populated.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25931281
type: Answer

http://stackoverflow.com/comment/40634713
type: Comment
comment on: http://stackoverflow.com/a/25954556
score: 0
type: AnswerComment
has text: Don't help those that don't deserve it.

http://stackoverflow.com/a/25951841
score: 1
has body: I think the JDT is probably running background jobs to recompile and rebuild indices. So you need to wait for those jobs to finish. Try IJobManager jobManager = Job.getJobManager(); jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, monitor); jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, monitor); do this after the refreshLocal but before you do anything else.
has comment: http://stackoverflow.com/comment/40630586
has comment: http://stackoverflow.com/comment/40631221
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40642818
has comment: http://stackoverflow.com/comment/40642582
answers question: http://stackoverflow.com/q/25951744
type: Answer
accepted answer of: http://stackoverflow.com/q/25951744
downvote count: 0

http://stackoverflow.com/q/25888023
score: 110
favorite count: 0
has answer: http://stackoverflow.com/a/60616164
upvote count: 110
has answer: http://stackoverflow.com/a/64369173
accepted answer: http://stackoverflow.com/a/25888116
possible better answer: http://stackoverflow.com/a/59885408
has answer: http://stackoverflow.com/a/68750893
has title: How to change Java version for Maven in IntelliJ?
has answer: http://stackoverflow.com/a/43290502
answer count: 12
has answer: http://stackoverflow.com/a/37976317
has answer: http://stackoverflow.com/a/71683071
tagged with: maven
has comment: http://stackoverflow.com/comment/40515320
linked to: http://stackoverflow.com/q/21006136
has comment: http://stackoverflow.com/comment/63695151
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/74996273
has body: I'm new to both Maven and IntelliJ IDEA. I have a Maven project written in Java 8. Whenever I try to build it (Maven Projects window -> Lifecycle -> compile -> Run Maven Build) I get a series of compilation errors: [ERROR] path/to/file.java:[26,52] lambda expressions are not supported in -source 1.5 (use -source 8 or higher to enable lambda expressions) Where am I supposed to change the value of the -source parameter? I tried adding it as an additional parameter in Settings -> Compiler - > Java Compiler, but I got the same results. The project's and module's language levels are both set to 8.0. I'm using Maven 3.2.3 and IntelliJ IDEA Community Edition 13.1.2.
tagged with: java
linked to: http://stackoverflow.com/q/31968515
type: Question
has answer: http://stackoverflow.com/a/43289693
has answer: http://stackoverflow.com/a/75944417
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/25888116
has answer: http://stackoverflow.com/a/59885408
downvote count: 0
has answer: http://stackoverflow.com/a/25888099

http://stackoverflow.com/comment/40581925
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25924175
type: Comment
has text: oh, so you mean change it to public ArrayList<Song> setSongList(..) I'm assuming.

http://stackoverflow.com/q/25991514
has answer: http://stackoverflow.com/a/25991654
tagged with: java
has body: hi i want to built a android app that send a text to a other activity but I don't see the input text on the second activity :( I try this tutorial: http://developer.android.com/training/basics/firstapp/index.html I make the same how in in this tutorial: If I click on send I use the Intent class and out this my string ... here is my code of DisplayMessageActivity.java public class DisplayMessageActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_display_message); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } // Get the message from the intent Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); // Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); // Set the text view as the activity layout setContentView(textView); } /** * 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; } } } UPDATE: My First Activity: 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); } // Button Events public void sendMessage(View view) { Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); …
downvote count: 2
tagged with: android-intent
type: Question
possible better answer: http://stackoverflow.com/a/25991658
has comment: http://stackoverflow.com/comment/40702287
score: -2
has answer: http://stackoverflow.com/a/25991658
accepted answer: http://stackoverflow.com/a/25991654
has comment: http://stackoverflow.com/comment/40702225
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/25991718
favorite count: 0
has comment: http://stackoverflow.com/comment/40702284
tagged with: android
has title: Why I don't get the String from the other Activity?
tagged with: fragment
tagged with: android-activity
type: AnsweredQuestion

http://stackoverflow.com/comment/40674858
type: QuestionComment
comment on: http://stackoverflow.com/q/25975301
has text: Why does it need to be encrypted?
score: 1
type: Comment

java
tags question: http://stackoverflow.com/q/26003184
tags question: http://stackoverflow.com/q/25993682
tags question: http://stackoverflow.com/q/25972186
tags question: http://stackoverflow.com/q/25896377
tags question: http://stackoverflow.com/q/25927708
tags question: http://stackoverflow.com/q/25916061
tags question: http://stackoverflow.com/q/25947611
tags question: http://stackoverflow.com/q/25994644
tags question: http://stackoverflow.com/q/25945046
tags question: http://stackoverflow.com/q/25926010
tags question: http://stackoverflow.com/q/25944718
tags question: http://stackoverflow.com/q/25944183
tags question: http://stackoverflow.com/q/25874322
tags question: http://stackoverflow.com/q/25933361
tags question: http://stackoverflow.com/q/25925478
tags question: http://stackoverflow.com/q/25939129
tags question: http://stackoverflow.com/q/25945594
tags question: http://stackoverflow.com/q/25874459
tags question: http://stackoverflow.com/q/26018790
tags question: http://stackoverflow.com/q/25922158
tags question: http://stackoverflow.com/q/25992431
tags question: http://stackoverflow.com/q/25959676
tags question: http://stackoverflow.com/q/25897818
tags question: http://stackoverflow.com/q/26023913
tags question: http://stackoverflow.com/q/25964435
tags question: http://stackoverflow.com/q/25934376
tags question: http://stackoverflow.com/q/25901379
tags question: http://stackoverflow.com/q/25969791
tags question: http://stackoverflow.com/q/25931357
tags question: http://stackoverflow.com/q/25879534
tags question: http://stackoverflow.com/q/25954990
tags question: http://stackoverflow.com/q/25940090
tags question: http://stackoverflow.com/q/26030425
tags question: http://stackoverflow.com/q/25979128
tags question: http://stackoverflow.com/q/25960504
tags question: http://stackoverflow.com/q/25983848
tags question: http://stackoverflow.com/q/25972681
tags question: http://stackoverflow.com/q/25941087
tags question: http://stackoverflow.com/q/25977102
tags question: http://stackoverflow.com/q/26032103
tags question: http://stackoverflow.com/q/25901135
tags question: http://stackoverflow.com/q/25935978
tags question: http://stackoverflow.com/q/25886058
tags question: http://stackoverflow.com/q/25936890
tags question: http://stackoverflow.com/q/26018730
tags question: http://stackoverflow.com/q/25985239
tags question: http://stackoverflow.com/q/25896534
tags question: http://stackoverflow.com/q/25945590
tags question: http://stackoverflow.com/q/26000758
tags question: http://stackoverflow.com/q/25966734
tags question: http://stackoverflow.com/q/25878073
tags question: http://stackoverflow.com/q/25936352
tags question: http://stackoverflow.com/q/25910027
tags question: http://stackoverflow.com/q/25934588
tags question: http://stackoverflow.com/q/25949650
tags question: http://stackoverflow.com/q/25897712
tags question: http://stackoverflow.com/q/25901194
tags question: http://stackoverflow.com/q/25944831
tags question: http://stackoverflow.com/q/25940782
tags question: http://stackoverflow.com/q/25973062
tags question: http://stackoverflow.com/q/25957204
tags question: http://stackoverflow.com/q/25875881
tags question: http://stackoverflow.com/q/25945741
tags question: http://stackoverflow.com/q/25958044
tags question: http://stackoverflow.com/q/25976055
tags question: http://stackoverflow.com/q/26028798
tags question: http://stackoverflow.com/q/25958251
tags question: http://stackoverflow.com/q/25897909
tags question: http://stackoverflow.com/q/25888996
tags question: http://stackoverflow.com/q/25908921
tags question: http://stackoverflow.com/q/26032022
tags question: http://stackoverflow.com/q/25908012
tags question: http://stackoverflow.com/q/25911517
tags question: http://stackoverflow.com/q/25951742
tags question: http://stackoverflow.com/q/25924515
tags question: http://stackoverflow.com/q/25985921
tags question: http://stackoverflow.com/q/25998804
tags question: http://stackoverflow.com/q/25971258
tags question: http://stackoverflow.com/q/25967744
tags question: http://stackoverflow.com/q/25994757

http://stackoverflow.com/comment/40757541
comment on: http://stackoverflow.com/a/26000827
score: 0
has text: The cdi-api.jar isn't in the jar files of Glassfish 4.1. I added it manually to the Libraries section of Netbeans and the application compiled and worked correctly. I have only one weld file "weld-osgi-bundle.jar" that existed also in Glassfish 4.0 but, in GF 4.1 it is smaller. Thank you very much :)
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25987936
has answer: http://stackoverflow.com/a/25988517
answer count: 1
has body: Hashtable env = new Hashtable(11);create environment env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://localhost:10389/ou=system");url Declaration env.put(Context.SECURITY_CREDENTIALS, "secret"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "ou=121,ousystem");For this is Domain env.put(Context.SECURITY_CREDENTIALS, "secret");set new credential // Search and retrieve DN. DirContext ctx = null; NamingEnumeration results = null; try { ctx = new InitialDirContext(env);`cant create obj here` SearchControls controls = new SearchControls(); // Authenticate ldap = new InitialLdapContext(env, null); } catch (AuthenticationException ae) { ae.printStackTrace(); } catch (NamingException e) { e.printStackTrace(); } Error : javax.naming.NameNotFoundException:when creating obj for context
downvote count: 0
favorite count: 0
tagged with: security
tagged with: ldap
tagged with: credentials
type: UnansweredQuestion
tagged with: authentication
upvote count: 1
has title: How can set New Security Credential for ldap Authentication in Java Code
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/40610828
type: Comment
comment on: http://stackoverflow.com/a/25939807
score: 0
type: AnswerComment
has text: @ChathurangaSandaruwan: here is some sample code from a previous answer of mine regarding passing references in Swing GUI's: [example code answer](http://stackoverflow.com/a/9475111/522444).

http://stackoverflow.com/q/25920481
type: AnsweredQuestion
has title: What content does getSerialVersionUID use to determine the UID?
tagged with: java
has answer: http://stackoverflow.com/a/25920498
type: Question
has comment: http://stackoverflow.com/comment/40684324
has body: So, I have a large project that serializes many things when saving a configuration, and had to do a re-design of a large section of it. Since I had already defined the serialVersionUID field for a lot of classes, I wanted to know which files I needed to re-calculate the UID for. I couldn't find any post on SO about what properties of a class were used in the calculation of the serialVersionUID (via ObjectStreamClass.lookup(classname) ). I finally found the spot in the spec that defines it. So, this is more of one of those self-answering questions for the sake of saving this small piece of knowledge. If this is out-of-etiquette (since it is a spec question) please let me know, I'll gladly remove it or whatever is SO-appropriate. So, what particulars of a class are used when using the Java-built-in algorithm of calculating a serialVersionUID?
has comment: http://stackoverflow.com/comment/40681815
has comment: http://stackoverflow.com/comment/40605488
tagged with: serialversionuid
score: 0
accepted answer: http://stackoverflow.com/a/25920498
answer count: 1
tagged with: serialization
has comment: http://stackoverflow.com/comment/40678859
has comment: http://stackoverflow.com/comment/40681776

http://stackoverflow.com/comment/40725301
type: Comment
has text: Oh, and you also should think about how you're going to handle more repetitions than fit in your current schema (how will you encode "`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`")?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26003765

http://stackoverflow.com/q/25969135
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: indexoutofboundsexception
accepted answer: http://stackoverflow.com/a/25969184
has body: I have been following a tutorial online on making a 2D game but hope to expand on it. Everything has been working up to the point when I try moving items around in an inventory. I can successfully pick up items and place them back down onto the invBar, but it will not allow me to place them into the inventory invBag. I have followed everything that he went over but for some reason he did not get the error. I am a beginning coder and so far I understand that this error is created by the array going "out of bounds" (as the title of the error obviously mentions) but I do not understand "how" it is going out of bounds. Edit: GAWD I am an idiot... for some reason I have been typing 1 instead of i for some dum reason, and apparently that was the problem. Code for Inventory: package y.m.m //to protect project name import java.awt.*; import java.awt.event.*; public class Inventory { public static Cell[] invBar = new Cell[Tile.invLength]; public static Cell[] invBag = new Cell[Tile.invLength * Tile.invHeight]; public static boolean isOpen = false; public static boolean isHolding = false; public static int selected = 0; public static int[] holdingID = Tile.air; public static int holdingCount = 0; public Inventory() { for(int i = 0; i &lt; invBar.length; i++) { invBar[i] = new Cell(new Rectangle((Component.pixel.width / 2) - ((Tile.invLength * (Tile.invCellSize + Tile.invCellSpace))/2) + (i * (Tile.invCellSize + Tile.invCellSpace)), Component.pixel.height - (Tile.invCellSize + Tile.invBorderSpace), Tile.invCellSize, Tile.invCellSize), Tile.air); } int x = 0, y = 0; for(int i = 0; i &lt; invBag.length; i++) { invBag[i] = new Cell(new Rectangle((Component.pixel.width / 2) - ((Tile.invLength * (Tile.invCellSize + Tile.invCellSpace))/2) + (x * (Tile.invCellSize + Tile.invCellSpace)), Component.pixel.height - (Tile.invCellSize + Tile.invBorderSpace) - (Tile.invHeight * (Tile.invCellSize + Tile.invCellSpace)) + (y * (Tile.invCellSize + Tile.invCellSpace)), Tile.invCellSize, Tile.inv…
answer count: 1
tagged with: arrays
tagged with: applet
score: 0
tagged with: windows
has answer: http://stackoverflow.com/a/25969184
has title: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 10 for Inventory

http://stackoverflow.com/comment/40743385
type: Comment
has text: I wouldn't say it is clean. You are now basically modifying your business object to accomodate for the web layer. As I mentioned you are basically trying to solve 2 problems in a single model/domain.
comment on: http://stackoverflow.com/a/26013723
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40767593
has text: There shouldn't be a huge difference if you go with the SecondaryTable approach. If you were going to take @Rika's approach that wouldn't allow updates/inserts, I don't believe you can use a join table with one-to-ones so it would make a difference, but since you're not going down that path it probably doesn't matter. Though I'm not sure that OneToOne is legal on a collection; I've never tried to do that (it's semantically wrong, whether it works or not, so I've never wanted to), so you might hit problems, but if you do they should be easy enough for you to sort out.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26025286
score: 0

http://stackoverflow.com/q/25974988
tagged with: logging
has title: Log4java zip compression issue: All file appenders are the same but compression only works for some of them
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30299399
has body: how are you? I have some issues with Log4Java configuration. I want to compress in zip all the files daily. All the file appenders are configured in the same way except for the file names, the file paths and the appender names. But, compression is only working on some of the files (on our test server) and on one file in our production server. We are using org.apache.log4j.rolling.RollingFileAppender from apache-log4j-extras-1.2.17.jar and log4j-1.2.17.jar. This is one example of our configuration, from an appender that works and an appender that doesn't work. The appender that works: log4j.appender.A_WS_CETELEM=org.apache.log4j.rolling.RollingFileAppender log4j.appender.A_WS_CETELEM.File=\\\\10.5.128.23\\DocumentosFico\\Stofi_Logs\\log_ws_CETELEM.log log4j.appender.A_WS_CETELEM.ImmediateFlush=true log4j.appender.A_WS_CETELEM.RollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy log4j.appender.A_WS_CETELEM.RollingPolicy.ActiveFileName=\\\\10.5.128.23\\DocumentosFico\\Stofi_Logs\\log_ws_CETELEM.log log4j.appender.A_WS_CETELEM.RollingPolicy.FileNamePattern=\\\\10.5.128.23\\DocumentosFico\\Stofi_Logs\\log_ws_CETELEM.%d{yyyyMMdd}.zip log4j.appender.A_WS_CETELEM.Encoding=ISO-8859-1 log4j.appender.A_WS_CETELEM.layout=org.apache.log4j.PatternLayout log4j.appender.A_WS_CETELEM.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - %m%n log4j.appender.A_WS_CETELEM.append=true log4j.logger.log_ws_CETELEM=DEBUG,A_WS_CETELEM And one that doesn't work: log4j.appender.A_INTERFACES_ADSI=org.apache.log4j.rolling.RollingFileAppender log4j.appender.A_INTERFACES_ADSI.File=\\\\10.5.128.23\\DocumentosFico\\Stofi_Logs\\log_Interfaces_ADSI.log log4j.appender.A_INTERFACES_ADSI.ImmediateFlush=true log4j.appender.A_INTERFACES_ADSI.RollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy log4j.appender.A_INTERFACES_ADSI.RollingPolicy.ActiveFileName=\\\\10.5.128.23\\DocumentosFico\\Stofi_Logs\\log_Interfaces_ADSI.log log4j.appender.A_INTERFACES_ADSI.RollingPolicy.FileNamePattern=\\\\1…
type: Question
score: 0
tagged with: compression
answer count: 1

http://stackoverflow.com/q/25996247
accepted answer: http://stackoverflow.com/a/25997500
favorite count: 0
has body: We did this JavaFX practice problem in class and it keeps giving me a color wheel when I click the "hit me" button. I've looked through the code and even had my professor do so, and I can't see any issues. Is it possible that it's a Mac problem? My friend's code ran just fine on his Windows machine. package csc502_classexample_events_1; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javax.swing.JOptionPane; /** * * @author aufty */ public class CSC502_ClassExample_Events_1 extends Application { @Override public void start(Stage stage) { // Single centered button in HBox Button button = new Button("Hit me"); button.setOnAction(new ClickHandler()); HBox hBox = new HBox(); hBox.getChildren().add(button); hBox.setAlignment(Pos.CENTER); stage.setTitle("My Event Handler Example"); Scene scene = new Scene(hBox, 400, 80); stage.setScene(scene); stage.show(); } public static void main(String [] args) { launch(args); } } class ClickHandler implements EventHandler&lt;ActionEvent&gt; { @Override public void handle(ActionEvent event) { JOptionPane.showMessageDialog(null, "Ouch"); } }
tagged with: joptionpane
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25997500
has title: Simple message box homework gives me color wheel
answer count: 1
downvote count: 0

http://stackoverflow.com/q/25910350
upvote count: 4
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40555898
type: Question
tagged with: transactions
tagged with: java
has answer: http://stackoverflow.com/a/25910635
accepted answer: http://stackoverflow.com/a/25910635
score: 4
tagged with: spring-transactions
has comment: http://stackoverflow.com/comment/40556144
answer count: 1
has body: I am trying to use annotated TX Spring support. Application context XML: &lt;?xml ...&gt; &lt;tx:annotation-driven/&gt; &lt;bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource"&gt; ... &lt;/bean&gt; &lt;bean id="repository" class="Repository"&gt; &lt;constructor-arg ref="dataSource"/&gt; &lt;/bean&gt; &lt;/beans&gt; Actual code: public class Repository { @Transactional public void save(Op op) { System.out.println("Transaction active:::: " + TransactionSynchronizationManager.isActualTransactionActive()); ... } } Calling code: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"/integration-context.xml"}) public class RepositoryTest { @Autowired private Repository repository; @Test public void testRepositoryPersistence() { Op op = mock(Op.class); repository.save(op); } } And it gives FALSE. What am I doing wrong?
has comment: http://stackoverflow.com/comment/40555948
favorite count: 0
has title: Spring @Transactional is not working
has comment: http://stackoverflow.com/comment/40556256
has comment: http://stackoverflow.com/comment/40556048
tagged with: spring

http://stackoverflow.com/a/25958382
has body: I would prefer to use Collection Framework (e.g. ArrayList) or any other object which can encapsulate many objects when you want to serialize more than 1 objects. But to work it your way, you have to give your serialized file a standard. You may add first object as an Integer which will tell you how much objects are stored in your file. FileOutputStream outputStream=new FileOutputStream(new File("Output.ser")); ObjectOutputStream objectOutputStream=new ObjectOutputStream(outputStream); objectOutputStream.writeObject(new Integer(4)); objectOutputStream.writeObject(employee); objectOutputStream.writeObject(employee2); objectOutputStream.writeObject(employee3); objectOutputStream.writeObject(employee4); objectOutputStream.close(); When desirializing, you can get the number of objects serialized. FileInputStream fileInputStream=new FileInputStream(new File(fileName)); ObjectInputStream stream=new ObjectInputStream(fileInputStream); Employee emp; Integer size = (Integer) stream.readObject(); for(int i = 0; i &lt; size; i++) { Employee emp = (Employee) stream.readObject(); String uName=emp.getUserId(); String uPass=emp.getPassword(); map.put(uName, uPass); } It is a normal method how many files are stored in your filesystem but here you are doing it externally for your own purpose. Remember you will have to do necessary exception handling if you decide to work this way.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25958044
downvote count: 0

http://stackoverflow.com/q/25891234
has answer: http://stackoverflow.com/a/25891636
score: 12
type: Question
has answer: http://stackoverflow.com/a/25891478
favorite count: 0
answer count: 3
tagged with: future
upvote count: 12
has answer: http://stackoverflow.com/a/34674457
has title: Java cancel Future - How to wait for finish?
accepted answer: http://stackoverflow.com/a/25891636
type: AnsweredQuestion
downvote count: 0
tagged with: futuretask
tagged with: java
has body: Long story short: I have a collection of Future objects. Some of them are already in progress, some are not. I iterate the collection and call future.cancel(false) which, according to the documentation, should cancel all Futures that are not currently running but should allow all the others to complete. My question is: How do I know when a particular Future is completed after I have called future.cancel(false)? future.isDone() always returns true because cancel() was indeed called before that and future.get() always throws a CancellationException even though the Future is still running. Any suggestions?
possible better answer: http://stackoverflow.com/a/25891478

http://stackoverflow.com/q/25910027
tagged with: selenium
has answer: http://stackoverflow.com/a/29806263
type: Question
has title: Selenium: UnexpectedTagNameException for cssSelector in Java
accepted answer: http://stackoverflow.com/a/29806263
score: 0
has comment: http://stackoverflow.com/comment/40570231
has comment: http://stackoverflow.com/comment/40969268
answer count: 1
has body: I am getting UnexpectedTagNameException for cssSelector. Below is the piece of code for HTML and java lucky driverWait = new WebDriverWait(driver, 1000); public WebElement waitByCSSSelector(String locator) { return driverWait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(locator))); } WebElement dropDownListBox1 = waitById("_a9sizb"); Select clickThis1 = new Select(dropDownListBox1); clickThis1.selectByIndex(5); waitByCSSSelector("//*[@id='_a9sizb']").click(); Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "a" Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30' System info: host: 'Sudhir', ip: '192.168.250.16', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_51' Driver info: driver.version: unknown at org.openqa.selenium.support.ui.Select.<init>(Select.java:46) at ui.UIRegisterPatient.setCharityAmount(UIRegisterPatient.java:151) at tc.TCRegistrationNewEmerPatient.setCharityAmountForEmer(TCRegistrationNewEmerPatient.java:129) at tc.TCRegistrationNewEmerPatient.setNewPrimayPatientDetails(TCRegistrationNewEmerPatient.java:32) at tc.StartAutmation.main(StartAutmation.java:17) When I try to use the following code waitByCSSSelector("#_a9sizb > nobr > img").click(); There is no response from the application. Any help is highly appreciable. Apologies if this has already been discussed.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40586809
tagged with: java

http://stackoverflow.com/q/25932810
tagged with: simple-framework
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40597453
tagged with: java
has answer: http://stackoverflow.com/a/25933261
type: Question
has answer: http://stackoverflow.com/a/25933240
has answer: http://stackoverflow.com/a/25934967
score: 0
answer count: 3
has title: Simplexml list doesn't work
has comment: http://stackoverflow.com/comment/40597294
tagged with: http://stackoverflow.com/tag/xml
has body: I want to read and parse an XML file containing the information of employees using SimpleXML framework. Here is my XML file: <?xml version="1.0" encoding="UTF-8"?> 29 Pankaj Male Java Developer 35 Lisa Female CEO Here is Employees class: @Root public class Employees { @ElementList(inline = true) private List list; public List getList() { return list; } } Here is Employee class: @Root public class Employee { @Element private String name; @Element private String gender; @Element private int age; @Element private String role; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } @Override public String toString() { return " Name=" + this.name + " Age=" + this.age + " Gender=" + this.gender + " Role=" + this.role; } } But when I try to read and parse the XML file an exception occurs. Here is the output: Exception in thread "main" org.simpleframework.xml.core.ElementException: Element 'Employee' does not have a match in class Employees at line 3

http://stackoverflow.com/a/25957199
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25945535
has body: You have to pass callbackContext to the DownloadManager class. @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { context=this.cordova.getActivity().getApplicationContext(); String myurl = args.getString(0); if (action.equals("plugin1")) { // Pass callbackContext to your actual code which performing the work. new DownloadManager(callbackContext).execute(myurl); return true; } callbackContext.error("error"); return false; } public class DownloadManager extends AsyncTask&lt;String, String, String&gt; { private CallbackContext callbackContext; public DownloadManager(CallbackContext callbackContext) { this.callbackContext = callbackContext; } @Override public String doInBackground(String... arg0) { downloadapk(arg0[0]); installapk(); this.callbackContext.success(); return null; //Here I want to return to javascript.How can I callback to the javascript function from //async method?? }
answers question: http://stackoverflow.com/q/25945535

http://stackoverflow.com/q/25951877
tagged with: selection-sort
score: 0
has title: Selection Sort timing
linked to: http://stackoverflow.com/q/504103
tagged with: time
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40629790
has comment: http://stackoverflow.com/comment/40629407
answer count: 1
has answer: http://stackoverflow.com/a/25952310
tagged with: sorting
has body: I wrote a quick selection sort program shown below: public static ArrayList&lt;Integer&gt; selectionSort(ArrayList&lt;Integer&gt; list) { for (int i=0; i &lt; list.size()-1; i++) { int smallestElement = i; for (int j=i+1; j &lt; list.size(); j++) { if (list.get(j) &lt; list.get(smallestElement)) { smallestElement = j; } } swapPosition(list, smallestElement, i); } return list; } public static void swapPosition(ArrayList&lt;Integer&gt; list, int first, int second) { Collections.swap(list, first, second); } In my main program, I calculate the time the program takes to run in milliseconds. I created a new ArrayList of 1000 items that are already sorted and calculated the best case scenario time. I then reversed the order of the 1000 items to signify the worst case scenario when all the items must be swapped, but my worst case scenario takes less time than my best case for some reason. In the best case, nothing should have to be swapped. Why is my program taking more time to run in the best case than in the worst case? Here is the code for the rest: ArrayList&lt;Integer&gt; bestCase = new ArrayList&lt;Integer&gt;(); for (int i=1; i &lt; 1001; i++) { bestCase.add(i); } long startTimeBest = System.currentTimeMillis(); selectionSort(bestCase); long endTimeBest = System.currentTimeMillis(); long totalTimeBest = endTimeBest - startTimeBest; System.out.println("Total time of this program in the best case " + "scenario is: " + totalTimeBest + " millisecond(s)"); Collections.reverse(bestCase); long startTimeWorst = System.currentTimeMillis(); selectionSort(bestCase); long endTimeWorst = System.currentTimeMillis(); long totalTimeWorst = endTimeWorst - startTimeWorst; System.out.println("Total time of this program in the worst case " + "scenario is: " + totalTimeWorst + " millisecond(s)"); The time for the best case is 16 ms and the worst case is 4 ms. This doesn't make sense.

jsp
tags question: http://stackoverflow.com/q/26012037
tags question: http://stackoverflow.com/q/25920927
tags question: http://stackoverflow.com/q/25888307
tags question: http://stackoverflow.com/q/25940525
tags question: http://stackoverflow.com/q/25912457
tags question: http://stackoverflow.com/q/25928486
tags question: http://stackoverflow.com/q/26013412
tags question: http://stackoverflow.com/q/26017767
tags question: http://stackoverflow.com/q/26015982
tags question: http://stackoverflow.com/q/25951167
tags question: http://stackoverflow.com/q/25931316
tags question: http://stackoverflow.com/q/25904298
tags question: http://stackoverflow.com/q/25937487
tags question: http://stackoverflow.com/q/25960338
tags question: http://stackoverflow.com/q/25890271
tags question: http://stackoverflow.com/q/26017291
tags question: http://stackoverflow.com/q/25884219
tags question: http://stackoverflow.com/q/25974351
tags question: http://stackoverflow.com/q/26018988
tags question: http://stackoverflow.com/q/25926593
tags question: http://stackoverflow.com/q/25934781
tags question: http://stackoverflow.com/q/25967551
tags question: http://stackoverflow.com/q/26009229
tags question: http://stackoverflow.com/q/25975750
tags question: http://stackoverflow.com/q/25992431
tags question: http://stackoverflow.com/q/25960504
tags question: http://stackoverflow.com/q/25899015
tags question: http://stackoverflow.com/q/26027668
tags question: http://stackoverflow.com/q/26013994
tags question: http://stackoverflow.com/q/26015149
tags question: http://stackoverflow.com/q/25908004
tags question: http://stackoverflow.com/q/26016918
tags question: http://stackoverflow.com/q/25915723
tags question: http://stackoverflow.com/q/25914052
tags question: http://stackoverflow.com/q/25971168
tags question: http://stackoverflow.com/q/26032634
tags question: http://stackoverflow.com/q/25913117
type: Tag
tags question: http://stackoverflow.com/q/26001202
tags question: http://stackoverflow.com/q/25913081
tags question: http://stackoverflow.com/q/25949625
tags question: http://stackoverflow.com/q/25905920
tags question: http://stackoverflow.com/q/26011851
tags question: http://stackoverflow.com/q/25969036
tags question: http://stackoverflow.com/q/25876601
tags question: http://stackoverflow.com/q/25993547
tags question: http://stackoverflow.com/q/25893913
tags question: http://stackoverflow.com/q/25882204
tags question: http://stackoverflow.com/q/25910536
tags question: http://stackoverflow.com/q/26018705
tags question: http://stackoverflow.com/q/25908994
tags question: http://stackoverflow.com/q/25894200
tags question: http://stackoverflow.com/q/25903781
tags question: http://stackoverflow.com/q/25893892
tags question: http://stackoverflow.com/q/25997566
tags question: http://stackoverflow.com/q/25886216
tag name: jsp
tags question: http://stackoverflow.com/q/25959906
tags question: http://stackoverflow.com/q/25968044
tags question: http://stackoverflow.com/q/25980860
tags question: http://stackoverflow.com/q/25982283
tags question: http://stackoverflow.com/q/26033729
tags question: http://stackoverflow.com/q/26012663
tags question: http://stackoverflow.com/q/25968386
tags question: http://stackoverflow.com/q/25893283
tags question: http://stackoverflow.com/q/26029888
tags question: http://stackoverflow.com/q/25950686
tags question: http://stackoverflow.com/q/25984367
tags question: http://stackoverflow.com/q/25927652
tags question: http://stackoverflow.com/q/25936387
tags question: http://stackoverflow.com/q/25938874
tags question: http://stackoverflow.com/q/25892562
tags question: http://stackoverflow.com/q/26031429
tags question: http://stackoverflow.com/q/25906171
tags question: http://stackoverflow.com/q/25957790
tags question: http://stackoverflow.com/q/25927827
tags question: http://stackoverflow.com/q/26010778
tags question: http://stackoverflow.com/q/25969081
tags question: http://stackoverflow.com/q/25904972
tags question: http://stackoverflow.com/q/25883481

http://stackoverflow.com/q/25950065
has title: hibernate not updating in spring mvc
has comment: http://stackoverflow.com/comment/40626705
tagged with: spring
has comment: http://stackoverflow.com/comment/40626751
tagged with: spring-mvc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25950337
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40626676
type: Question
has body: i have a problem that my project is based on spring mvc integrated with hibernate.in this update is not working.. dao @Override public void updateAuditorium(Auditorium auditorium) { openSession().update(auditorium); } service @Transactional public void update(Auditorium auditorium) { auditoriumDAO.updateAuditorium(auditorium); } configuration &lt;beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;beans:property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt; &lt;beans:property name="url" value="jdbc:mysql://localhost:3306/auditoriumbooking" /&gt; &lt;beans:property name="username" value="root" /&gt; &lt;beans:property name="password" value="root" /&gt; &lt;/beans:bean&gt; &lt;!-- Hibernate 4 SessionFactory Bean definition --&gt; &lt;beans:bean id="hibernate4AnnotatedSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt; &lt;beans:property name="dataSource" ref="dataSource" /&gt; &lt;beans:property name="packagesToScan"&gt; &lt;beans:list&gt; &lt;beans:value&gt;com.company.product.model&lt;/beans:value&gt; &lt;/beans:list&gt; &lt;/beans:property&gt; &lt;beans:property name="hibernateProperties"&gt; &lt;beans:props&gt; &lt;beans:prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect &lt;/beans:prop&gt; &lt;beans:prop key="hibernate.show_sql"&gt;true&lt;/beans:prop&gt; &lt;/beans:props&gt; &lt;/beans:property&gt; &lt;/beans:bean&gt; After function executed noting happend.
has answer: http://stackoverflow.com/a/25950354
accepted answer: http://stackoverflow.com/a/25950354
has answer: http://stackoverflow.com/a/25950337
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40626617

http://stackoverflow.com/a/40616033
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25976314
downvote count: 0
has body: As previously stated, shiro does not generate a new ID upon user login. You could easily implement this yourself though: @Override protected boolean executeLogin( final ServletRequest request, final ServletResponse response ) throws Exception { final AuthenticationToken token = createToken( request, response ); if ( token == null ) { throw new IllegalStateException( "Your error message here" ); } try { // Stop session fixation issues. // https://issues.apache.org/jira/browse/SHIRO-170 final Subject subject = getSubject( request, response ); Session session = subject.getSession(); // Store the attributes so we can copy them to the new session after auth. final LinkedHashMap&lt;Object, Object&gt; attributes = new LinkedHashMap&lt;Object, Object&gt;(); final Collection&lt;Object&gt; keys = session.getAttributeKeys(); for ( Object key : keys ) { final Object value = session.getAttribute( key ); if ( value != null ) { attributes.put( key, value ); } } session.stop(); subject.login( token ); // Restore the attributes. session = subject.getSession(); for ( final Object key : attributes.keySet() ) { session.setAttribute( key, attributes.get( key ) ); } return onLoginSuccess( token, subject, request, response ); } catch ( AuthenticationException e ) { return onLoginFailure( token, e, request, response ); } } Reference

http://stackoverflow.com/q/25907687
answer count: 2
downvote count: 0
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/25927343
type: UnansweredQuestion
tagged with: logging
score: 1
tagged with: java
has body: While printing mybatis SQL statements on console I am getting this error: java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()Z I use log4j which is supported by mybatis. My log4j.properties file: ### Global logging configuration log4j.rootLogger=INFO, stdout log4j.logger.com.app.mybatis.dao=stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n Strange thing is that if I specify a class to be logged, for example log4j.logger.com.app.mybatis.dao.MyClass=stdout it works fine but not for the package. Any idea of what would be causing this?
upvote count: 1
has title: java mybatis isTraceEnabled()Z error
type: Question
has answer: http://stackoverflow.com/a/25914310
tagged with: mybatis

http://stackoverflow.com/q/25892831
linked to: http://stackoverflow.com/q/25837852
has body: So I'm trying to get my Jetty/Jersey/Gradle setup to serve up index.html which is in src/main/webapp/static/ when at the default url. I have /api for my java server, so I figured showing static content would be somewhat easy but I'm running into problems. Here is what I have in my web.xml Webapp Filter com.sun.jersey.spi.container.servlet.ServletContainer jersey.config.server.provider.packages main/webapp/static jersey.config.servlet.filter.staticContentRegex /.*html Webapp Filter /* Am I missing something or doing something wrong? When I do gradle jettyRun I get The ResourceConfig instance does not contain any root resource classes. failed Webapp Filter: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes. Failed startup of context org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext@48e8a298{/Project,/User/Project/src/main/webapp} com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes. so it makes me think that it's looking at the right place but maybe it's just not finding the correct thing? Thanks for the help, I really appreciate it
has title: Serving Static Content Jetty Jersey Gradle
type: UnansweredQuestion
tagged with: jetty
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/40676466
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/25899374
tagged with: jersey
answer count: 1
tagged with: jersey-2.0

http://stackoverflow.com/q/25994261
has comment: http://stackoverflow.com/comment/65306238
has title: How to execute "collapse-all-folds" in the MATLAB editor programatically?
tagged with: matlab
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26246490
possible better answer: http://stackoverflow.com/a/26000567
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26000567
downvote count: 0
has body: I've been struggling with the problem in the subject for a bit longer than I'd like to admit. I'm attempting to programatically execute the same Action that occurs when the user either clicks on the View > Collapse All button or right-clicks within the editor window and then Code Folding > Fold All. What I tried\found so far: The String that corresponds to the Action may be found in the enum com.mathworks.mde.editor.ActionID and is: 'collapse-all-folds'. When the Action activates, the following method seems to be executed: org.netbeans.api.editor.fold.FoldUtilities.collapseAll(...) (hence the netbeans tag). This code allows me to get instances of EditorAction, ActionManager, MatlabEditor: jEd = com.mathworks.mlservices.MLEditorServices.getEditorApplication.getActiveEditor; jAm = com.mathworks.mde.editor.ActionManager(jEd); jAc = com.mathworks.mde.editor.EditorAction('collapse-all-folds'); My problem is that I can't find a way to actually activate the Action. Any ideas / alternatives? EDIT1: After digging a bit in "the book", I think I came even closer than before (but still not quite there). Quoting from the book: Java GUI components often use anActionMapto store runnableActionsthat are invoked by listeners on mouse, keyboard, property, or container events. Unlike object methods,Actionscannot be directly invoked by MATLAB. And then a workaround is explained which involves roughly: getting some sort of an Action object; creating an ActionEvent and invoking Action's actionPerformed with the ActionEvent as an argument, as implemented below: import java.awt.event.*; jEd = com.mathworks.mlservices.MLEditorServices.getEditorApplication.getActiveEditor; jAm = com.mathworks.mde.editor.ActionManager(jEd); jAc = jAm.getAction(com.mathworks.mde.editor.EditorAction('collapse-all-folds')); jAe = ActionEvent(jAm, ActionEvent.ACTION_PERFORMED, ''); jAc.actionPerformed(jAe); This code runs without errors - but does (seemingly?) nothing. I suspect that I'm calling ActionEvent and ac…
has comment: http://stackoverflow.com/comment/40711293
tagged with: matlab-java
has comment: http://stackoverflow.com/comment/40711328
upvote count: 8
accepted answer: http://stackoverflow.com/a/26246490
favorite count: 0
score: 8
tagged with: netbeans

http://stackoverflow.com/q/25987918
type: UnansweredQuestion
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/25990197
has title: Dice Program in Java
has answer: http://stackoverflow.com/a/25988909
tagged with: java
has body: I am making a dice simulator, and my task is to roll 4 dice at a time, add up each face of the die, and repeat that process as many times as I want. Then I have to record how many times each roll (the 4 dice added up) happened, and make a table. What I am basically struggling with is how to loop my code so that it can repeat the roll as many times as I want, keeping track of the numerical value of each roll. Here is my code so far: This is my program for the Die: import java.util.Random; public class Die { private Random generator; private int sides; public Die (int s) { sides = s; generator = new Random(); } public int cast() { return 1 + generator.nextInt(sides); } } And this is my Die Simulator program: import java.util.Scanner; import java.util.Random; public class DieSimulator { public static void main(String[] args) { Die d1 = new Die(6); Die d2 = new Die(6); Die d3 = new Die(6); Die d4 = new Die(6); final int TRIES = 1; for (int i = 1; i &lt;= TRIES; TRIES +) { int n1 = d1.cast(); //System.out.print(n1 + ""); int n2 = d2.cast(); //System.out.print(n2 + ""); int n3 = d3.cast(); //System.out.print(n3 + ""); int n4 = d4.cast(); System.out.print(n4 + n3 + n2 + n1); n = n4 + n3 + n2 + n1 } System.out.println(); } } The commented section of the Die simulator program was just me trying to figure out how to post the numerical values of the roll. any help would be appreciated
score: 0
answer count: 2
tagged with: random
tagged with: dice
has comment: http://stackoverflow.com/comment/40696151
has comment: http://stackoverflow.com/comment/40696049
has comment: http://stackoverflow.com/comment/40696070
has comment: http://stackoverflow.com/comment/40696067
has comment: http://stackoverflow.com/comment/40696019
has comment: http://stackoverflow.com/comment/40696605

http://stackoverflow.com/comment/40819183
comment on: http://stackoverflow.com/a/26019212
has text: That way I can change the value of the property visibility to 'visible' in the web element.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40610170
type: Comment
comment on: http://stackoverflow.com/a/25929751
has text: there's nothing below ...
type: AnswerComment
score: 0

http://stackoverflow.com/a/25901495
has body: With this method-chaining builder pattern, the key is to recognize that each call to addVertex returns a (new) builder. To loop this, you can repeatedly overwrite the current builder with a new one each iteration. PolygonBuilder builder = Polygon.Builder(); for (int i = 0; i &lt; vertices.length; i++) { builder = builder.addVertex(new Point(vertices[i].getX(), vertices[i].getY()); } Polygon polygon = builder.build(); This works whether each addVertex call returns a new builder or whether it returns the same builder each time. Either way.
type: Answer
score: 13
accepted answer of: http://stackoverflow.com/q/25901442
downvote count: 0
answers question: http://stackoverflow.com/q/25901442
type: AcceptedAnswer
upvote count: 13

http://stackoverflow.com/comment/133737114
type: Comment
has text: thank you, may be this is not the right answer to the question, but it's exactly what I was looking for.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/73049916

http://stackoverflow.com/comment/40770403
has text: What you can do is create a `bool flag = false`and run your code until the `flag` is false. Once the operation is `=0` set your flag to true.
type: QuestionComment
comment on: http://stackoverflow.com/q/26028671
score: 0
type: Comment

http://stackoverflow.com/comment/40544563
score: 0
type: Comment
has text: can you tell me what is wrong with my code ? If i send sms to my gsm modem using some other mobile why can't i read data? my serialEvent() is never called then.
comment on: http://stackoverflow.com/a/25884311
type: AnswerComment

http://stackoverflow.com/q/25986750
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25987409
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40694138
has body: In Java, the following is allowed: public void handleError() { try { System.out.println("Out of memory error!!"); } catch(OutOfMemoryError outOfMemoryError) { System.out.println( "This is catch block of out of memory error Message:"+ outOfMemoryError.getMessage()); } } In what situation is the above code valid? If the app runs out of memory then will the app even execute, and why is the above code valid?
has comment: http://stackoverflow.com/comment/40694556
has title: Why does Java allow catching Error types when applications aren't supposed to handle them?
has answer: http://stackoverflow.com/a/25986815
has answer: http://stackoverflow.com/a/25987036
has comment: http://stackoverflow.com/comment/40693997
has answer: http://stackoverflow.com/a/25987071
favorite count: 0
tagged with: out-of-memory
tagged with: exception
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2679330
has comment: http://stackoverflow.com/comment/40694066
answer count: 4

http://stackoverflow.com/q/25896434
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40531092
type: Question
has answer: http://stackoverflow.com/a/25897477
has answer: http://stackoverflow.com/a/25896808
tagged with: algorithm
has answer: http://stackoverflow.com/a/25896679
tagged with: java
has body: Say I have a list of items, such as 5 tables, 5 chairs, etc. Each table is made up of 4 legs, and a tabletop. Each leg is made up of 2 pieces of wood, a tabletop is made up of 5 piece of wood and 4 screws, etc. I have the list of item components stored in a database with columns (item1, item2, amount), where item2 is a component of item1, and 'amount' being the number of item2s required. I want to calculate the total net requirements for a list of lowest-level materials, with no assumptions about the number of hierarchy levels, is there an optimal way to do this? If it matters, I am planning to do this in Java.
has title: Is there an optimal algorithm for calculating net requirements of components?
score: 0
has answer: http://stackoverflow.com/a/25896959
answer count: 4
has comment: http://stackoverflow.com/comment/40531356

http://stackoverflow.com/a/26019460
answers question: http://stackoverflow.com/q/26016311
has comment: http://stackoverflow.com/comment/40780336
has comment: http://stackoverflow.com/comment/40777509
has comment: http://stackoverflow.com/comment/40763000
has comment: http://stackoverflow.com/comment/40780248
score: 0
has comment: http://stackoverflow.com/comment/40753568
type: Answer
has body: There are so many ways of doing this, I'm pretty sure that this answer will be incomplete, but here are a few options... As currently seems to be recommended practice, use constructor injection for your services rather than autowiring the fields directly. This makes testing like this so much easier. public class SomeTest { @Mock private ThirdPartyService mockedBean; @Before public void init() { initMocks(this); } @Test public void test() { BeanUnderTest bean = new BeanUnderTest(mockedBean); // ... } } public class BeanUnderTest{ private ThirdPartyService service; @Autowired public BeanUnderTest(ThirdPartyService ThirdPartyService) { this.thirdPartyService = thirdPartyService; } } By doing that, you can also mix up autowired and mocked services by autowiring into the test itself and then constructing the beans under test with the most useful mix of autowired and mocked beans. A reasonable alternative is to use Spring profiles to define stub services. This is particularly useful when wish to use the same stubbed features in multiple tests: @Service @Primary @Profile("test") public class MyServiceStub implements MyService { // ... } @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = SomeTest.Beans.class) @ActiveProfiles({"test"}) public class SomeTest { // ... } By using the @Primary annotation, it ensures that this stub bean will be used instead of any other bean implementing the MyService interface. I tend to use this approach for things like email services, where by changing profile, I'm able to switch between a real mail server and Wiser.

http://stackoverflow.com/a/38491569
accepted answer of: http://stackoverflow.com/q/25895076
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25895076
type: Answer
has body: OkHttp's Response will give you the wire-level request (https://square.github.io/okhttp/3.x/okhttp/okhttp3/Response.html#request--). This will be the Request that initiated the Response from the redirect. The Request will give you its HttpUrl, and HttpUrl can give you its parameters' keys and values, paths, etc. With Retrofit 2, simply use retrofit2.Response.raw() to get the okhttp3.Response and follow the above.
upvote count: 5

http://stackoverflow.com/comment/40647966
type: QuestionComment
score: 0
has text: Yes, but it's your job to transfer this knowledge or you end up asking these questions forever on SO.
comment on: http://stackoverflow.com/q/25960031
type: Comment

http://stackoverflow.com/a/25912280
upvote count: 1
type: Answer
downvote count: 0
has body: I suspect that you are still effectively scanning the whole [InvoicesLignes] table for each iteration of the outer [Invoices] loop. Your approach ... Table invoices = db_opened.getTable("Invoices"); Table invoices_lignes = db_opened.getTable("InvoicesLignes"); Cursor cursor = CursorBuilder.createCursor(invoices_lignes.getIndex("Code")); for (Row row : invoices) { long start = System.currentTimeMillis( ); System.out.println(String.format("Invoice : '%s'", start)); for (Row crow : cursor.newIterable().addMatchPattern("Code", row.get("Code"))) { System.out.println(String.format("Loop : '%s'", System.currentTimeMillis( ))); } long end = System.currentTimeMillis( ); System.out.println(String.format("End loop : '%s'", System.currentTimeMillis( ))); long diff = end - start; System.out.println(String.format("Loop elapsed time : '%s' ms", diff )); } ... produces: Invoice : '1411041092492' Loop : '1411041092527' Loop : '1411041092528' Loop : '1411041092529' End loop : '1411041094440' Loop elapsed time : '1948' ms Invoice : '1411041094442' Loop : '1411041094443' Loop : '1411041094444' End loop : '1411041095882' Loop elapsed time : '1440' ms However, this variation ... Table invoices = db_opened.getTable("Invoices"); Table invoices_lignes = db_opened.getTable("InvoicesLignes"); for (Row row : invoices) { long start = System.currentTimeMillis( ); System.out.println(String.format("Invoice : '%s'", start)); IndexCursor cursor = new CursorBuilder(invoices_lignes) .setIndexByName("Code") .setSpecificEntry(row.get("Code")) .toIndexCursor(); for (Row crow : cursor) { System.out.println(String.format("Loop : '%s'", System.currentTimeMillis( ))); } long end = System.currentTimeMillis( ); System.out.println(String.format("End loop : '%s'", System.currentTimeMillis( ))); long diff = end - start; System.out.println(String.format("Loop elapsed time : '%s' ms", diff )); } ... produces: Invoice : '1411041030007' Loop : '1411041030060' Loop : '1411041030062' Loop : '1411041030063' End loop : '…
answers question: http://stackoverflow.com/q/25907985
has comment: http://stackoverflow.com/comment/40561240
accepted answer of: http://stackoverflow.com/q/25907985
score: 1
has comment: http://stackoverflow.com/comment/40601302
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40560899

http://stackoverflow.com/comment/40494072
has text: why my servlet does not work when i use getImage/**C:/imagens/image.jpg**?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25876040

http://stackoverflow.com/q/25882594
has title: java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream>
downvote count: 0
has comment: http://stackoverflow.com/comment/43735677
favorite count: 0
has answer: http://stackoverflow.com/a/35300300
possible better answer: http://stackoverflow.com/a/35300300
has body: I am working on a chat app using xmpp,As per our requirement we have three server Apache Tomcat 7,ejabbered 2.1.11 and mysql 5.5, to run xmppbot on tomcat used below library -Smack-core-4.0.3.jar -smack-tcp-4.0.3.jar -xlightweb2.5.jar -xpp3-1.1.3.3.jar -xSocket-2.4.6.jar Using above library I am able to Connect with ejabberd and able to login with my login id and password but after some time of logging in connection gets close automatically and a am getting below stack trace Sep 16, 2014 4:36:01 PM org.jivesoftware.smack.XMPPConnection callConnectionClosedOnErrorListener WARNING: Connection closed with error java.io.EOFException: no more data available - expected end tag &lt;/stream:stream&gt; to close start tag &lt;stream:stream&gt; from line 1, parser stopped on END_TAG seen ...&lt;/text&gt;&lt;/error&gt;&lt;/iq&gt;... @1:1347 at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2919) at org.xmlpull.mxp1.MXParser.more(MXParser.java:2928) at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1112) at org.xmlpull.mxp1.MXParser.next(MXParser.java:1061) at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:279) at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:47) at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:81) Sep 16, 2014 4:37:15 PM org.jivesoftware.smack.XMPPConnection callConnectionClosedOnErrorListener WARNING: Connection closed with error java.io.EOFException: no more data available - expected end tag &lt;/stream:stream&gt; to close start tag &lt;stream:stream&gt; from line 1, parser stopped on END_TAG seen ...&lt;/text&gt;&lt;/error&gt;&lt;/iq&gt;... @1:1347 at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2919) at org.xmlpull.mxp1.MXParser.more(MXParser.java:2928) at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1112) at org.xmlpull.mxp1.MXParser.next(MXParser.java:1061) at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:279) at org.jivesoftware.smack.tcp.PacketReader.acce…
tagged with: smack
linked to: http://stackoverflow.com/q/18318398
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25884419
tagged with: asmack
tagged with: ejabberd
type: Question
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/41215499
accepted answer: http://stackoverflow.com/a/25884419
answer count: 2
score: 5

http://stackoverflow.com/q/25994293
type: UnansweredQuestion
tagged with: jcr
tagged with: jackrabbit
type: Question
has comment: http://stackoverflow.com/comment/40775939
has comment: http://stackoverflow.com/comment/40754975
has answer: http://stackoverflow.com/a/28315065
has title: Jackrabbit - Unable to retrieve properties of node
score: 0
answer count: 1
has body: I have created folder using superuser and provided read-only access to folder for application user. When trying to query all accessible folders(nt:folder), getting properties list as empty. Partial code to reproduce: Created folder: public Node createFolder(Session adminSession) { try { Node parentNode = adminSession.getNode("/MyCompany/CommonFolder”); if(!parentNode.hasNode("T1")){ Node node = parentNode.addNode("T1", "nt:folder"); node.addMixin("et:folderProperties"); node.setProperty("et:folderName", "T1"); node.addMixin("rep:AccessControllable"); session.save(); return node; }else { System.out.println("Node already exists"); } } catch (RepositoryException e) { e.printStackTrace(); } return null; } Sharing to user(Principal based) accessControlManager = (JackrabbitAccessControlManager) adminSession.getAccessControlManager(); accessControlPolicy = accessControlManager.getApplicablePolicies(userPrincipal); // for ex., principal is appuser1 if(accessControlPolicy != null &amp;&amp; accessControlPolicy.length &gt; 0) { accessControlList = (JackrabbitAccessControlList) accessControlPolicy[0]; }else { accessControlPolicy = accessControlManager.getPolicies(userPrincipal); accessControlList = (JackrabbitAccessControlList) accessControlPolicy[0]; } ValueFactory valueFactory = adminSession.getValueFactory(); //Tried all combinations, even providing with "JCR:ALL"; Privilege[] readPrivilege = new javax.jcr.security.Privilege[] { accessControlManager.privilegeFromName( javax.jcr.security.Privilege.JCR_READ), accessControlManager.privilegeFromName( javax.jcr.security.Privilege.JCR_NODE_TYPE_MANAGEMENT), accessControlManager.privilegeFromName( javax.jcr.security.Privilege.JCR_READ_ACCESS_CONTROL)}; Map&lt;String, Value&gt; restrictions = new HashMap&lt;String, Value&gt;(); restrictions.put("rep:nodePath", valueFactory.createValue("/MyCompany/CommonFolder/T1", PropertyType.PATH)); restrictions.put("rep:glob", valueFactory.createValue("")); accessControlList.addEntry(userPrincip…
tagged with: java

http://stackoverflow.com/a/25973773
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40676118
has body: You can calculate the natural logarithm using the Java.lang.Math.log() method: System.out.println("Math.log(1/3.0)=" + Math.log(1/3.0)); See http://www.tutorialspoint.com/java/lang/math_log.htm and http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#log%28double%29 In order to get the log_10 you can do it as follows: System.out.println("log_10(1/3.0)=" + (Math.log(1/3.0)/Math.log(10)));
downvote count: 0
answers question: http://stackoverflow.com/q/25973731
has comment: http://stackoverflow.com/comment/40673972
has comment: http://stackoverflow.com/comment/40670956
score: 1

http://stackoverflow.com/q/26010013
has comment: http://stackoverflow.com/comment/40735979
tagged with: regex
type: AnsweredQuestion
has title: Regex for find Replace
has body: In context of this question I want to do the following changes: Find: funcA(param0,param1,param2,param3); Replace: if(isTrue) funcB(param0,funcC(param1,param2,param3)); funcA can have any number of parameters besides param0.How can it be done?For simplicity ignore the base case i.e when param pass to funcA is only param0. funcA is: public void funcA(String param0,Object... params) funcC is: public void funcB(Object... params). EDIT: The parameters(param1,param2..) are just string containing alphabets.
tagged with: sublimetext2
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40736159
type: Question
has answer: http://stackoverflow.com/a/26010520
answer count: 1
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/11819886
favorite count: 0
accepted answer: http://stackoverflow.com/a/26010520

http://stackoverflow.com/a/26040345
has body: You can use the GridBagLayout. It supports a "fill" constraint that allows you to fill the component in a grid. Read the section from the Swing tutorial on How to Use GridLayout for more information on the contraints you can use. Or if you want to go outside the box you can use the Relative Layout. It can work like the BoxLayout. It can display the components vertically at the preferred height, but it has a parameter to fill the width automatically. It is not part of the JDK but you don't have to worry about building constraints.
answers question: http://stackoverflow.com/q/26033789
upvote count: 3
type: Answer
downvote count: 0
score: 3

http://stackoverflow.com/comment/40618147
comment on: http://stackoverflow.com/q/25944310
score: 0
has text: Sorry it's so long. I am super new to programming in general and my question is, the directions ask to make two overloading deposit methods in Account class and I am not sure I did it correctly. Not really sure what it means exactly. Every time I reread the book/slides I get confused.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40576328
has text: Compiler in your example checks that type your parameter is type b or class extends b, will be compile error if type parameter don't satisfies this condition. BUT IT IS NOT OVERLOADING, because methods located in DIFFERENT CLASSES: http://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
type: Comment
comment on: http://stackoverflow.com/a/25899604
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40701923
has text: i used "PrintWriter" and "File" as parameter, f.getAbsolutePath() shows "/Plot.txt". but i need full path like this: "sdcard/my app/plot.txt"
type: Comment
comment on: http://stackoverflow.com/a/25990355
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40600317
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25934666
has text: @dasblinkenlight: That doesn't really give an encoding name though. "Extended ASCII" is a horrible name for an ill-defined *collection* of encodings.

http://stackoverflow.com/comment/40673039
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25975537
has text: Why is the radius 1000?
type: Comment

http://stackoverflow.com/q/26015499
has comment: http://stackoverflow.com/comment/40746585
has comment: http://stackoverflow.com/comment/40777948
answer count: 1
tagged with: nlp
favorite count: 0
has body: I have a List containing some inextricably words, like List&lt;String&gt; lookUp = new ArrayList&lt;&gt;(); lookUp.add("New York"); lookUp.add("Big Apple"); For a sentence I want to split it into words, but don't split the inextricably words given in my list. So an example String sentence = "New York is also called Big Apple"; it should return me ["New York", "is", "also", "called", "Big Apple"] I started to write an algorithm which first splits the sentence by whitespaces and then I do a loop: For every word I check if this word and it's right neighbour occure in the lookUp-list and, if true, parse these words together. 1) Imagine my lookUp-list also contains inextricably phrases with more than two words, like "George W. Bush" -> my algorithm would only lookup "George W." and "W. Bush" and won't find it in the lookup-list, so it would split it into 3 words. 2) The more important question (for which you can ignore question 1): Is there already a library or even a GATE plugin (so that I don't have to reinvent the wheel)? And does this also exist for german phrases? I couldn't find one =(
has comment: http://stackoverflow.com/comment/40745475
has comment: http://stackoverflow.com/comment/40745636
has comment: http://stackoverflow.com/comment/40763113
has comment: http://stackoverflow.com/comment/40745598
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40746222
tagged with: java
tagged with: gate
has comment: http://stackoverflow.com/comment/40771236
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40745668
has title: split text with inextricably phrases
has answer: http://stackoverflow.com/a/26015954
accepted answer: http://stackoverflow.com/a/26015954

http://stackoverflow.com/a/25889985
upvote count: 3
answers question: http://stackoverflow.com/q/25889744
type: Answer
score: 3
downvote count: 0
has body: Assert is really useful to perform that should always be true inside an library or a module. It is intented to verify invariants ( control flow, internal, etc.) in your code, and it is a bad idea to use it to enforce correct use of your code (you have exceptions for that). As a consequence, your public interface should never be based on assert : when you have a public method and you want to check input parameter, it is generally better to throw an IllegalArgumentException. Here are some good documentation about asserts. In your example, I think you should use exceptions instead of asserts. It's not a bad idea to perform some validity checks on data coming from a database (even if it has been validated on input) but assertion might be disabled in production code and you have to think on how you should handle such malformed content.

http://stackoverflow.com/q/25924459
has answer: http://stackoverflow.com/a/25924559
tagged with: android-intent
tagged with: java
tagged with: global-variables
has answer: http://stackoverflow.com/a/25924946
type: Question
has body: How do I make global string variable on android-java, and how to access it on diffrent activity?
score: 0
has title: How to make Android java global string variable?
answer count: 3
tagged with: android-activity
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/42759633

http://stackoverflow.com/a/25890170
has body: 0x99 is 99 in hex, which in decimal can be represented as a negative number, but is still 0x99 in hex and have the same binary representation. So, sending it on a socket, wether you write it as 0x99 (hex), C unsigned byte 153 (decimal) or java signed byte -103 (decimal), it will still send the bits 10011001. If you instead are sending it in decimal, that is you are not sending a single byte as binary on the socket, but the ascii representation of it like '-','1','0','3', then it's easier if in java you use int, int i = 0x99 will be 153 decimal, so converted to a string will be '1','5','3' and not a negative decimal representation.
accepted answer of: http://stackoverflow.com/q/25890122
upvote count: 3
answers question: http://stackoverflow.com/q/25890122
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/a/25887744
type: Answer
has comment: http://stackoverflow.com/comment/40515472
downvote count: 0
score: 1
has body: Snap code 1 correctly writes any secret key to a file as a hex-encoded string. It is always reversible. Snap code 2 is not good at all. It relies on the bytes backing the key being a valid sequence of bytes in the platform's default charset. If it's not, the behaviour is undefined. i.e. the string that is returned may not be reversible back to the original byte sequence.
has comment: http://stackoverflow.com/comment/40515622
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25887219
has comment: http://stackoverflow.com/comment/40515984
answers question: http://stackoverflow.com/q/25887219

http://stackoverflow.com/comment/40702407
comment on: http://stackoverflow.com/q/25991543
type: Comment
type: QuestionComment
score: 2
has text: Perfomance-wise, this is clearly a non-issue. Furthermore, refactoring means you give less freedom to the methods: that may be good (constraining the possible kinds of stuff they do) or bad (making certain internal changes to the methods impossible without changing their signatures).

http://stackoverflow.com/q/25981158
has title: Spring component annotation compile time scan
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/50594869
accepted answer: http://stackoverflow.com/a/50594869
downvote count: 0
has comment: http://stackoverflow.com/comment/40683523
tagged with: java
has comment: http://stackoverflow.com/comment/40683834
tagged with: startup
type: Question
has comment: http://stackoverflow.com/comment/52499111
answer count: 2
has body: My belief is that the Spring bootstraps ContextLoaderListener DispatcherServlet due to the instruction &lt;context:component-scan base-package=" ..... " /&gt; would perform component scans at app startup (or whenever instructed to) during run-time. Is there a way to instruct the compiler (perhaps thro a maven build plugin) to perform a one time static scan of annotated spring components during build/compile time, so that the bootstrap component scan is not performed, WITHOUT abandoning the use of component annotation? As a way to reduce startup load and latency.
score: 12
has answer: http://stackoverflow.com/a/50468971
favorite count: 0
has comment: http://stackoverflow.com/comment/40686699
upvote count: 12
possible better answer: http://stackoverflow.com/a/50468971

http://stackoverflow.com/q/26033962
downvote count: 0
favorite count: 0
has title: Generate a random two-dimensional array of non-repeating numbers, Java
possible better answer: http://stackoverflow.com/a/26034022
tagged with: multidimensional-array
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26034099
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26034069
upvote count: 1
type: Question
tagged with: arrays
tagged with: random
answer count: 3
has body: The user will type in the number for i (variant), then the number for j (elements for every variant), and finally the maximum value possible (maxElem). Using the inputed values, the task is to generate nonrepeating random numbers (nonrepeating in a variant, meaning for i, but the numbers may repeat during the entire array). For example, a successful output giving the input 3 (i), 5 (j), 9 (maxElem), would be: 4|8|1|7|9 3|8|2|4|5 2|6|4|8|5 As you may notice, the number 4 repeats itself during the entire array for 3 times (allowable). But, for i=0, number 4 is unique. Please, guide me what would be the changes to this code: static Scanner sc = new Scanner(System.in); static int maxElem; public static void main(String[] args) { int[][] greatLoto; System.out.println("Of how many variants will the ticket consist? "); int variants = sc.nextInt(); System.out.println("Of how many elements will the variants consist? "); int elements = sc.nextInt(); System.out.println("Which value should be considered the maximum value? "); maxElem = sc.nextInt() + 1; greatLoto = new int[variants][elements]; System.out.println("Initial values: "); show(greatLoto); System.out.println("Modifying values..."); modified(greatLoto); System.out.println("Newest values: "); show(greatLoto); } private static void show(int[][] greatLoto) { for (int i = 0; i &lt; greatLoto.length; i++) { for (int j = 0; j &lt; greatLoto[i].length; j++) { System.out.print("|" + greatLoto[i][j] + "|"); } System.out.println(""); } System.out.println(""); } private static void modified(int[][] greatLoto) { Random r = new Random(System.currentTimeMillis()); for (int i = 0; i &lt; greatLoto.length; i++) { for (int j = 0; j &lt; greatLoto[i].length; j++) { while (Arrays.asList(greatLoto[i]).contains(r)) { r = new Random(System.currentTimeMillis()); } greatLoto[i][j] = r.nextInt(maxElem);; } System.out.println(""); } }
accepted answer: http://stackoverflow.com/a/26034069
has answer: http://stackoverflow.com/a/26034022

http://stackoverflow.com/q/26002274
has title: CQ/AEM last 10 modified users list for a page
has answer: http://stackoverflow.com/a/26013492
tagged with: aem
has answer: http://stackoverflow.com/a/26098350
has answer: http://stackoverflow.com/a/26013231
accepted answer: http://stackoverflow.com/a/26013231
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26013492
score: 0
answer count: 3
has body: I see cq:lastModified in the page property which gives me the User who modified the page at the latest. Is there any way to get the list of latest 10 users who modified the page ? Does AEM stores that kind of information at all? Thanks!

http://stackoverflow.com/q/25958116
has title: Oracle invalid identifier doesnt understand string
upvote count: 1
answer count: 1
has body: I'm having an issue with my query not working. This is the command variable. When it executes it should be retrieving the tuples that have BSc as their degree. I have tested this in oracle directly and the query returns these. It is identical to the command statement. When I print out command, the line looks exactly the same as my command that worked in oracle. SELECT distinct fname, lname, student_id FROM student where degree='BA'; Yet, it should be printing out to the screen. The tables are loaded into oracle already. I've been racking my brain with this issue but can't seem to find a fix! The error I keep getting is: ORA-00911: invalid character What I do is I store in degree the result from scanner which is a string. So concatenating it in the command variable shouldn't make an issue -- the query looks identical to what works in oracle. Could it be because it wants a char instead of a string? If it does, then how would I get it to make "BSc" as a char? Concatenating chars sounds dumb. Relevant code below: private String getDegree() { Scanner scan = new Scanner(System.in); System.out.println("Please enter degree code (either BA or BSc)"); return scan.next(); } //get the degree name String degree = getDegree(); //get statement and execute appropriate select Statement stmt = con.createStatement(); String command = "SELECT distinct fname, lname, student_id FROM student"+ " where degree='"+ degree + "';"; System.out.println(command); ResultSet result = stmt.executeQuery(command); //determine number of columns ResultSetMetaData metadata = result.getMetaData(); int columns = metadata.getColumnCount(); //print heading System.out.println("\nFNAME LNAME STUD_ID"); System.out.println("===================================="); //loop through result and print columns while (result.next()){ for (int i=1; i &lt;=columns; i++){ System.out.print(result.getString(i)+spaces(15-result.getString(i).length())); } System.out.println(); } `
favorite count: 0
tagged with: tuples
tagged with: oracle-database
tagged with: sql
has comment: http://stackoverflow.com/comment/40641043
has answer: http://stackoverflow.com/a/25958151
accepted answer: http://stackoverflow.com/a/25958151
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: database
type: Question

http://stackoverflow.com/q/26001077
has title: Java code not working in OSX Mavericks
type: UnansweredQuestion
tagged with: java
has body: I'm trying to run a java library, so that I can build upon it and do my customization. The library is called jayu parses ASN files so that you can decode them. It can be downloaded here There are a few test data to check the library in the "test" folder and mentioned in the Readme.txt file. There is a asn2csv batch file for windows but I'm using OSX mavericks. According to the Readme file, I need to run it by invoking the command: ls $ASN_DATA_DIR/*.dat | xargs java -cp "./*.jar:." Path/To/Stream1.txt test.testdata.Stream1 $OUTPUT_DIR OR java -cp "*.jar;$PATH_TO_TEST_DIR" Stream1.txt test.testdata.Stream1 . Path/To/Stream1.dat But whatever I try I always get Error: Could not find or load main class Stream1.txt I'm not a Java programmer. What am I doing wrong here? The development of this seems to be inactive lately but it's still useful. So, I'm posting it here, hoping someone will help me run the example. Edit: I've added the tree structure of the directory and the files + jayu |--Readme.txt |--commons-compiler.jar |--janino.jar |--jayu.jar (ASN parser) |--AsnToCsv.bat (Command line Tool) +--test (Contains test data for examples) | + testdata | Stream1.txt (Grammar File) Stream1.dat (ASN Data File) Stream1.java {mapFile} ...
tagged with: asn.1
type: Question
tagged with: decode
has comment: http://stackoverflow.com/comment/40719811
has comment: http://stackoverflow.com/comment/40719910
has answer: http://stackoverflow.com/a/26001308
score: 0
answer count: 1
tagged with: macos
has comment: http://stackoverflow.com/comment/40756259

http://stackoverflow.com/comment/40753168
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26019132
has text: I notice you've accepted one of the string splitting answers as your preferred answer. Do check the duplicate I've suggested, since you should be using `File` for this.

http://stackoverflow.com/q/25908905
answer count: 1
has body: I'am trying to send email with a 'secret key' and the user is supposed to enter the key in text field to change the password(I am making a rdbms system in java) . But I'am stuck here: Firstly I've passed a string and an integer from ForgotPassword.java to ConfirmPassword.java close(); ConfirmPassword cf = new ConfirmPassword(_number,uname); cf.setVisible(true); then the constructor in ConfirmPassword goes like : public ConfirmPassword(int _number , String uname) { initComponents(); this._uname=uname; this.number=_number; } but this code doesn't compile and gives me error in main 'unexpected type required: value found:class' Main: public static void main(String args[]){ //Some look and feel code here java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ConfirmPassword(int,String).setVisible(true); } }); Basically what im trying to do is import data from Forgotpass JFrame to ConfirmPass Jframe any help is appreciated cheers! :)
tagged with: inheritance
has comment: http://stackoverflow.com/comment/40554753
linked to: http://stackoverflow.com/q/9554636
type: AnsweredQuestion
score: 2
downvote count: 0
has title: error on importing data from one jframe to other
favorite count: 0
has answer: http://stackoverflow.com/a/25909028
type: Question
tagged with: jframe
tagged with: netbeans
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40553517
accepted answer: http://stackoverflow.com/a/25909028
tagged with: swing

http://stackoverflow.com/q/26011652
favorite count: 0
has comment: http://stackoverflow.com/comment/40739111
has comment: http://stackoverflow.com/comment/40738961
possible better answer: http://stackoverflow.com/a/26011853
has answer: http://stackoverflow.com/a/26012703
has answer: http://stackoverflow.com/a/26011853
answer count: 4
accepted answer: http://stackoverflow.com/a/26011946
tagged with: geometry
has answer: http://stackoverflow.com/a/26011901
upvote count: 1
has comment: http://stackoverflow.com/comment/40738980
downvote count: 1
has body: I have some problem printing a reverse triangle I want to achieve, like this pattern: ****** *** * But my goal is to achieve that pattern with this numbers: 333221 221 1 So, this is my code so far: int x = 1; for(int r=0;r&lt;3;r++) { x=x+r; for(int c=0;c&lt;x;c++) { System.out.print("*"); } x+=1; System.out.println(); } Which the output is upright like this: * *** ****** I want to make the pattern reverse with the numbers as it shown above. Can anyone give me some idea how to deal with it? Thanks!
has comment: http://stackoverflow.com/comment/40738839
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11409621
tagged with: java
has comment: http://stackoverflow.com/comment/40739055
has title: Printing Reverse Triangle with Numbers - Java
has comment: http://stackoverflow.com/comment/40739290
type: Question
score: 0
tagged with: for-loop
has answer: http://stackoverflow.com/a/26011946
has comment: http://stackoverflow.com/comment/40739264

http://stackoverflow.com/comment/40696729
comment on: http://stackoverflow.com/a/25987593
type: AnswerComment
score: 0
type: Comment
has text: Thanks, it is working, but 'always' and 'just once' buttons are missing, may I know why?

http://stackoverflow.com/comment/40598425
has text: That is very unusual. Nearly everything can be done from a jar. But if you want a folder you need to use a [Feature Project](http://www.vogella.com/tutorials/EclipseFeatureProject/article.html), you can specify that the plugin is expanded during install in the feature.
type: Comment
comment on: http://stackoverflow.com/q/25932210
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40650799
comment on: http://stackoverflow.com/a/25963194
has text: How to use absolute path to the file?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40780024
type: Comment
type: QuestionComment
score: 1
has text: Read up on reflection. http://docs.oracle.com/javase/tutorial/reflect/
comment on: http://stackoverflow.com/q/26034097

http://stackoverflow.com/comment/40707142
type: QuestionComment
comment on: http://stackoverflow.com/q/25991726
score: 0
has text: Sorry .. dont know how it got inserted there @ThomasJungblut
type: Comment

http://stackoverflow.com/comment/59649613
type: AnswerComment
has text: where should i put the sample.db file? in my project root?
type: Comment
comment on: http://stackoverflow.com/a/25956918
score: 3

http://stackoverflow.com/comment/40595977
comment on: http://stackoverflow.com/a/25930286
type: AnswerComment
type: Comment
score: 0
has text: @MSach, updated my answer with more details, please check if that helps.

http://stackoverflow.com/comment/51284926
has text: @PedroD in case of music app, its not the notification thats being clicked, its the remote views. Question was for the whole notification
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26091547
type: AnswerComment

http://stackoverflow.com/a/26034662
has comment: http://stackoverflow.com/comment/40791546
upvote count: 39
has comment: http://stackoverflow.com/comment/40785668
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/80004455
answers question: http://stackoverflow.com/q/26028341
has comment: http://stackoverflow.com/comment/58693812
score: 38
accepted answer of: http://stackoverflow.com/q/26028341
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40788771
has comment: http://stackoverflow.com/comment/40787778
has body: Before applying @Lookup annotation to your public MyClass2 myClass2() method, read this in @Lookup's Javadoc: the container will generate runtime subclasses of the method's containing class via CGLIB, which is why such lookup methods can only work on beans that the container instantiates through regular constructors (i.e. lookup methods cannot get replaced on beans returned from factory methods where we can't dynamically provide a subclass for them). So remove the following factory method style bean declaration from ApplicationConfiguration: @Bean public MyClass1 myClass1() { return new ContentHolderTabPaneController(); } and add @Component annotation to let Spring instantiate the bean (also add the @Lookup annotation to the method): @Component public class MyClass1 { doSomething() { myClass2(); } //I want this method to return MyClass2 prototype @Lookup public MyClass2 myClass2(){ return null; // This implementation will be overridden by dynamically generated subclass } } Now get myClass1 bean out of context, and its myClass2 method should have been replaced/overridden to get a new prototype bean each time. Update: Using factory method declaration It's not hard to implement the @Lookup annotated method (the "lookup method"). Without @Lookup and keeping your configuration class unchanged, now MyClass1 looks like (in fact Spring generates a similar implementation in a subclass if @Lookup were used): public class MyClass1 { doSomething() { myClass2(); } //I want this method to return MyClass2 prototype @Autowired private ApplicationContext applicationContext; public MyClass2 myClass2() { return applicationContext.getBean(MyClass2.class); } } Spring injects the ApplicationContext for you.
has comment: http://stackoverflow.com/comment/46199564

http://stackoverflow.com/q/25955749
has comment: http://stackoverflow.com/comment/40636816
tagged with: java
has comment: http://stackoverflow.com/comment/40636798
has comment: http://stackoverflow.com/comment/40636810
score: 2
has title: What is a Key-Value Pair?
downvote count: 5
has answer: http://stackoverflow.com/a/25956329
has comment: http://stackoverflow.com/comment/40636982
tagged with: key-value
has comment: http://stackoverflow.com/comment/40636996
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25956329
favorite count: 0
possible better answer: http://stackoverflow.com/a/25955841
answer count: 2
has answer: http://stackoverflow.com/a/25955841
upvote count: 7
has body: I am teaching myself Java so I can program android applications and came across the need to use a key value pair, but don't know what it is. What I am confused about is how this is different from a normal variable. Say a variable of type String points to an object or int variable points to int value. Isn't that variable a "key", and the object a "value?

http://stackoverflow.com/comment/40664862
comment on: http://stackoverflow.com/q/25970797
type: Comment
type: QuestionComment
score: 2
has text: You will need to enable the query cache and make the query cacheable. Without it the cache will not be used (unless queried by id).

http://stackoverflow.com/comment/62830563
comment on: http://stackoverflow.com/a/37676730
score: 1
has text: So for a give string the above program displays all possible IPV4 addresses that can be formed, eg. Sample Input: 2252555 Sample Output: 2.25.25.55 2.25.255.5 2.252.55.5 225.25.5.5 22.52.55.5 225.2.55.5 No. of possible IPAddress: 6
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25990293
tagged with: java
linked to: http://stackoverflow.com/q/5605313
type: Question
accepted answer: http://stackoverflow.com/a/25990355
has title: Android: how can i find file path
score: 0
tagged with: r.java-file
answer count: 1
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40701011
has answer: http://stackoverflow.com/a/25990355
has body: i'm using a source code like this: PrintWriter fout = new PrintWriter(new FileWriter("plot.txt")); fout.println("#\tX\tY"); i want to find path of "plot.txt", any help? best regards.

http://stackoverflow.com/q/26023748
favorite count: 0
has comment: http://stackoverflow.com/comment/40761422
has comment: http://stackoverflow.com/comment/40761680
has title: LinkedHashMap - contains method
has comment: http://stackoverflow.com/comment/40761846
upvote count: 1
possible better answer: http://stackoverflow.com/a/26024165
has comment: http://stackoverflow.com/comment/40761187
accepted answer: http://stackoverflow.com/a/26024381
downvote count: 1
tagged with: linkedhashmap
type: AnsweredQuestion
has body: I need to read a flag to validate if I'll send or not an email, this flag is on a LinkedHashMap, so I'm trying to go over it looking for an ID, then I'll have to ask if is true or false, and I'm trying this: while(iterator.hasNext()){ LinkedHashMap&lt;String, Object&gt; fileMap = (LinkedHashMap&lt;String, Object&gt;) iterator.next(); userid = (Long)fileMap.get("USERID"); file.findAllFiles(userid); if(file.findAllFiles(userid).contains(haveFiles = true)){ //send email }else{ //do something } } Is it correct?
has comment: http://stackoverflow.com/comment/40761402
has comment: http://stackoverflow.com/comment/40761145
tagged with: java
type: Question
answer count: 2
tagged with: contains
has answer: http://stackoverflow.com/a/26024381
score: 0
has comment: http://stackoverflow.com/comment/40761440
has answer: http://stackoverflow.com/a/26024165

http://stackoverflow.com/a/25922947
upvote count: 1
downvote count: 0
type: Answer
has body: Check it if you have the correct Java version, bigger than the 7 update 51 (7u51)
score: 1
answers question: http://stackoverflow.com/q/25922851

http://stackoverflow.com/comment/40544766
has text: Yes, the method must return an array of strings.
comment on: http://stackoverflow.com/a/25904002
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/40629693
type: AnswerComment
has text: @RCola, I have edited my answer to facilitate your question, please have a look.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25951718

http://stackoverflow.com/comment/40689210
type: Comment
has text: There could be a lot of reason my friend why he needs to server roundtrip. In the first place he used **java** that goes to say he really needs to call serverlets in the first place
type: AnswerComment
comment on: http://stackoverflow.com/a/25983911
score: 0

http://stackoverflow.com/comment/40705284
score: 5
comment on: http://stackoverflow.com/q/25993225
has text: http://bugs.java.com/view_bug.do
type: Comment
type: QuestionComment

web-services
tags question: http://stackoverflow.com/q/25972883
type: Tag
tags question: http://stackoverflow.com/q/25978650
tags question: http://stackoverflow.com/q/26014448
tags question: http://stackoverflow.com/q/25950475
tags question: http://stackoverflow.com/q/25875187
tags question: http://stackoverflow.com/q/25938090
tags question: http://stackoverflow.com/q/25996587
tags question: http://stackoverflow.com/q/25884172
tags question: http://stackoverflow.com/q/25987762
tags question: http://stackoverflow.com/q/25925917
tags question: http://stackoverflow.com/q/26032158
tags question: http://stackoverflow.com/q/25898168
tags question: http://stackoverflow.com/q/25895074
tags question: http://stackoverflow.com/q/25904827
tags question: http://stackoverflow.com/q/25907145
tags question: http://stackoverflow.com/q/25885742
tags question: http://stackoverflow.com/q/25990696
tags question: http://stackoverflow.com/q/25963795
tags question: http://stackoverflow.com/q/25888387
tags question: http://stackoverflow.com/q/25884398
tags question: http://stackoverflow.com/q/25938189
tags question: http://stackoverflow.com/q/25972681
tags question: http://stackoverflow.com/q/25933988
tags question: http://stackoverflow.com/q/25969460
tags question: http://stackoverflow.com/q/26003785
tags question: http://stackoverflow.com/q/25918306
tags question: http://stackoverflow.com/q/25948980
tags question: http://stackoverflow.com/q/25968987
tags question: http://stackoverflow.com/q/25901983
tags question: http://stackoverflow.com/q/25969783
tags question: http://stackoverflow.com/q/25971898
tags question: http://stackoverflow.com/q/26000342
tags question: http://stackoverflow.com/q/25986962
tags question: http://stackoverflow.com/q/25948732
tags question: http://stackoverflow.com/q/25998423
tags question: http://stackoverflow.com/q/26018885
tags question: http://stackoverflow.com/q/26016916
tags question: http://stackoverflow.com/q/26021178
tags question: http://stackoverflow.com/q/25876177
tags question: http://stackoverflow.com/q/25903245
tags question: http://stackoverflow.com/q/26031400
tags question: http://stackoverflow.com/q/25974926
tags question: http://stackoverflow.com/q/26025927
tags question: http://stackoverflow.com/q/25975679
tags question: http://stackoverflow.com/q/25905554
tags question: http://stackoverflow.com/q/25939065
tag name: web-services
tags question: http://stackoverflow.com/q/25916825
tags question: http://stackoverflow.com/q/26020306
tags question: http://stackoverflow.com/q/25875138
tags question: http://stackoverflow.com/q/26012467
tags question: http://stackoverflow.com/q/25994288
tags question: http://stackoverflow.com/q/26019938
tags question: http://stackoverflow.com/q/25980487
tags question: http://stackoverflow.com/q/25920799
tags question: http://stackoverflow.com/q/25976391
tags question: http://stackoverflow.com/q/25937667
tags question: http://stackoverflow.com/q/25880119
tags question: http://stackoverflow.com/q/25879898
tags question: http://stackoverflow.com/q/26004264
tags question: http://stackoverflow.com/q/25884711
tags question: http://stackoverflow.com/q/25948702

http://stackoverflow.com/q/25876192
has title: Android popup menu widget over each screen like Edge Quick Action
type: Question
tagged with: android-appwidget
tagged with: android
has body: I´d like to make an Android utility application. It should be able to show the transparent popupmenu with some buttons over the homescreen or over some running application (except in fullscreen mode). I want it to look like that https://play.google.com/store/apps/details?id=com.reactivstudios.android.edge.free Any suggestions how to do it, please? Is it a popupwindow (I think that the popupwindow can be showed only over its parent app)? Is it an activity with transparent background? Is it any type of widget with transparent layout? Or is it a hacked toast? Or is it something else? Thanks.
accepted answer: http://stackoverflow.com/a/25876596
tagged with: android-popupwindow
linked to: http://stackoverflow.com/q/15975988
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25876596
tagged with: android-layout
type: AnsweredQuestion

http://stackoverflow.com/a/25885993
downvote count: 0
has comment: http://stackoverflow.com/comment/40596025
accepted answer of: http://stackoverflow.com/q/25885992
has comment: http://stackoverflow.com/comment/122537357
answers question: http://stackoverflow.com/q/25885992
score: 5
type: AcceptedAnswer
has body: The Derby dialect in Hibernate generates column definition with limited legth: message clob(255) You may want to override this behaviour and set your own length or leave default length. You may use @Column(columnDefinition="clob") @Lob String message; Remember that in derby A CLOB without a specified length is defaulted to two gigabytes (2,147,483,647)
type: Answer
upvote count: 5

http://stackoverflow.com/comment/102928668
has text: Java8 date api sucks. I am still using Joda with no problems.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/32331012

http://stackoverflow.com/comment/40661365
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25969010
has text: "colFinished has to be reset to false in each run of the outer loop" - Why? There is no apparent reason for that.

http://stackoverflow.com/comment/40567068
has text: thanks Robert.. Can you write the same code using Scanner to read the input.
comment on: http://stackoverflow.com/a/25916287
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40718470
type: Comment
type: QuestionComment
has text: I added code about my frustration
comment on: http://stackoverflow.com/q/26000030
score: 0

http://stackoverflow.com/a/26021836
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26021372
has comment: http://stackoverflow.com/comment/40757729
has comment: http://stackoverflow.com/comment/40757806
has comment: http://stackoverflow.com/comment/40781077
has comment: http://stackoverflow.com/comment/40780116
has body: you can pass jObject in jni method and handle it into the c/c++ code.

http://stackoverflow.com/comment/40691362
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25960057
score: 0
has text: Can you give more details about your development environment? How are you building the project into a jar? Are you including the AWS core jar when building? My first guess is that the AWS SDK is not being built into the new jar you are making. I don't know anything about SmartFox but it sounds like you could either build the jar into your new jar, or just use SmartFox with the AWS jar as well

http://stackoverflow.com/a/25996071
downvote count: 1
has comment: http://stackoverflow.com/comment/40710246
has comment: http://stackoverflow.com/comment/40711915
score: -1
has comment: http://stackoverflow.com/comment/40710837
has comment: http://stackoverflow.com/comment/40710164
has body: If you are using windows you should be using \ not /. Also you can give absolute path ex. C:\folder\folder\data.in or you can just put the file in classpath and do File("data.in") or relative to class path File("\folder\data.in"). Don't forget to escape \ by 2 \. Try putting the file in the root of your project folder and just do new File("data.in"). Copy and paste file to root folder in eclipse (project folder) Change Scanner scanner = new Scanner(new File("/project_folder_name/data.in")); To Scanner scanner = new Scanner(new File("data.in"));
upvote count: 0
has comment: http://stackoverflow.com/comment/40710495
has comment: http://stackoverflow.com/comment/40710451
has comment: http://stackoverflow.com/comment/40710618
has comment: http://stackoverflow.com/comment/40710521
has comment: http://stackoverflow.com/comment/40710309
answers question: http://stackoverflow.com/q/25995969
type: Answer
has comment: http://stackoverflow.com/comment/40711324
has comment: http://stackoverflow.com/comment/40711202

http://stackoverflow.com/comment/40520317
score: 0
type: Comment
type: QuestionComment
has text: Identifier is the only single-property class. However, Identifiers are in classes that have potentially dozens of properties. I wish I could get rid of Identifier, since it could just as easily be replaced by a string, but Identifier is part of the API I'm sending data to.
comment on: http://stackoverflow.com/q/25877741

http://stackoverflow.com/comment/40744911
type: Comment
comment on: http://stackoverflow.com/a/26014903
score: 0
type: AnswerComment
has text: If you open that link you will find it says `Class TreeMultimap<K,V>` The key and value are generics. It can be double,long etc.

http://stackoverflow.com/comment/40580973
type: QuestionComment
comment on: http://stackoverflow.com/q/25923648
has text: Use [joda](http://www.joda.org/joda-time/)!
score: 0
type: Comment

http://stackoverflow.com/comment/47749734
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25876750
has text: @Trejkaz: How often is floating-point computation speed significant for simple but data-heavy calculations (versus the time to get data to/from the CPU)? A few years ago, reading many floats and accumulating as double would be likely faster than adding floats using floats for temporary results in any fashion that would yield decent precision (adding 65,535 values of type `float` directly may yield a result with less than a dozen significant bits; the job may be done using 65,535 floating-point additions while yielding better accuracy, but it's a bit trickier).
score: 0

http://stackoverflow.com/q/25920318
tagged with: big-o
has comment: http://stackoverflow.com/comment/40576189
tagged with: linked-list
has answer: http://stackoverflow.com/a/25920427
has comment: http://stackoverflow.com/comment/40575438
upvote count: 1
accepted answer: http://stackoverflow.com/a/25920427
type: AnsweredQuestion
tagged with: algorithm
has comment: http://stackoverflow.com/comment/40574926
tagged with: java
has title: Is this a situation where a constant is necessary in O(N) notation?
has body: In this link , the author says that get(index) is O(1) in Java ArrayList while it is O(n/2) in LinkedList, as it needs to traverse till that entry. The get operation in ArrayList taking constant time makes sense as ArrayList has access to all the indexes. However, I didn't understand O(n/2) for LinkedList. The way I was taught was that, when you use big oh notation, you should write it without the constant to make it easier to explain to someone else; that is, O(n) rather than O(2n). Isn't O(n) also a bound for the worst case running time? That way it makes more sense to me to use O(n) because the element you are searching for could be at the very end. Does anyone know why the author included the n/2?
type: Question
downvote count: 0
answer count: 1
score: 1
has comment: http://stackoverflow.com/comment/40575022
favorite count: 0
tagged with: arraylist

http://stackoverflow.com/q/25945185
tagged with: thread-safety
has body: I'm currently using the default ThreadFactory and I'm not satisfied with it's performance and queueing of tasks. As I searched about ThreadFactory, I want to consider it's implementation. My question is that does ThreadFactory automatically shutdown it's Threads under in it?
answer count: 1
score: 0
has title: Java: How does ThreadFactory handles Threads?
has answer: http://stackoverflow.com/a/25945197
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/25945197
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/25912456
answers question: http://stackoverflow.com/q/25911898
score: 0
has body: The firstNameTag variable in your code example is internal to the example implementation; it's not part of the SAXParser API. Basic usage of a SAXParser will always have some code that executes in startElement and manipulates internal state in order to react to the fact that a certain tag has just been opened. The nature of that internal state is entirely up to you.
type: Answer

http://stackoverflow.com/q/25963919
downvote count: 0
has answer: http://stackoverflow.com/a/26004644
tagged with: java
type: Question
has title: Spring Boot - Externalized properties
has comment: http://stackoverflow.com/comment/40654122
answer count: 2
has comment: http://stackoverflow.com/comment/40658579
has body: I've got a Spring Boot project that builds an executable war and is configured with an application.properties file and a application-dev.properties in src/main/resources. The first line in the application.properties is spring.profiles.active=dev, which triggers the inclusion of application-dev.properties when running as expected. My problem is that I can't seem to override these properties with an external properties source (after everything is jarred / warred up). For simple debugging, I've created a file settings.properties in the root of my project, and specified spring.profiles.active=dev,deploy in it hoping to also trigger the "deploy" profile. However, when I run the following: java -jar target/project-0.1.0-LOCAL-NA.war --spring.config.location=file:./settings.properties the deploy profile is never enabled. I thought I had this working with a previous version (running 1.1.6.RELEASE now, coming from 1.0.2.RELEASE) but rolling back didn't help either. Am I missing something obvious? Update 1: So while debugging I discovered that Environment.getActiveProfiles() will only return 1 item, even if there's multiple active profiles (dev &amp; deploy in this case). So, while my reporting was only listing dev, deploy was there also. I've got things running again by using environment variables rather than properties files for profiles, but I'd like to get everything setup with just the files...
has comment: http://stackoverflow.com/comment/40726448
upvote count: 3
has comment: http://stackoverflow.com/comment/40715642
has comment: http://stackoverflow.com/comment/40674992
favorite count: 0
has comment: http://stackoverflow.com/comment/40655242
has comment: http://stackoverflow.com/comment/40651927
has comment: http://stackoverflow.com/comment/40652170
type: UnansweredQuestion
tagged with: maven
tagged with: spring
score: 3
tagged with: spring-boot
has answer: http://stackoverflow.com/a/29750983

http://stackoverflow.com/a/25936806
answers question: http://stackoverflow.com/q/25935536
has body: What you observe in your example is not collision effect. It is normal element replacement. After your 100 iteration there are only 10 elements in Hashtable. You use numbers i%10 (0,1,...,9) as keys. So, you have only 10 different keys. For example: in your for-loop you put 10 values for key=5 (i=5, i=15, i=95) and each put(5, val) replaces old value associated with key=5. Collision list is different concept. For each key hashtable computes some hash value and uses this hash to select index in its inner bucket table. Next places {key,value} under that index. Collision is situation where 2 different keys has computed the same bucket index. For example: table index | map.entry 0 | {0, "A"} 1 | {3, "B"} 2 | {2, "A"} -&gt; {4, "C"} 3 | {1, "D"} -&gt; {5, "A} -&gt; {6, "F} In this example you have hashtable with 4-element inner table. This hashtable contains 7 element (7 different keys) but: key 2 and 3 was placed to the same bucket (they have the same index computed upon hash value) key 1, 5, 6 was placed to the same bucket. So we can say, there is collision between key=2 and key=3 and between 1,5,6. In other words keys 2 adn 3 are on the same collision list. The same to keys 1,5,6. You cannot get such collistion list from Hashtable because it is Hashtable internal implementation marked as private: /** * Hashtable bucket collision list entry */ private static class Entry&lt;K,V&gt; implements Map.Entry&lt;K,V&gt; { int hash; final K key; V value; Entry&lt;K,V&gt; next; protected Entry(int hash, K key, V value, Entry&lt;K,V&gt; next) { this.hash = hash; this.key = key; this.value = value; this.next = next; } ... public V setValue(V value) { if (value == null) throw new NullPointerException(); V oldValue = this.value; this.value = value; return oldValue; } ... public int hashCode() { return hash ^ value.hashCode(); } ... } And Hashtable have its internal bucket table defined as: /** * The hash table data. */ private transient Entry&lt;K,V&gt;[] table; Hope this helps to f…
score: 0
type: Answer

http://stackoverflow.com/comment/72068227
has text: FYI you can NOT use MAVEN_OPTS=-B because that env var only specifies JVM parameters. Adding this to ~/.m2/settings.xml seems to accomplish same thing: false
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/25907959
type: Comment

http://stackoverflow.com/comment/40634614
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25954521
score: 1
has text: The short answer to the question in your last sentence is yes. If you are doing anything that affects your Swing GUI, and it's not on the EDT already, you must put it on the EDT by using invokeLater (or invokeAndWait).

http://stackoverflow.com/a/25963399
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25963156
accepted answer of: http://stackoverflow.com/q/25963156
type: Answer
has body: You need to use the com.apple.eawt classes. For example, this scratch program shows a Java dialog instead of the Mac one. import javax.swing.*; import com.apple.eawt.*; import com.apple.eawt.AppEvent.*; public class Foo extends JPanel implements AboutHandler { public static void main(String[] args) throws Exception { Foo r = new Foo(); } public Foo() { Application.getApplication().setAboutHandler(this); } public void handleAbout(final AboutEvent e) { JOptionPane.showMessageDialog(null, "hello, world"); } } Unfortunately all of this stuff is deprecated. Apple used to develop and support all of this but doesn’t anymore, and there are a lot of dead links around the internet. I figured out the API from reading the Javadoc comments in the source code for these classes. And running mdfind -name apple | grep -i jar turned up /usr/share/java/Stubs/AppleJavaExtensions.jar on my machine, which allowed the above program to compile and run on my machine. But I have no idea where that file came from or if it’ll be in future versions of Mac OS.
score: 3
upvote count: 3

http://stackoverflow.com/a/25914175
answers question: http://stackoverflow.com/q/25914057
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25914057
score: 14
has comment: http://stackoverflow.com/comment/90567353
type: AcceptedAnswer
upvote count: 14
has body: When you create an anonymous class, the compiler does some stuff: JavaRDD&lt;String&gt; numAs = positiveComments.filter(new Function&lt;String, Boolean&gt;() { public Boolean call(String s) { return s.contains(iterator.next()); } }); It will be rewritten as: JavaRDD&lt;String&gt; numAs = positiveComments.filter(new Function&lt;String, Boolean&gt;() { private Iterator&lt;...&gt; $iterator; public Boolean call(String s) { return s.contains($iterator.next()); } }); This is why you can have a NotSerializableException because the Iterator is not serializable. To avoid that, simply extract the result of next before: String value = iterator.next(); JavaRDD&lt;String&gt; numAs = positiveComments.filter(new Function&lt;String, Boolean&gt;() { public Boolean call(String s) { return s.contains(value); } });
type: Answer

http://stackoverflow.com/q/25960237
type: UnansweredQuestion
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/24430581
tagged with: uml
has comment: http://stackoverflow.com/comment/40644880
type: Question
has comment: http://stackoverflow.com/comment/40648139
has body: i'm working on a java Lap for course and student . I'm create class for student with vector&lt; studentcoruse> and create class called course with vector and create class called studentcourse have attribute grade and object from class student and course Q: now how connected between class student and course
score: 0
has title: many to many relationship in uml

http://stackoverflow.com/comment/40601792
has text: Thanks a lot Mohit for your quick response again. I have tried with microsoft native command 'expand'[Win7 onwards] and 'extract'[Lower than Win7]. Its perfectly works for my requirement. Thanks a lot. Below is my code snippet for achieving same.
comment on: http://stackoverflow.com/a/25933970
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25898096
has comment: http://stackoverflow.com/comment/40546138
score: 0
has comment: http://stackoverflow.com/comment/40558524
type: Answer
answers question: http://stackoverflow.com/q/25893886
has body: Use subqueries. Something like this. select a,b,c,date3 from A where date3 is null or date3 &lt; (select p.date1 from P p) order by a desc; HOWEVER! If you do not have mapped relationships between entities this is not what Hibernate is designed for and it is probably better to be using SQL directly.

http://stackoverflow.com/a/25958841
score: 4
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25956358
has body: The specification for the contains method says: returns true if and only if this collection contains at least one element e such that (o==null ? e==null : o.equals(e)) [docs oracle][1] However, it also says that it might throw a NullPointerException if the collection doesn't permit null elements or a ClassCastException if the type of the specified element is incompatible with this collection. These are marked as optional. Furthermore, it also says that: Many methods in Collections Framework interfaces are defined in terms of the equals method but: This specification should not be construed to imply that invoking Collection.contains with a non-null argument o will cause o.equals(e) to be invoked for any element e Therefore, my conclusion is that this is some kind of hack to allow implementations define different behaviours (e.g. accepting null elements) and optimizations (e.g. overriding the equals method of a class so you can check if an element is contained in the collection without having a reference to it). I'll explain the latest with an example: public class A { public void initialize() { // Lots of code and heavy initialization } public String id; @Override public int hashCode() { return id.hashCode(); } @Override public boolean equals(Object o) { return this.hashCode() == o.hashCode(); } } And then: SomeCollection&lt;A&gt; collection = new SomeCollection&lt;A&gt;(); // Create an element and add it to the collection A a = new A(); a.initialize(); // Heavy initialization element.id = "abc"; collection.add(a); // Check if the collection contains that element // We create a second object with the same id, but we do not initialize it A b = new A(); b.id = "abc"; // This works for many common collections (i.e. ArrayList and HashSet) collection.contains(b); Actually, there are more methods like indexOf(Object o) and remove(Object o) which follow this. So I don't think it's for compatibility, but it's made on purpose to allow for this kind of solutions. http://docs.o…

http://stackoverflow.com/q/25977612
has body: i have a strange problem with ant script. I have my libs (TESTNG,etc...) included as libs in my project ,also in ant script but i still get an error: package org.testng does not exist. Here is my script <project> <property name="src.dir" value="C:\GIT\SELT_jenkins_test\Java\SELT_TESTS"/> <property name="lib.dir" value="${src.dir}\libs"/> <property name="build.dir" value="${src.dir}\build"/> <include name="**/*.jar"/> <delete dir="${build.dir}/*"/> <mkdir dir="${build.dir}/classes"/> <classpath refid="TEST.classpath"/> <mkdir dir="${build.dir}/jar"/> <attribute name="Class-Path" value="${lib.dir}"/> <attribute name="Main-Class" value="oata.MainTestRun"/> <java jar="build/jar/CompiledTests.jar" fork="true"/> and this is what i get from console Buildfile: C:\GIT\SELT_jenkins_test\Java\SELT_TESTS\build\build.xml Trying to override old definition of task javac clean: compileAll: [javac] Compiling 35 source files to C:\GIT\SELT_jenkins_test\Java\SELT_TESTS\build\classes [javac] C:\GIT\SELT_jenkins_test\Java\SELT_TESTS\test\sk\ipesoft\d2000\d2japi\tests\ArchiveTest.java:9: error: package org.testng does not exist [javac] import org.testng.Assert; [javac] ^ [javac] C:\GIT\SELT_jenkins_test\Java\SELT_TESTS\test\sk\ipesoft\d2000\d2japi\tests\ArchiveTest.java:10: error: package org.testng.annotations does not exist [javac] import org.testng.annotations.DataProvider; [javac] ^ [javac] C:\GIT\SELT_jenkins_test\Java\SELT_TESTS\test\sk\ipesoft\d2000\d2japi\tests\ArchiveTest.java:11: error: package org.testng.annotations does not exist [javac] import org.testng.annotations.Test; [javac] ^ [javac] C:\GIT\SELT_jenkins_test\Java\SELT_TESTS\test\sk\ipesoft\d2000\d2japi\tests\common\BaseTest.java:6: error: package org.testng does not exist [javac] import org.testng.Assert; [javac] ^ [javac] C:\GIT\SELT_jenkins_test\Java\SELT_TESTS\test\sk\ipesoft\d2000\d2japi\tests\common\BaseTest.java:7: error: package org.testng.annotations does not exist [javac] import org.testng.annotations.AfterCla…
tagged with: testng
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25982987
tagged with: ant
score: 0
answer count: 1
has title: ANT - package org.testng does not exist
type: UnansweredQuestion

http://stackoverflow.com/comment/40528784
has text: It's Java's screwball inner class/"lambda" notation. A variable referenced from inside the lambda expression (that is not declared in the lambda expression) must be either an instance variable or a local variable that is not seen to change in the calling scope.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25894509
type: QuestionComment

http://stackoverflow.com/a/78434342
downvote count: 1
has body: jar -xf mylib.jar test.java The command attempts to extract the file test.java from the JAR file mylib.jar.
has comment: http://stackoverflow.com/comment/138278691
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/25972910
score: -1

http://stackoverflow.com/comment/40514295
type: AnswerComment
has text: log4j.appender.fileAppender.layout.ConversionPattern=[%-5p] %d [%t] %c %x - %m%n log4j.appender.fileAppender.File=ui_automation.log log4j.appender.fileAppender.MaxFileSize=5MB log4j.appender.fileAppender.MaxBackupIndex=2 log4j.logger.com.bmc.arsys=ERROR log4j.logger.org.openqa.selenium.remote.RemoteWebDriver=ERROR
type: Comment
comment on: http://stackoverflow.com/a/25885125
score: 0

http://stackoverflow.com/q/25947567
has answer: http://stackoverflow.com/a/25947579
has comment: http://stackoverflow.com/comment/40623223
possible better answer: http://stackoverflow.com/a/25947579
score: 0
tagged with: for-loop
has title: Calculate average of user input using for each
tagged with: arrays
has answer: http://stackoverflow.com/a/25947638
has body: Hi Im new to java and trying to do some exercises to familiarize myself with it. I am trying to calculate the sum and average of the user input numbers using a for each or enhanced for loop. What i have done is to store the numbers in an array. Can you please check if my code is correct. Scanner scanner = new Scanner(System.in); double inputNum; double sum= 0; int counter; System.out.println("How many entries would you like input"); int entry = scanner.nextInt(); for (counter = 0; counter&lt; entry; counter++){ double [] numbers = new double[entry]; System.out.println("Please input number " + (counter +1)); numbers[counter] = scanner.nextDouble(); for (double x : numbers[counter]) { x += sum; } System.out.println("The total sum is: " + sum); double average = sum/entry; System.out.println("The total average is: " + average); }
has answer: http://stackoverflow.com/a/25947577
answer count: 4
has comment: http://stackoverflow.com/comment/40622772
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25947577
tagged with: java
has answer: http://stackoverflow.com/a/25947632
type: Question

http://stackoverflow.com/comment/40582433
type: QuestionComment
score: 0
has text: Creation of war deploy happened as the same user and user has owner permission...
comment on: http://stackoverflow.com/q/25924245
type: Comment

http://stackoverflow.com/q/25902761
tagged with: memory
has title: Apache Giraph 1.0.0 - How is memory allocated for vertices?
tagged with: giraph
has answer: http://stackoverflow.com/a/58528737
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: Recently, I was successfully able to create a custom vertex class in which each vertex has a LongWritable id, and this id is also its own value. My Giraph program runs successfully on a small vertex set (100,000 vertices) and the program completes and outputs expected values. However, when I increase the volume to 30 million vertices, the program hangs when the total memory is maxed out (heap size is 1.5 GB per mapper). Since my vertex class only holds an id and value (8 + 8 = 16 bytes) as well as emanating edges (on average 8*8*2 = 128 bytes), I don't understand why memory consumption is so high. From the log message below, the memory is max'd out at 4.5 million vertices at 1363 MB, so each vertex is taking up 317 bytes when Giraph runs. What extra data structures within Giraph are causing bytes/vertex to be so high? readVertexInputSplit: Loaded 4500000 vertices at 90245.3768041096 vertices/sec 0 edges at 0.0 edges/sec Memory (free/total/max) = 187.52M / 1363.00M / 1365.50M waitFor: Future result not ready yet java.util.concurrent.FutureTask@5f7bd943
upvote count: 3
tagged with: java
type: Question
score: 3

http://stackoverflow.com/q/25926376
has body: I want to deserialize an object of an image. But i'am not able to understand what error I'am getting. I have stored an image as an object in an .ser file. But when I read that file i am getting an error. Please Someone help me.... Here is my program...... package deserializeDemo; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.util.ArrayList; import javax.imageio.ImageIO; public class DeserializeDemo { @SuppressWarnings("rawtypes") class ImageArray extends ArrayList { /** * */ private static final long serialVersionUID = 1L; int iHeight,iWidth; int[][] image; public ImageArray(int w,int h){ iHeight = h; iWidth = w; image = new int [iWidth][iHeight]; } public void printArray(){ for (int[] row : image) { for (int col : row) { System.err.println(col); } } } } public static void main(String [] args) { ImageArray e = null; ImageArray im = null; int iWidth=0; int iHeight=0; BufferedImage biColouredImage = null; try { FileInputStream fileIn = new FileInputStream("i.ser"); ObjectInputStream in = new ObjectInputStream(fileIn); e = (ImageArray) in.readObject(); in.close(); fileIn.close(); }catch(IOException i) { i.printStackTrace(); return; }catch(ClassNotFoundException c) { System.out.println("class not found"); c.printStackTrace(); return; } try { FileInputStream ifile = new FileInputStream("i.ser"); ObjectInputStream ois = new ObjectInputStream(ifile); im = (ImageArray) ois.readObject(); } catch (Exception e1) { e1.printStackTrace(); } try { BufferedImage biColouredImage_2 = new BufferedImage(im.iWidth, im.iHeight, BufferedImage.TYPE_BYTE_BINARY); for (int k = 0; k &lt; iWidth; k++) { for (int l = 0; l &lt; iHeight; l++) { biColouredImage_2.setRGB(k, l, im.image[k][l]); } } File file = new File("b.png"); ImageIO.write(biColouredImage_2, "png", file); } catch (IOException ioe) { ioe.printStackTrace(); } } } I'am getting error as follows.... class not found jav…
has comment: http://stackoverflow.com/comment/40603623
has title: Deserialize an image object
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/1457863
has comment: http://stackoverflow.com/comment/40603206
type: Question
downvote count: 0
tagged with: deserialization
has comment: http://stackoverflow.com/comment/40603251
favorite count: 0
has comment: http://stackoverflow.com/comment/40588497

http://stackoverflow.com/a/26134829
answers question: http://stackoverflow.com/q/25934908
type: AcceptedAnswer
downvote count: 0
has body: This is not solution to your problem that you explained, but you can go for this GCS: There are lot of Google Cloud Storage java api's available, you can upload the image or any file, and you can make it public and get the image url or just get JSON api from GCS such that you can download the image or any file content. Ex: https://github.com/pliablematter/simple-cloud-storage You can use Google Cloud Storage Java API for sending the data to cloud and Using Google Cloud Storage JSON api in android to retrieve the data. https://cloud.google.com/appengine/docs/java/googlestorage/
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41002769
accepted answer of: http://stackoverflow.com/q/25934908

http://stackoverflow.com/a/25956639
has comment: http://stackoverflow.com/comment/40638547
answers question: http://stackoverflow.com/q/25956540
upvote count: 1
has comment: http://stackoverflow.com/comment/40638733
downvote count: 0
has body: For sufficiently large n, use Stirling's approximation to display an immediate result for n!, while the more precise calculation proceeds in the background.
type: Answer
score: 1

http://stackoverflow.com/q/25899496
tagged with: mongodb
answer count: 1
has title: Cannot get stored document from mongodb using spring data
has body: I have document with "_id" : ObjectId("5449567cdf97f277c50d1ce2") but I am getting null when trying to get it by id using findOne. How to solve it? main public class MongoDBJDBC { public static void main( String args[] ){ ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("spring/applicationContext.xml"); ProductService productService = context.getBean(ProductService.class); Product product = productService.get("5449567cdf97f277c50d1ce2"); // null here } } service @Service public class ProductService { @Autowired private ProductDao productDao; @Autowired private ProductPropertiesDao productPropertiesDao; public void add(Product product) { productDao.save(product); } public void update(Product product) { productDao.save(product); } public Product get(String id) { return productDao.get(id); } dao @Repository public class ProductDao { @Autowired private MongoOperations mongoOperations; public Product get(String id) { return mongoOperations.findOne(Query.query(Criteria.where("id").is(new ObjectId(id))), Product.class); } } entity @Document(collection = Product.COLLECTION_NAME) public class Product implements Serializable { public Product() { } public static final String COLLECTION_NAME = "product"; @Id private String _id; private String name; } document { "_id" : ObjectId("5449567cdf97f277c50d1ce2"), "name" : "product" }
tagged with: spring
accepted answer: http://stackoverflow.com/a/25899650
type: AnsweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25899650
score: 0

http://stackoverflow.com/comment/40579518
type: AnswerComment
score: 0
type: Comment
has text: @Alisa I added an example of a reflection implementation
comment on: http://stackoverflow.com/a/25921185

http://stackoverflow.com/comment/40628549
has text: Where does the ascii file come from?
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25950877
type: Comment

http://stackoverflow.com/q/25926870
downvote count: 0
favorite count: 0
has title: Unable to set reference variable in recursive call
has body: I am using a recursive method to find a node in a binary tree using a key. When I find the node, I set it to my reference variable foundNode and return. The problem is that when I read the object its value is still null. Can anybody help? findGivenNode(root, key, foundNode, parentStack); private boolean findGivenNode(Node node, int key, Node foundNode, Stack&lt;Node&gt; parentStack) { if (node == null) { return false; } parentStack.add(node); if (node.getData() == key) { foundNode = node; return true; } boolean leftReturn = findGivenNode(node.getLeftChild(), key, foundNode, parentStack); boolean RightReturn = findGivenNode(node.getRightChild(), key, foundNode, parentStack); if (leftReturn || RightReturn) { return true; } else { parentStack.pop(); return false; } }
tagged with: recursion
linked to: http://stackoverflow.com/q/17032327
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25926924
type: Question
tagged with: data-structures
accepted answer: http://stackoverflow.com/a/25926924
answer count: 1

recursion
type: Tag
tags question: http://stackoverflow.com/q/26017357
tag name: recursion
tags question: http://stackoverflow.com/q/25926157
tags question: http://stackoverflow.com/q/25977858
tags question: http://stackoverflow.com/q/25923700
tags question: http://stackoverflow.com/q/26023207
tags question: http://stackoverflow.com/q/25880084
tags question: http://stackoverflow.com/q/25918119
tags question: http://stackoverflow.com/q/26008940
tags question: http://stackoverflow.com/q/25926870
tags question: http://stackoverflow.com/q/25927496
tags question: http://stackoverflow.com/q/25957742
tags question: http://stackoverflow.com/q/26033586
tags question: http://stackoverflow.com/q/25955664
tags question: http://stackoverflow.com/q/25907759
tags question: http://stackoverflow.com/q/26018623
tags question: http://stackoverflow.com/q/25954584
tags question: http://stackoverflow.com/q/26026446
tags question: http://stackoverflow.com/q/25932254
tags question: http://stackoverflow.com/q/26017545
tags question: http://stackoverflow.com/q/25966337
tags question: http://stackoverflow.com/q/26008882
tags question: http://stackoverflow.com/q/25982279
tags question: http://stackoverflow.com/q/25881422
tags question: http://stackoverflow.com/q/25930902
tags question: http://stackoverflow.com/q/26007668
tags question: http://stackoverflow.com/q/25963718

http://stackoverflow.com/q/25916460
answer count: 2
tagged with: plsql
has comment: http://stackoverflow.com/comment/40568673
has comment: http://stackoverflow.com/comment/40714032
has comment: http://stackoverflow.com/comment/40568707
has comment: http://stackoverflow.com/comment/40569182
score: 4
has title: Oracle sql STRUCT creation taking too much time
favorite count: 0
tagged with: oracle-database
accepted answer: http://stackoverflow.com/a/25991992
upvote count: 4
possible better answer: http://stackoverflow.com/a/25917155
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25917155
has comment: http://stackoverflow.com/comment/40713377
downvote count: 0
has answer: http://stackoverflow.com/a/25991992
has comment: http://stackoverflow.com/comment/40567838
type: Question
has comment: http://stackoverflow.com/comment/40568311
tagged with: java
has comment: http://stackoverflow.com/comment/40715909
has body: Java imports snippet: import oracle.sql.StructDescriptor; import oracle.sql.ARRAY; import oracle.sql.ArrayDescriptor; import oracle.sql.STRUCT; PLSQL code snippet: one_user_type : CREATE OR REPLACE TYPE one_user_type ABCD IS OBJECT ( user_id VARCHAR2(120), user_name VARCHAR2(120) ) Java code snippet: // Connection conn; Object[] userObject1 = new Object[] { "101", "peter" }; StructDescriptor userDescriptor = StructDescriptor .createDescriptor("one_user_type", conn); // The below line takes 2.5 seconds approx to execute. STRUCT user1 = new STRUCT(userDescriptor, conn, userObject1); notes: ojdbc6.jar ; jdk1.6, Oracle 11g Question - Any idea why is this taking too much time, and how to reduce it? Edit 1 in response to @Lalit Kumar B comments: 'too much time' is in relative to the actual query execution. The STRUCT is created to pass a Table of Records/Table of Objects to a PLSQL Procedure. The actual query execution takes just 93 milliseconds, where as UI waits for around 5 seconds when two such procedures are called, both of them taking Table of Objects and where we need to create STRUCT. Hence 2.5 seconds is considered so much, and I like to finetune it. When I checked the execution time of other Java object construction, transformation, query execution etc, they are all very much low compared to this one STRUCT creation. Considering my scenario where I really call 5 stored procedures, which takes Table of Objects as parameter, I make 5 different calls to create STRUCT for each of them, it totally takes around 7 seconds for just STRUCT creation. The idea is to call the procedures, get the result, put in a wrapper and send back to UI. Edit 2:[09/20] To minimize the time, created a single procedure that takes a Table of Objects and acts as a wrapper that internally calls the 5 procedures. Hence from Java code, its just one stored procedure call. Still, STRUCT has to be created one time to feed as input to the wrapper procedure. On running multiple times, its observed t…

http://stackoverflow.com/q/25916265
favorite count: 0
has comment: http://stackoverflow.com/comment/40566989
has answer: http://stackoverflow.com/a/25916425
has comment: http://stackoverflow.com/comment/40567231
accepted answer: http://stackoverflow.com/a/25916425
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25916504
downvote count: 0
score: 1
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/40567385
possible better answer: http://stackoverflow.com/a/25916504
type: Question
has comment: http://stackoverflow.com/comment/40567593
tagged with: debugging
has comment: http://stackoverflow.com/comment/40567167
tagged with: conditional-statements
tagged with: performance
has body: Okay, I have never had this problem before so I am not sure how to word it or to repair it, I am building a java application that creates dealers, in that application I have the parameters passed in to the DealerFactory.createDealer method and proceed to first check if that dealer exists with a conditional statement that looks like this: if (DealerFactory.fetchDealer(loginId).getLoginId().equals(loginId)) { throw new Exception("Sorry That Dealer Already Exists"); } else if (DealerFactory.fetchDealer(loginId).getId().equals(DNo)){ throw new Exception("Sorry That Dealer Already Exists"); } else { &lt;&lt; proceed with the rest of the method here &gt;&gt; I have seen this done before so as to check the availability of the username and the id of the person being created. However after running it I found that if I create the dealer and the condition evaluates to true the if statement works just fine letting me know that I have created a user that already exists and I need to create him/her with new a different Id and username. However if the condition evaluates to false I never seem to make it into the else portion of the statement, I am getting no errors, no compilation issues, and no exceptions I have written the statement differently to try that, which wasn't really any different it just looked syntactically different: if (DealerFactory.fetchDealer(loginId).getLoginId().equals(loginId) || DealerFactory.fetchDealer(loginId).getId().equals(DNo)) { throw new Exception("Sorry That Dealer Already Exists"); } I have included println statements to follow the program through its run and when the condition evaluates to false I never make it into the else statement. I cant seem to figure out why it is breaking on the condition statement when it is evaluated to false, any thoughts? edit::: Ok so that I can be of more assistance in helping you guys help me lol here is the method in its entirety, I apologize for not posting it in the first place public static int create(String DNo…
has comment: http://stackoverflow.com/comment/40567170
has comment: http://stackoverflow.com/comment/40567232
has comment: http://stackoverflow.com/comment/40567234
has title: Why isn't my java code proceeding past my if statements?
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/40502729
has text: Fixed it. I meant I cannot get the amount of digits to the left to print out correctly
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25880584
score: 1

http://stackoverflow.com/q/25934376
accepted answer: http://stackoverflow.com/a/25934433
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25934532
has title: Android - Java - Have app run when device boots up
type: Question
has answer: http://stackoverflow.com/a/25934433
has comment: http://stackoverflow.com/comment/40600102
has answer: http://stackoverflow.com/a/25934525
has comment: http://stackoverflow.com/comment/40599654
upvote count: 1
linked to: http://stackoverflow.com/q/6391902
possible better answer: http://stackoverflow.com/a/25934424
favorite count: 0
has answer: http://stackoverflow.com/a/25934424
has body: I am having a bit of an issue here, my code seems right, but its not doing what I am expecting it too. I have an app and I would like to run when the device boots up. But when the device boots up, it application does not run, which is what I am expecting. First in my Manifest, I added the uses-permission for RECEIVE_BOOT_COMPLETED: <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> Then also in my Manifest I added a receiver and activity inside the application: <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.DEFAULT" /> And then I created a BootReceiver Activity that looks like this: import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class BootReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Intent i = new Intent(context, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } } When I install the app, boot the device, the app does not run right when the device boots up. I do not understand what I am doing wrong here. Is my code wrong? Anyone got any ideas?
has comment: http://stackoverflow.com/comment/40599719
tagged with: android
has comment: http://stackoverflow.com/comment/40599675
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/25881428
has title: Multidata Type Array In Java
downvote count: 0
has answer: http://stackoverflow.com/a/25881485
has comment: http://stackoverflow.com/comment/40504239
type: Question
score: 3
tagged with: java
upvote count: 3
tagged with: concatenation
has body: Complete newbie here guys. I'm working on a Java program to prompt the user for 3 variables which are used to calculate a future investment's value. Everything works perfectly, except when it comes time to put both my datatypes into ONE array. Here's what the output SHOULD look like: Year Future Value 1 $1093.80 2 $1196.41 3 $1308.65 ... This is what mine looks like: Year 1 Future Value 1093.81 Year 2 Future Value 1196.41 Year 3 Future Value 1308.65 ... My year is an int value and my Future value is a double (rounded). I've been sitting here racking my brain and all the forums I can find and haven't been successful. Every time I put both value into an array I get an error about putting two different datatypes together. Any insight would be greatly appreciated. Below is the code for my full program: import java.util.Scanner; class investmentValue { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("Enter investment amount: $"); double i = s.nextDouble(); System.out.print("Enter percentage rate: "); double r = s.nextDouble()/100; System.out.print("Enter number of years: "); int y = s.nextInt(); for (y=1; y&lt;=30; y++) { double f = futureInvestmentValue(i,r,y); System.out.println("Year " + y); System.out.println("Future Value " + f); } } public static double futureInvestmentValue (double investmentAmount, double monthlyInterestRate, int years){ double value=1; value = investmentAmount*Math.pow((1+(monthlyInterestRate/12)),(years * 12)); double roundValue = Math.round(value*100.0)/100.0; return roundValue; } }
tagged with: arrays
possible better answer: http://stackoverflow.com/a/25881485
favorite count: 0
tagged with: type-conversion
has answer: http://stackoverflow.com/a/25881569
answer count: 5
has answer: http://stackoverflow.com/a/25881618
has answer: http://stackoverflow.com/a/25881553
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25881553
has answer: http://stackoverflow.com/a/25881551

http://stackoverflow.com/comment/40515936
has text: My server application connects to MYSQL through MYSQL connector both are GPL licensed , and the server code contains ofcourse the MYSQL Java connector library to connect to the MYSQL server but the server itself is not distributed or given to the client , the client only pays for the online game(client application) and not server
type: Comment
comment on: http://stackoverflow.com/a/25888295
score: 0
type: AnswerComment

http://stackoverflow.com/q/25915812
downvote count: 0
has body: I have googled for hours now and read a lot of similar questions like this and this . Now I simplified my code to some few short lines, so the problem should be obvious - but I still fail to solve it. Here are my two simple classes: package ant; import my.package.util.exception.UtilTest; public class Debug { public static void main(String[] args) { System.out.println(UtilTest.myTest()); } } package my.package.util.exception; public class UtilTest { public static boolean myTest(){ return true; } } I built my.package.util.jar and put it into directory lib in the project directory. Now I run the ant built script (see below) to built the jar for Debug class. The built is sucessfull, the MANIFEST.MF is: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.4 Created-By: 1.8.0_20-b26 (Oracle Corporation) Main-Class: ant.Debug Class-Path: lib/my.package.util.jar with empty line at the end. Here is the build.xml: <?xml version="1.0"?> <fileset dir="lib/" includes="**/*.jar"/> <pathelement location="."/> <pathelement location="bin"/> <mkdir dir="build/classes"/> <classpath refid="my.classpath"/> <mkdir dir="build/jar"/> <attribute name="Main-Class" value="ant.Debug"/> <attribute name="Class-Path" value="lib/my.package.util.jar"/> <arg value="${file}"/> Running "ant debug" now, I get: debug: [java] Exception in thread "main" java.lang.NoClassDefFoundError: my/package/util/exception/UtilTest [java] at ant.Debug.main(Unknown Source) [java] Caused by: java.lang.ClassNotFoundException: my.package.util.exception.UtilTest [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:366) [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:355) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:354) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [jav…
linked to: http://stackoverflow.com/q/13486996
accepted answer: http://stackoverflow.com/a/26012180
has title: Compiling successful, NoClassDefFoundError at ant java task
favorite count: 0
possible better answer: http://stackoverflow.com/a/25938983
has answer: http://stackoverflow.com/a/25938983
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24700018
score: 3
upvote count: 3
tagged with: java
tagged with: noclassdeffounderror
has answer: http://stackoverflow.com/a/26012180
type: Question
answer count: 2
tagged with: ant

http://stackoverflow.com/a/62269056
has body: You can use Gson instead of ObjectMapper and while defining the entity mark the field as "transient" public class Book { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column private String title; @OneToMany(fetch = FetchType.LAZY, mappedBy = ("movie"),cascade = CascadeType.ALL) private **transient** List&lt;Genre&gt; genre; } while Deserialization using gson.toJson(book) , Gson will not deserialize that element.
score: -1
answers question: http://stackoverflow.com/q/25906985
downvote count: 1
type: Answer
upvote count: 0

http://stackoverflow.com/q/25983027
has comment: http://stackoverflow.com/comment/40700087
answer count: 0
score: 0
type: UnansweredQuestion
has body: I want to implement progress bar in JavaFx, that will indicate state of report creating using xdocreport (docx or pdf file). Any sugestions how can I achive that. Some example ? How can I use Thread for that ? I have tried like this but something is not working. /** * Called when the user clicks the assign button. Generates Report about Employee * */ @FXML private void generateEmployeeReport() { Task&lt;Void&gt; task = new Task&lt;Void&gt;() { @Override public Void call() { try { // 1) Load Docx file by filling Velocity template engine and cache // it to the registry InputStream in = RootController.class .getResourceAsStream("ReportEmployeeTemplate.docx"); IXDocReport report = XDocReportRegistry.getRegistry().loadReport( in, TemplateEngineKind.Velocity); // 2) Create context Java model IContext context = report.createContext(); ReportEmployee project = new ReportEmployee("Majmun"); context.put("ReportEmployee", project); // 3) Generate report by merging Java model with the Docx OutputStream out = new FileOutputStream(new File( "bzzer.pdf")); // report.process(context, out); Options options = Options.getTo(ConverterTypeTo.PDF).via( ConverterTypeVia.XWPF); report.convert(context, options, out); } catch (IOException e) { e.printStackTrace(); } catch (XDocReportException e) { e.printStackTrace(); } return null; } }; progresBarOne.progressProperty().bind(task.progressProperty()); Thread th = new Thread(task); th.setDaemon(true); th.start(); } File is created but progress bar keeps showing some work (Keep "indicating" progress)
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40699637
has comment: http://stackoverflow.com/comment/40698839
has comment: http://stackoverflow.com/comment/40698961
linked to: http://stackoverflow.com/q/25399223
tagged with: xdocreport
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/40711506
type: Question
has title: Javafx, xdocreport and Thread - creating report
has comment: http://stackoverflow.com/comment/40699531

http://stackoverflow.com/comment/40778607
score: 0
comment on: http://stackoverflow.com/a/26028041
type: AnswerComment
type: Comment
has text: To be more specific about what I want to do, I just want to do this : http://xcellerant.net/2014/04/22/dojo-in-xpages-19-using-ajax-to-retrieve-data-from-a-rest-service/ and use it from xPINC

http://stackoverflow.com/q/25888342
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25888622
tagged with: pojo
tagged with: sql-server
has title: Mapping and POJO class creation for a database view in hibernate
has body: Hai all I am using hibernate and Microsoft SQL server. I have a view in my database as follows create view [dbo].[Pat_Det] As Select patientid As pid,title, fname, mname,lname,dob,gender,mstatus,idtype,idno,mtongue,emailid,smsstatus,mailstatus,status,regcenter,regdate from dbo.LAB_patientreg WHERE 1=1 For this view I had created a Pojo class like this package POJO; import java.io.Serializable; import java.util.Date; public class AddressViewPojo implements Serializable{ String pid, title, fname, mname, lname, sex, mstatus, idtype, aadhar_no, emailid, regcenter; Date dob, date_created; int allow_sms, allow_email, status; public String getPid() { return pid; } public void setPid(String pid) { this.pid = pid; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getFname() { return fname; } public void setFname(String fname) { this.fname = fname; } public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getMstatus() { return mstatus; } public void setMstatus(String mstatus) { this.mstatus = mstatus; } public String getIdtype() { return idtype; } public void setIdtype(String idtype) { this.idtype = idtype; } public String getAadhar_no() { return aadhar_no; } public void setAadhar_no(String aadhar_no) { this.aadhar_no = aadhar_no; } public String getEmailid() { return emailid; } public void setEmailid(String emailid) { this.emailid = emailid; } public String getRegcenter() { return regcenter; } public void setRegcenter(String regcenter) { this.regcenter = regcenter; } public Date getDob() { return dob; } public void setDob(Date dob) { this.dob = dob; } public Date getDate_created() { return date_created; } public void setDate_created(Date date_created) { this.da…
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40516401
has answer: http://stackoverflow.com/a/25888622
tagged with: hibernate-mapping

http://stackoverflow.com/comment/40757204
score: 0
comment on: http://stackoverflow.com/a/26021659
type: AnswerComment
type: Comment
has text: While the TEE command-line client will run fine on Windows, we would still recommend using the standalone Team Explorer is superior for Windows users. It is significantly more feature rich on Windows.

spring
tags question: http://stackoverflow.com/q/25922682
tags question: http://stackoverflow.com/q/25958917
tags question: http://stackoverflow.com/q/25909459
tags question: http://stackoverflow.com/q/25921840
tags question: http://stackoverflow.com/q/25887688
tags question: http://stackoverflow.com/q/25901983
tags question: http://stackoverflow.com/q/25981158
tags question: http://stackoverflow.com/q/25879317
tags question: http://stackoverflow.com/q/25893528
tags question: http://stackoverflow.com/q/25915621
tags question: http://stackoverflow.com/q/25922956
tags question: http://stackoverflow.com/q/25969783
tags question: http://stackoverflow.com/q/25977710
tags question: http://stackoverflow.com/q/25925538
tags question: http://stackoverflow.com/q/25914572
tags question: http://stackoverflow.com/q/25985482
tags question: http://stackoverflow.com/q/25915598
tags question: http://stackoverflow.com/q/26020743
tags question: http://stackoverflow.com/q/25980582
tags question: http://stackoverflow.com/q/26002682
tags question: http://stackoverflow.com/q/26012663
tags question: http://stackoverflow.com/q/25878949
tags question: http://stackoverflow.com/q/25893283
tags question: http://stackoverflow.com/q/25949078
tags question: http://stackoverflow.com/q/25929819
tags question: http://stackoverflow.com/q/25991191
tags question: http://stackoverflow.com/q/25989598
tags question: http://stackoverflow.com/q/25894393
tags question: http://stackoverflow.com/q/25950686
tags question: http://stackoverflow.com/q/25973575
tags question: http://stackoverflow.com/q/25937477
tags question: http://stackoverflow.com/q/26009791
tags question: http://stackoverflow.com/q/26001006
tags question: http://stackoverflow.com/q/25951849
tags question: http://stackoverflow.com/q/25992277
tags question: http://stackoverflow.com/q/26010992
tags question: http://stackoverflow.com/q/26013925
tags question: http://stackoverflow.com/q/25992986
tags question: http://stackoverflow.com/q/25965705
tags question: http://stackoverflow.com/q/26010367
tags question: http://stackoverflow.com/q/25999636
tags question: http://stackoverflow.com/q/25953107
tags question: http://stackoverflow.com/q/25885971
tags question: http://stackoverflow.com/q/25896998
tags question: http://stackoverflow.com/q/25927372
tags question: http://stackoverflow.com/q/25999077
tags question: http://stackoverflow.com/q/25906171
tags question: http://stackoverflow.com/q/25899632
tags question: http://stackoverflow.com/q/25919531
tags question: http://stackoverflow.com/q/26004168
tags question: http://stackoverflow.com/q/25965529
tags question: http://stackoverflow.com/q/25906505
tags question: http://stackoverflow.com/q/25901985
tags question: http://stackoverflow.com/q/25982853
tags question: http://stackoverflow.com/q/26021114
tags question: http://stackoverflow.com/q/25951491
tags question: http://stackoverflow.com/q/25932370
tags question: http://stackoverflow.com/q/25925672
tags question: http://stackoverflow.com/q/25999717
tags question: http://stackoverflow.com/q/25967435
tags question: http://stackoverflow.com/q/25947668
tags question: http://stackoverflow.com/q/26023970
tags question: http://stackoverflow.com/q/25897274
tags question: http://stackoverflow.com/q/25980004
type: Tag
tags question: http://stackoverflow.com/q/25911265
tags question: http://stackoverflow.com/q/25887346
tags question: http://stackoverflow.com/q/25989557
tags question: http://stackoverflow.com/q/26026521
tags question: http://stackoverflow.com/q/26026684
tags question: http://stackoverflow.com/q/25988030
tags question: http://stackoverflow.com/q/25932089
tags question: http://stackoverflow.com/q/25914112
tags question: http://stackoverflow.com/q/25948604
tags question: http://stackoverflow.com/q/25885328
tags question: http://stackoverflow.com/q/25931930
tags question: http://stackoverflow.com/q/25933532
tags question: http://stackoverflow.com/q/25910350
tags question: http://stackoverflow.com/q/25949777
tags question: http://stackoverflow.com/q/25994279

http://stackoverflow.com/comment/40544888
comment on: http://stackoverflow.com/a/25904002
type: Comment
score: 2
has text: `vector.toArray(new String[vector.size()]);` is much better +1
type: AnswerComment

http://stackoverflow.com/q/25934831
answer count: 1
tagged with: generics
accepted answer: http://stackoverflow.com/a/25968161
favorite count: 0
has body: I've got a problem with generic classes and I'm going to explain it with my example classes: BinaryTree public class BinaryTree&lt;T extends Comparable&lt;T&gt;&gt; { Indexed public abstract class Indexed&lt;T extends Comparable&lt;T&gt;&gt; implements Comparable&lt;Indexed&lt;T&gt;&gt; { IndexedBinaryTree public class IndexedBinaryTree&lt;T extends Indexed&lt;? extends Comparable&lt;Indexed&lt;?&gt;&gt;&gt;&gt; extends BinaryTree&lt;T&gt; { Example class which extends Indexed public class Vokabel extends Indexed&lt;String&gt; { The IndexedBinaryTree isn't working. What I'm trying to do is having an BinaryTree which contains Indexed objects and can be created like this: IndexedBinaryTree&lt;Vokabel&gt; ibt = new IndexedBinaryTree&lt;&gt;(); The Error NetBeans is giving me: type argument ? extends Comparable> is not within bounds of type-variable T where T is a type-variable: T extends Comparable declared in class Indexed &gt; expected type argument T#1 is not within bounds of type-variable T#2 where T#1, T#2 are type-variables: T#1 extends Indexed&lt;? extends Comparable&lt;Indexed&lt;?&gt;&gt;&gt; declared in class IndexedBinaryTree T#2 extends Comparable&lt;T#2&gt; declared in class BinaryTree
has comment: http://stackoverflow.com/comment/40600777
has comment: http://stackoverflow.com/comment/40603127
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40600469
tagged with: java
has comment: http://stackoverflow.com/comment/40604038
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25968161
has comment: http://stackoverflow.com/comment/40603011
score: 0
has comment: http://stackoverflow.com/comment/40600467
has title: Errors with generic class extending other generic class

http://stackoverflow.com/q/25943701
has body: I have a simple method which reads a file, modifies some lines based on a condition, and then writes the modified string back to the same file. The outline is as follows: import com.google.common.base.Joiner; import com.google.common.io.Files; import static java.nio.charset.Charset.defaultCharset; static final DIR = ; String enforceVerbTag(String inputfilename) { String predictedTags = Files.toString(new File(DIR, inputfilename), defaultCharset()); String[] lines = predictedTags.split("\\r?\\n"); List&lt;String&gt; modifiedLines = new ArrayList&lt;&gt;(); for (String line : lines) { String[] fields = line.split("\\t"); if (mycondition) fields[1] = "VB"; String modifiedLine = Joiner.on('\t').join(fields); modifiedLines.add(modifiedLine); } modifiedLines.add(""); Files.write(Joiner.on('\n').join(modifiedLines), new File(DIR, inputfilename), defaultCharset()); } The input file has an empty last line, and I want the output file to retain that. But in spite of modifiedLines.add("") followed by joining on \n, the output file doesn't have that last empty line. As far as I know, Guava's Files#write doesn't do any trimming, so why does this happen? I know there are many other ways of writing that last empty line. But I would like to know what is going wrong with this method.
accepted answer: http://stackoverflow.com/a/25944028
type: AnsweredQuestion
tagged with: guava
tagged with: java
has title: Guava's `Files#write` doesn't write last empty line?
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/25944073
has answer: http://stackoverflow.com/a/25944073
score: 0
has answer: http://stackoverflow.com/a/25944028
answer count: 2
tagged with: file-io
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40847231

http://stackoverflow.com/comment/40619226
comment on: http://stackoverflow.com/q/25945047
has text: What does this have to do with Android? What is your question?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40841710
score: 0
has text: Found a solution on a different blog thought I will share it here as well. Check out [adding-descriptions-to-jmx-beans-using-an-annotation-wrapper](http://udojava.com/2012/11/13/adding-descriptions-to-jmx-beans-using-an-annotation-wrapper/) Also See [JMXWrapper](https://github.com/uklimaschewski/JMXWrapper) for a description on how to do this.
comment on: http://stackoverflow.com/q/26027277
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25897627
has comment: http://stackoverflow.com/comment/82251029
tagged with: sockets
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/48735391
accepted answer: http://stackoverflow.com/a/25900095
downvote count: 0
has comment: http://stackoverflow.com/comment/40533390
tagged with: java
has comment: http://stackoverflow.com/comment/40533506
score: 16
has title: DataInputStream.read() vs DataInputStream.readFully()
type: Question
has body: Im making a simple TCP/IP Socket app Whats the different between doing this: DataInputStream in = new DataInputStream(clientSocket.getInputStream()); byte[] buffer = new byte[100]; in.readFully(buffer); versus doing this: DataInputStream in = new DataInputStream(clientSocket.getInputStream()); byte[] buffer = new byte[100]; in.read(buffer); I had a look at the documentation, they have the same exact description. readFully() and read() So can I assume its the same thing?
has answer: http://stackoverflow.com/a/25900095
tagged with: java-io
has answer: http://stackoverflow.com/a/48735391
answer count: 2
upvote count: 16
favorite count: 0

http://stackoverflow.com/a/25892829
downvote count: 0
upvote count: 2
has body: The sentence String is empty, so nothing is ever written to the file. Try changing so that the sentence is non empty.
type: Answer
answers question: http://stackoverflow.com/q/25892777
score: 2

http://stackoverflow.com/comment/40497218
score: 0
type: AnswerComment
has text: Many thanks, i couldnt see the wood through the trees with so many brackets, solved!!
type: Comment
comment on: http://stackoverflow.com/a/25874925

http://stackoverflow.com/comment/40753475
has text: Suggestion :try to use the same names as in the json.It will be less confusion and better understanding.Its easy to map.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26019531

http://stackoverflow.com/q/25930427
downvote count: 0
favorite count: 0
tagged with: postgresql
tagged with: jooq
upvote count: 2
has title: How can I get an id for a new record in a generic way? (JOOQ 3.4 with Postgres)
has answer: http://stackoverflow.com/a/25930908
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has body: With jooq 3.4 I can't figure out how to do this (with Postgresql): Query query = dsl.insertInto(TABLE) .set(TABLE.ID, Sequences.TABLE_ID_SEQ.nextval()); but in a case when I don't know which is the exact table, something like this: TableImpl&lt;?&gt; tableImpl; Query query = dsl.insertInto(tableImpl) .set(tableImpl.getIdentity(), tableImpl.getIdentity().getSequence().nextval()); Is it somehow possible? I tried this: dsl.insertInto(tableImpl) .set(DSL.field("id"), tableImpl.getSchema().getSequence("table_id_seq").nextval()) This works but I still don't know how to get the sequence name from the TableImpl object. Is there a solution for this? Or is there a problem with my approach? In plain SQL I would do this: insert into table_A (id) VALUES nextval('table_A_id_seq'); insert into table_B (table_A_id, some_val) VALUES (currval('table_A_id_seq'), some_val); So I need the value or a reference to that id for later use of the id that was generated for the inserted record as default, but I don't want to set any other values.
accepted answer: http://stackoverflow.com/a/25930908
tagged with: sql
answer count: 1

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

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/26030075
tags question: http://stackoverflow.com/q/26001806
tags question: http://stackoverflow.com/q/25956775
tags question: http://stackoverflow.com/q/25927804
tags question: http://stackoverflow.com/q/25993057
tags question: http://stackoverflow.com/q/25923449
tags question: http://stackoverflow.com/q/25942358
tags question: http://stackoverflow.com/q/25899818
tags question: http://stackoverflow.com/q/25912386
tags question: http://stackoverflow.com/q/25910871
tags question: http://stackoverflow.com/q/25987011
tags question: http://stackoverflow.com/q/25931650
tags question: http://stackoverflow.com/q/25881010
tags question: http://stackoverflow.com/q/25889335
type: Tag
tags question: http://stackoverflow.com/q/25983786
tags question: http://stackoverflow.com/q/26017291
tags question: http://stackoverflow.com/q/26013544
tags question: http://stackoverflow.com/q/25921573
tags question: http://stackoverflow.com/q/25929922
tags question: http://stackoverflow.com/q/25886708
tags question: http://stackoverflow.com/q/25983336
tags question: http://stackoverflow.com/q/25892822
tags question: http://stackoverflow.com/q/25971168
tags question: http://stackoverflow.com/q/26032634
tags question: http://stackoverflow.com/q/25925198
tags question: http://stackoverflow.com/q/25997365
tags question: http://stackoverflow.com/q/25979948
tags question: http://stackoverflow.com/q/25989801
tags question: http://stackoverflow.com/q/26028977
tags question: http://stackoverflow.com/q/25911661
tags question: http://stackoverflow.com/q/25894200
tags question: http://stackoverflow.com/q/25994952
tags question: http://stackoverflow.com/q/25998296
tags question: http://stackoverflow.com/q/26014807
tags question: http://stackoverflow.com/q/25882815
tags question: http://stackoverflow.com/q/25931305
tags question: http://stackoverflow.com/q/25963295
tag name: html
tags question: http://stackoverflow.com/q/25936387
tags question: http://stackoverflow.com/q/25929112
tags question: http://stackoverflow.com/q/25885971
tags question: http://stackoverflow.com/q/25983802
tags question: http://stackoverflow.com/q/25975193

http://stackoverflow.com/comment/40607417
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25929367
type: Comment
has text: There *are* times when you have to use an asynchronous process (or are forced to process on a different thread--see STA threads) yet also have to block the current thread until that process is complete. So there are instances where you'd have to do something like this.

http://stackoverflow.com/a/26038522
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26017043
has body: I know this will not answer the question (Can try .. catch be used for code optimization), but I think you should rarely bother with null values: you should enforce the (width, height, depth) to be non null if they are intrinsic property of your object. I mean, you are building a RectangularPrism: width, height, and depth define this object. You can't have null in there because otherwise it would not be a rectangular prism. In that case, I would rather do that: public class RectangularPrism { private final Integer width; private final Integer height; private final Integer depth; public RectangularPrism(Integer width, Integer height, Integer depth) { this.width = Objects.requireNonNull(width, "width"); this.height = Objects.requireNonNull(height, "height"); this.depth = Objects.requireNonNull(depth, "depth"); } // getters } Or with setter: public class RectangularPrism { public Integer width; public Integer height; public Integer depth; public void setWidth(Integer width) { this.width = Objects.requireNonNull(width, "width"); } } You don't have to handle null because the JVM will throw a NullPointerException, but only because the object was not fully/correctly initialized, not because you did not handle a null value that should not be there. This is a normal behavior like throwing an IllegalStateException because the object is in a state it should not be (here: because you have null values). And to be complete, you would have a better implementation if the volume computation were an operation on RectangularPrism rather than an external operation. This way would be more correct: public class RectangularPrism { private final Integer width; private final Integer height; private final Integer depth; public RectangularPrism(Integer width, Integer height, Integer depth) { this.width = Objects.requireNonNull(width, "width"); this.height = Objects.requireNonNull(height, "height"); this.depth = Objects.requireNonNull(depth, "depth"); } public Integer computeVolume() { return …

http://stackoverflow.com/a/25950616
has comment: http://stackoverflow.com/comment/40835376
answers question: http://stackoverflow.com/q/25947792
has comment: http://stackoverflow.com/comment/40628067
has body: With Android, you have to use the function corresponding to the appropriate type. In this case it is getList:. List&lt;String&gt; list = myParseObject.getList("myArray");
has comment: http://stackoverflow.com/comment/40833088
score: 0
has comment: http://stackoverflow.com/comment/40836328
has comment: http://stackoverflow.com/comment/40627978
has comment: http://stackoverflow.com/comment/40830613
type: Answer
has comment: http://stackoverflow.com/comment/40830393
has comment: http://stackoverflow.com/comment/40831301
has comment: http://stackoverflow.com/comment/40835777

http://stackoverflow.com/a/25974948
upvote count: 1
answers question: http://stackoverflow.com/q/25974743
score: 1
downvote count: 0
has body: Your code definitely contains bug. Take a look on stat variable. It is null before try block and initialized there. But if KeeperException is thrown you arrive to the next line int id = stat.getVersion(); that throws NullPointerException because stat is still null. Now concerning the concurrency. As fat as I understand zk is a member of your class. In this case the code is incorrect too. Think about 2 threads. First evaluates line stat = zk.setData(), i.e. changes the state of zk. Second arrives to the same line and evaluates it too, i.e. changes the state of shared object zk according to its parameters. Then first thread calls zk.getVersion(), i.e. gets version according to the state that was set by thread 2. I cannot give you any recommendations about changing your code because I do not know what would you like to achieve. If you can explain your task in details you will probably get better recommendation how to implement it.
has comment: http://stackoverflow.com/comment/40673394
type: Answer

http://stackoverflow.com/comment/40675571
score: 1
comment on: http://stackoverflow.com/q/25976932
type: QuestionComment
has text: Why the `swt-awt` tag? And what's overkill about the `Checkboxgroup`? Please elaborate what exactly it is you need and how `Checkboxgroup` isn't a good fit to solve your problem.
type: Comment

http://stackoverflow.com/a/25880080
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/98703518
upvote count: 1
has body: You need to check if(key == a[mid]). If it is equal, you need to check if the last element in left portion is same until you find a different element. The following check should come before you branch left or right if (key == a[mid]) { while (--mid &gt;= 0) { if (key != a[mid]) { break; } } return ++mid; }
answers question: http://stackoverflow.com/q/25879983

http://stackoverflow.com/q/26003171
downvote count: 0
tagged with: jackson
favorite count: 0
has answer: http://stackoverflow.com/a/47474202
has body: Say I have a class class A { public int x; } Then a valid json can be parsed as follows: ObjectMapper mapper = new ObjectMapper(); A a = mapper.readValue("{\"x\" : 3}", A.class); Is there a way to have the parser fail if the string contains more data than necessary to parse the object? For example I would like the following to fail (which succeeds) A a = mapper.readValue("{\"x\" : 3} trailing garbage", A.class); I tried it using an InputStream with JsonParser.Feature.AUTO_CLOSE_SOURCE=false and checking whether the stream has been consumed completely, but that does not work: A read(String s) throws JsonParseException, JsonMappingException, IOException { JsonFactory f = new MappingJsonFactory(); f.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false); ObjectMapper mapper = new ObjectMapper(f); InputStream is = new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)); try { A a = mapper.readValue(is, A.class); if(is.available() &gt; 0) { throw new RuntimeException(); } return a; } finally { is.close(); } } that is, read("{\"x\" : 3} trailing garbage"); still succeeds, probably because the parser consumes more from the stream than strictly necessary. One solution that works is to verify that the parsing fails when dropping the last charachter from the string: A read(String s) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); A a = mapper.readValue(s, A.class); if (s.length() &gt; 0) { try { mapper.readValue(s.substring(0, s.length()-1), A.class); throw new RuntimeException(); } catch (JsonParseException e) { } } return a; } but I'm looking for a more efficient solution.
upvote count: 6
has answer: http://stackoverflow.com/a/26004135
tagged with: parsing
possible better answer: http://stackoverflow.com/a/47474202
accepted answer: http://stackoverflow.com/a/26026359
has comment: http://stackoverflow.com/comment/40753499
score: 6
type: AnsweredQuestion
has title: How to detect trailing garbage using Jackson ObjectMapper
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/26026359

http://stackoverflow.com/q/25968483
downvote count: 0
answer count: 1
tagged with: ical4j
favorite count: 0
has answer: http://stackoverflow.com/a/25970005
accepted answer: http://stackoverflow.com/a/25970005
tagged with: rfc5545
upvote count: 16
type: AnsweredQuestion
score: 16
type: Question
has body: I'm creating a sync adapter towards ICS files in Java, and I have a problem recognizing the same events across new updates towards a remote file which is dynamically created. So I thought, great I can just use the UID, it turns out it's randomly generated every time the ICS file is downloaded. So what is the point of UID property if it's randomly generated everytime? Why not just assume every ICS event that exists in the universe is unique? Is it the ICS file generators fault for not using the same UID for it's same events (I have seen 2 ICS file providers do this, 2 schools)? So what's the standard way of recognizing the same event across ICS file updates, instead of wiping the whole calendar and re-importing?
tagged with: java
tagged with: uid
tagged with: icalendar
has title: ICS (iCalendar) UID purpose and use

http://stackoverflow.com/a/26019206
type: Answer
upvote count: 13
accepted answer of: http://stackoverflow.com/q/26019132
downvote count: 1
answers question: http://stackoverflow.com/q/26019132
score: 12
has comment: http://stackoverflow.com/comment/117258374
type: AcceptedAnswer
has body: one another possibility: String lStr = "/storage/emulated/0/temp.jpg"; lStr = lStr.substring(lStr.lastIndexOf("/")+1); System.out.println(lStr);

http://stackoverflow.com/comment/40561774
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25913469
has text: this will directly update the database right ? I don't want to update it, since I am keeping the history, every new entry is a new insert. What I am trying to do is update the json, before doing a new insert. Also you're example doesn't append to any sub document.

http://stackoverflow.com/a/26004954
answers question: http://stackoverflow.com/q/25998312
has body: The central purpose of defining serialVersionUID is to control serialization compatibility. As other answers and the documentation has noted, unless a specific value is declared, the value is computed from a variety of class characteristics, even ones that don't actually affect the serialized form, such as the signatures of public methods. If you don't provide a serialVersionUID, and one or more of these characteristics of the class differs between serialization and deserialization, an InvalidClassException will be thrown. Now to the question of when one should or should not declare a serialVersionUID. If you care about serialization compatibility, you should almost always declare a serialVersionUID. Doing this is the only possible way to evolve the class and have the serialized form be compatible with other versions of the class. You will probably also have to provide custom readObject and writeObject methods and use various mechanisms like readFields, putFields, and serialPersistentFields to control the serialized format, and to cope with potential changes to the serialized format. By "care about serialization compatibility", suppose you've serialized an object and have stored it in a file or database. Do you expect to have future versions of your system (with evolved versions of the classes) be able to read the stored serialized objects? Or, suppose you serialize objects and send them over a network to other applications that deserialize them. This happens in RMI, or it could happen if you develop your own network protocol that sends and receive serialized objects. If so, then on your network, can you have different versions of your application running in different places on the network, and do you expect them to be able to talk to each other successfully? If any of the above are true, you care about serialization compatibility, and you need to declare serialVersionUID. There are times when you might care about serialization compatibility but when it doesn't make…
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/26011702
score: 1
answers question: http://stackoverflow.com/q/26011563
upvote count: 1
has body: if you have data with separators, you could use NumberFormat with locale ie NumberFormat.getNumberInstance(Locale.US).parse("22,959")
type: Answer
downvote count: 0

http://stackoverflow.com/a/26014153
score: 10
has body: I am very sceptical about treating Z just as literal. The char Z has a meaning, namely zero offset. The documentation of Joda-Time version 1.6 says about this code: String timestamp = "2014-09-23T23:03:11Z"; DateTime dt = ISODateTimeFormat.dateTimeNoMillis().parseDateTime(timestamp).withZone(DateTimeZone.UTC); System.out.println(dt); // 2014-09-23T23:03:11.000Z Returns a formatter that combines a full date and time without millis, separated by a 'T' (yyyy-MM-dd'T'HH:mm:ssZZ). The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. Now let's view at following four alternatives in detail (explicitly tested with version 1.6.2): String timestamp = "2014-09-23T23:03:11Z"; DateTimeZone utc = DateTimeZone.UTC; DateTime dt1 = ISODateTimeFormat.dateTimeNoMillis().parseDateTime(timestamp).withZone(utc); System.out.println(dt1); // 2014-09-23T23:03:11.000Z (OK) DateTime dt2 = new DateTime(timestamp, utc); System.out.println(dt2); // 2014-09-23T23:03:11.000Z (OK) DateTime dt3 = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'").parseDateTime(timestamp).withZone(utc); System.out.println(dt3); //2014-09-23T21:03:11.000Z (WRONG!!!) DateTime dt4 = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ").parseDateTime(timestamp).withZone(utc); // exception: Invalid format: "2014-09-23T23:03:11Z" is malformed at "Z" Conclusion: The other answers given so far treating Z as literal are wrong because the input is treated in local timezone, not with offset UTC+00:00. Use either the constructor or the specific class IsoDateTimeFormat (I would prefer latter one for clarity). About the exception: This is a bug solved with version 2.0, see release-notes. You should better update your library version. Allow 'Z' and 'ZZ' in format patterns to parse 'Z' as '+00:00' [2827359]
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/59384771
has comment: http://stackoverflow.com/comment/59378095
downvote count: 0
has comment: http://stackoverflow.com/comment/40758728
has comment: http://stackoverflow.com/comment/40777808
answers question: http://stackoverflow.com/q/26009841

http://stackoverflow.com/a/25990610
upvote count: 1
has comment: http://stackoverflow.com/comment/40701201
has comment: http://stackoverflow.com/comment/40701023
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40700942
downvote count: 0
has comment: http://stackoverflow.com/comment/40701221
has comment: http://stackoverflow.com/comment/40701176
answers question: http://stackoverflow.com/q/25990222
type: Answer
has comment: http://stackoverflow.com/comment/40701139
accepted answer of: http://stackoverflow.com/q/25990222
has body: [!?.]+(?=$|\s) Try this.You can add markers as needed.Replace by ``. See demo. http://regex101.com/r/lS5tT3/15

http://stackoverflow.com/q/25962529
answer count: 2
tagged with: for-loop
has title: Java program to add up the reciprocals of the integers up to number n
tagged with: floating-point-precision
accepted answer: http://stackoverflow.com/a/25962548
favorite count: 0
has body: I tried to do it but i'm getting 1.0 as answer every time i run it. I'm not being able to find out what's wrong please help me. Here are the codes: import java.util.Scanner; public class Number23 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n=0; float sum = 0,r = 0; System.out.print("Enter a number for n: "); n = input.nextInt(); for(int x = 1; x &lt;= n; x++) { r = (1/x); sum = sum + r; } System.out.print("The sum is "+sum); } }
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25962548
possible better answer: http://stackoverflow.com/a/29860250
has answer: http://stackoverflow.com/a/29860250

http://stackoverflow.com/q/25902538
answer count: 2
has title: Can I make a copy of a scanner?
score: 0
type: UnansweredQuestion
tagged with: parameters
has comment: http://stackoverflow.com/comment/40542215
tagged with: java
has answer: http://stackoverflow.com/a/25903701
has body: I have a method that takes a scanner in as a parameter and I would like to copy it so I can use it twice. Is that possible? I'm sorry I'm new to this website. Is this an all java website? because thats what I'm using.
tagged with: methods
has answer: http://stackoverflow.com/a/25903274
type: Question

http://stackoverflow.com/a/25912887
answers question: http://stackoverflow.com/q/25912560
type: Answer
has comment: http://stackoverflow.com/comment/40560676
has comment: http://stackoverflow.com/comment/40561197
has body: Its a long time ago I programmed java. But I think its because you're using only one |. I'm not sure but I thought java needs two |. So your first if will be: if (chooseOperation.equals("A") || chooseOperation.equals("a")) { }
score: 0
has comment: http://stackoverflow.com/comment/40560777

http://stackoverflow.com/q/25901135
tagged with: java
possible better answer: http://stackoverflow.com/a/25901857
type: Question
answer count: 2
downvote count: 0
has body: I am currently writing an Android app with a completely full screen experience (the system bar and navigation bar are not displayed until the user swipes down) for a Nexus 7 tablet. For some reason, when I switch activities, the navigation bar reappears briefly. To create the full screen effect, I set to the system UI visibility to predetermined options in each activity's onResume(), register a UI change listener, and register a window focus listener. UI Options private View decorView = getWindow().getDecorView(); private int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; Setting the System UI Visibilility in onResume() @Override protected void onResume() { super.onResume(); decorView.setSystemUiVisibility(uiOptions); } Setting the System UI Visibility When the UI Changes decorView.setOnSystemUiVisibilityChangeListener ( new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int pVisibility) { if ((pVisibility &amp; View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { decorView.setSystemUiVisibility(uiOptions); } } }); Setting the System UI Visibility When the Window Has Focus @Override public void onWindowFocusChanged(boolean pHasFocus) { super.onWindowFocusChanged(pHasFocus); if(pHasFocus) { decorView.setSystemUiVisibility(uiOptions); } } All of the things above are done in each activity of the application to ensure that the navigation bar and status bar are hidden when a keyboard goes away, an activity is resumed, etc. But, I still have the problem of the navigation bar appearing briefly when I switch between activities. Any help is greatly appreciated! Thank you.
linked to: http://stackoverflow.com/q/10086371
has answer: http://stackoverflow.com/a/25902520
tagged with: android
favorite count: 0
accepted answer: http://stackoverflow.com/a/25902520
linked to: http://stackoverflow.com/q/32492441
tagged with: nexus-7
upvote count: 1
has answer: http://stackoverflow.com/a/25901857
type: AnsweredQuestion
has title: Navigation bar appears briefly when switching activites
score: 1

http://stackoverflow.com/a/25903078
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25902545
has body: Well, in order to understand that you have to look after the bytecode of such a class. In order to clarify I've created a test class as follow: switch(c){ case 1: String temp = "first"; System.out.println(temp); break; case 2: temp = "second"; System.out.println(temp); break; case 3: String temp2 = "third"; System.out.println(temp2); } Using the javap to generate the bytecode, we get the following LocalVariableTable: LocalVariableTable: Start Length Slot Name Signature 0 65 0 args [Ljava/lang/String; 2 63 1 c I 31 10 2 temp Ljava/lang/String; 44 10 2 temp Ljava/lang/String; 57 7 3 temp2 Ljava/lang/String; What that table of local variables tell us is: There is a variable of type String named temp which has a valid context from instruction 31 to 41 (31 + 10) There is a another variable of type String named temp which has a valid context from instruction 44 to 54 (44 + 10) There is another variable of type String named temp2 which has a valid context from 57 to 64 (57 + 7) So, the compiler does not treated the whole switch block as one scope, it did created two distinct scopes for the "String temp" variable. If you try another example, as the source code bellow: //first scope { String myLocal = "first"; System.out.println(myLocal); } //second scope { String myLocal = "second"; System.out.println(myLocal); } The respective bytecode points to the following LocalVariableTable: LocalVariableTable: Start Length Slot Name Signature 67 7 2 myLocal Ljava/lang/String; 77 7 2 myLocal Ljava/lang/String; What shows that two scopes was created for variable myLocal of type String. Exactly the same way it created for the switch statement. In your case the switch statement just use a LocalVariableTable which has a scope that covers the whole switch statement, that is the main reason you can set a String declared outside the switch. The code bellow illustrate that: int c = 5; String temp = null; switch(c){ case 1: temp = "first"; System.out.println(temp); break; case 2: temp = "second…
downvote count: 0

http://stackoverflow.com/a/29470713
has comment: http://stackoverflow.com/comment/54154448
answers question: http://stackoverflow.com/q/25909611
has comment: http://stackoverflow.com/comment/95565341
score: 80
has comment: http://stackoverflow.com/comment/104288127
has body: This is late answer. But may help to other. If you are using Maven based project. You just include following code in pom.xml file. It can be resolved. maven-compiler-plugin 1.7 1.7 Update: Similarly if you are using jdk version 1.8 just include it in your and tags.
type: Answer
upvote count: 80
downvote count: 0

http://stackoverflow.com/a/25937059
type: Answer
answers question: http://stackoverflow.com/q/25936890
accepted answer of: http://stackoverflow.com/q/25936890
upvote count: 27
type: AcceptedAnswer
downvote count: 0
score: 27
has body: I don't see an array anywhere in your code, so that's maybe why the try block isn't catching anything (I assume there is an array in one of the called methods?). Also, you really, really shouldn't allow your program to read outside the bounds of an array. That's just bad design. That being said, here is how you would catch the exception in the clearest way I can think of: try { array[index] = someValue; } catch(ArrayIndexOutOfBoundsException exception) { handleTheExceptionSomehow(exception); } Or do as @Peerhenry suggests and just throw a new Exception if the indices aren't correct, which would be a much better design.

http://stackoverflow.com/comment/40644496
type: Comment
type: QuestionComment
has text: Normally I will just use @Produces({"application/xml"}) to get xml output. But now I want to get Json file. So I change it to @Produces({"application/json"})... which lead to the error. The request should come out the empID, Name and the email.
score: 0
comment on: http://stackoverflow.com/q/25957818

http://stackoverflow.com/comment/40680919
score: 0
type: QuestionComment
type: Comment
has text: FYI - code snippets are only able to be run with Javascript. What you have there is Java.
comment on: http://stackoverflow.com/q/25979748

http://stackoverflow.com/comment/43538316
type: Comment
has text: I'm not confident enough in claiming this to put it as an answer, but: Is it not possible to do `TestEnum notAValidEnum = Mockito.mock(TestEnum.class);`, and then feed it to `WorkTheEnum()`...?
type: QuestionComment
comment on: http://stackoverflow.com/q/25929351
score: 0

http://stackoverflow.com/q/26010906
has comment: http://stackoverflow.com/comment/40737544
upvote count: 0
has comment: http://stackoverflow.com/comment/40737650
tagged with: nullpointerexception
type: Question
type: AnsweredQuestion
has body: So i have a bit of a weird issue, i just posted and fixed my other error, but that seems to have created this one, and it makes no sense. Basically, the user presses a button, this window opens, then whether he presses cancel, or register, this window should setVisible to false. but when this code gets executed, it says my window is null. package frontend; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.SQLException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; public class Registration extends JFrame { /** * */ private static final long serialVersionUID = 1L; private static boolean ranOnce = false; private JPanel contentPane; private Registration reg; private JTextField userTF; private JTextField passTF; private JTextField emailTF; private LoginProcess lp = new LoginProcess(); private JLabel error; private JButton cancelBtn; /** * Create the frame. */ public Registration() { if (!ranOnce) { EventQueue.invokeLater(new Runnable() { public void run() { try { reg = new Registration(); reg.setVisible(true); ranOnce = true; } catch (Exception e) { e.printStackTrace(); } } }); } setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 245, 212); setLocationRelativeTo(null); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblUsername = new JLabel("Username:"); lblUsername.setBounds(10, 11, 75, 14); contentPane.add(lblUsername); JLabel lblPassword = new JLabel("Password:"); lblPassword.setBounds(10, 36, 75, 14); contentPane.add(lblPassword); JLabel lblEmail = new JLabel("Email:"); lblEmail.setBounds(10, 61, 75, 14); contentPane.add(lblEmail); userTF = new JTextField(); userTF.setBounds(95, 8, 130, 20); contentPane.add(userTF); userTF.setColumns(10); passTF = new JTextF…
favorite count: 0
possible better answer: http://stackoverflow.com/a/26011349
has title: Frame active, but setting visible to false = nullpointer
has comment: http://stackoverflow.com/comment/40737481
has comment: http://stackoverflow.com/comment/40738358
has answer: http://stackoverflow.com/a/26011349
downvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/40737480
score: -2
has answer: http://stackoverflow.com/a/26011661
tagged with: java
has comment: http://stackoverflow.com/comment/40737595
accepted answer: http://stackoverflow.com/a/26011661

http://stackoverflow.com/q/26020839
tagged with: android-drawable
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26114862
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26336321
has body: I create an additional method: public boolean exampleEdTxt1(){ try{ solo.getCurrentActivity().getResources().getDrawable(R.drawable.action_drw); return true; } catch(AssertionError e){ return false; } } But, when test is runing, code assertTrue(exampleEdTxt1()); always returns success and code assertFalse(exampleEdTxt1()); always returns fail. How to check from Robotium that my png is present on the screen?
favorite count: 0
has title: How to check from Robotium that my png is present on the screen?
tagged with: android
type: UnansweredQuestion
upvote count: 1
tagged with: robotium
type: Question

http://stackoverflow.com/comment/40510713
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25885260
type: QuestionComment
has text: `it is possible to do this with boolean expressions`!!! well you can do it with `for` loops and other general (meaning unclear) statements also but either of them provide any real information.

http://stackoverflow.com/a/25960858
score: 0
type: Answer
has body: A parent class can be a subclass, being a parent class just entails that it has a subclass. For instance, JComponent is a subclass of Object, but it's still a parent class, because of its subclasses. For instance, looking here, we see: java.lang.Object extended by java.awt.Component extended by java.awt.Container extended by javax.swing.JComponent so JComponent is a subclass. But it also is a parent for classes such as AbstractButton, BasicInternalFrameTitlePane, Box, and so on.
answers question: http://stackoverflow.com/q/25960818

http://stackoverflow.com/comment/40694467
type: Comment
has text: Thanks for your response. I can work around that code. Would I add it under mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mlocListener); under onCreate?
comment on: http://stackoverflow.com/a/25986509
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40581848
comment on: http://stackoverflow.com/a/25924164
score: 0
type: AnswerComment
type: Comment
has text: Or just use `Scanner#nextInt()`.

http://stackoverflow.com/a/25881729
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/40510708
type: AcceptedAnswer
downvote count: 0
has body: The below regex would allow one or more alphanumeric characters, ^[A-Za-z0-9]+$ Your regex [^a-zA-Z0-9], matches a single character but not of a alphanumeric character. [^..] called negated character class which do the negation of chars which are present inside that character class. You don't need to give start or end anchors in the regex when it is passed to matches method. So [A-Za-z0-9]+ would be enough. Explanation: ^ Anchor which denotes the start. [A-Za-z0-9]+ , + repeats the preceding token [A-Za-z0-9] one or more times. $ End of the line.
accepted answer of: http://stackoverflow.com/q/25881697
has comment: http://stackoverflow.com/comment/40510159
answers question: http://stackoverflow.com/q/25881697
type: Answer
has comment: http://stackoverflow.com/comment/40510034

http://stackoverflow.com/a/25997776
type: Answer
has body: As @ChrisK suggests, you could simplify by just making a direct call to System.currentTimeMillis(). For example: long time = 0; do { time = System.currentTimeMillis(); } while (time % 5000 != 0); Note that you need to change the comparison value to 5000 because the representation of the time is in milliseconds. Also, there are possible pitfalls to doing any comparison so directly like this, as the looping call depends on processor availability and whatnot, so there is a chance that an implementation such as this could make one call that returns: `1411482384999` And then the next call in the loop return `1411482385001` Meaning that your condition has been skipped by virtue of hardware availability. If you want to use a built in scheduler, I suggest looking at the answer to a similar question here java: run a function after a specific number of seconds
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25997498

http://stackoverflow.com/comment/40641380
type: Comment
type: AnswerComment
has text: @Addi: Why don't you just use an array of characters, AKA the String you already have?
comment on: http://stackoverflow.com/a/25958255
score: 0

http://stackoverflow.com/a/25942488
has comment: http://stackoverflow.com/comment/40739938
has comment: http://stackoverflow.com/comment/40720839
type: Answer
has body: Use an enum form the bit positions. The ordinal() gives the index, the getName() the string presentation, and the static valueOf(String) the parsing from String to enum. enum Field { TYPE, SIDE, QUANTITY, PRICE, ..., TIF; public static COUNT = values().length; } When using a BitSet with the enum: BitSet fieldPresences = new BitSet(Field.COUNT); fieldPresences.set(Field.QUANTITY.ordinal(), true); Field field = Field.valueOf("QUANTITY"); However you can better use EnumSet which is as efficient too: Set&lt;Field&gt; presentFields = EnumSet&lt;Field&gt;.of(Field.TYPE, Field.PRICE); Alternative to code given later in the question: The code is fine enough. I have used PresenceMapCodec which can be given any enum class. PresenceMapCodec&lt;Fields&gt; codec = new PresenceMapCodec&lt;Fields&gt;(Fields.class); String userInput = "ClientOrderID,SubmittingBrokerID,SecurityIDSource," + "TransactionTime,OriginalClientOrderID,OrderID,OrderCapacity"; Set&lt;Fields&gt; fieldset = codec.encode(userInput); String decodedValue = codec.decode(fieldset); public enum Fields { ClientOrderID, SubmittingBrokerID, SecurityID, SecurityIDSource, SecurityExchange, BrokerLocationID, TransactionTime, Side, OriginalClientOrderID, OrderID, OwningBrokerID, OrderType, Price, OrderQuantity, TIF, PositionEffect, OrderRestrictions, MaxPriceLevels, OrderCapacity, Text, ExecutionID } public class PresenceMapCodec&lt;E extends Enum&lt;E&gt;&gt; { private final Class&lt;E&gt; enumClass; public PresenceMapCodec(Class&lt;E&gt; enumClass) { this.enumClass = enumClass; } public String decode(Set&lt;E&gt; fieldset) { StringBuilder sb = new StringBuilder(); for (E field : fieldset) { sb.append(field.name()).append(','); } if (sb.length() != 0) { sb.setLength(sb.length() - 1); // Remove trailing comma. } return sb.toString(); } public Set&lt;E&gt; encode(String value_) { Set&lt;E&gt; results = EnumSet.noneOf(enumClass); StringTokenizer st = new StringTokenizer(value_, ","); while (st.hasMoreTokens()) { String token…
answers question: http://stackoverflow.com/q/25940936
has comment: http://stackoverflow.com/comment/40703451
has comment: http://stackoverflow.com/comment/40630874
has comment: http://stackoverflow.com/comment/40665221
score: 0
has comment: http://stackoverflow.com/comment/40682453

bitmap
tags question: http://stackoverflow.com/q/26012556
tags question: http://stackoverflow.com/q/25877515
type: Tag
tags question: http://stackoverflow.com/q/26016655
tag name: bitmap
tags question: http://stackoverflow.com/q/25993095
tags question: http://stackoverflow.com/q/25933059
tags question: http://stackoverflow.com/q/25887806

http://stackoverflow.com/comment/40702393
type: QuestionComment
has text: It will greatly simplify what you are doing. Spring AMQP provides a [implementation for Log4j](http://docs.spring.io/spring-amqp/docs/current/api/org/springframework/amqp/rabbit/log4j/AmqpAppender.html) (and I just registered [an issue](https://jira.spring.io/browse/AMQP-428) for a Logback one :) ).
comment on: http://stackoverflow.com/q/25991191
type: Comment
score: 1

http://stackoverflow.com/comment/40701166
comment on: http://stackoverflow.com/a/25990355
type: AnswerComment
score: 0
has text: `how can i use file and write in file? `. You cannot. You are misinformed.
type: Comment

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/25898030
type: Tag
tags question: http://stackoverflow.com/q/26027817
tags question: http://stackoverflow.com/q/26005681
tags question: http://stackoverflow.com/q/26021150
tags question: http://stackoverflow.com/q/25930766
tags question: http://stackoverflow.com/q/25985525
tags question: http://stackoverflow.com/q/25878029
tags question: http://stackoverflow.com/q/25961122

http://stackoverflow.com/comment/40601361
type: QuestionComment
comment on: http://stackoverflow.com/q/25932980
has text: Huh, I was going to say that same thing but then I did some tests and couldn't get it to fail that way. Turns out I was testing a newer version of java than I thought. Yeah, that's probably the problem.
score: 0
type: Comment

http://stackoverflow.com/q/26012093
answer count: 1
downvote count: 0
score: 1
tagged with: awt
has answer: http://stackoverflow.com/a/26027550
favorite count: 0
upvote count: 1
tagged with: swing
has title: AWT paints only last-added Canvas
type: AnsweredQuestion
has body: I've a VERY simple AWT Painting. Just playing aound to make something bigger. But can't get it working ... What happens is that only elypse2 is shown - regardless of repaint()ing it or not. I also tried to use Swing components instead of AWT (JFrame, JComponent) but this also changes nothing. Is using a Layout Manager necessary? But I want to draw only graphical components, like arcs, rectangles, line, poly-lines, aso ... Here's the main(): public static void main(String[] args) { Frame testFrame = new Frame("Grafx-Test"); testFrame.setSize(300, 200); testFrame.setAlwaysOnTop(true); java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { testFrame.setVisible(true); } }); Elypse elypse = new Elypse(new Point(70, 80), 30, 30, Color.BLUE, false); testFrame.add(elypse); Elypse elypse2 = new Elypse(new Point(70, 50), 50, 30, Color.BLUE, true); testFrame.add(elypse2); } and here the used class: public class Elypse extends Canvas { private Point start; private int width; private int height; private Color c; private boolean filled; public Elypse(Point start, int width, int height, Color c, boolean filled) { this.start = start; this.width = width; this.height = height; this.c = c; this.filled = filled; } @Override public void paint(Graphics g) { g.setColor(c); if (filled) { g.fillOval(start.x, start.y, width, height); } else { g.drawOval(start.x, start.y, width, height); } } }
has comment: http://stackoverflow.com/comment/40743524
accepted answer: http://stackoverflow.com/a/26027550
tagged with: java
linked to: http://stackoverflow.com/q/3538082
type: Question

http://stackoverflow.com/a/25987530
downvote count: 0
has comment: http://stackoverflow.com/comment/40695406
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40695363
upvote count: 2
answers question: http://stackoverflow.com/q/25987446
has body: This work perfectly fine for me. import java.util.UUID; public class Test { public static void main(String[] args) { String uuid = UUID.randomUUID().toString(); System.out.println(uuid); } } Output 766dedf1-a8cd-4572-a01f-c99b5cd45c50 On Pushpa request public class Test { public static void main(String[] args) { String uuid = UUID.randomUUID().toString(); long value = UUID.randomUUID().getMostSignificantBits(); System.out.println(value); String val = String.valueOf(value); System.out.println(val); System.out.println(uuid); } } output 4421583623795395631 4421583623795395631 868b5b0f-92d8-44ca-89c1-d93e98187262

http://stackoverflow.com/q/25966504
has body: I very new to java language: I want to know if I want to how I can check the input value of text filed and verify it. If it is verified then insert to data base but if it is not verified do not do any actions. just show error message. Another question is that: one of my field is ID and i want to define an ID as a unique number. here is my code:
type: Question
has answer: http://stackoverflow.com/a/25966603
has comment: http://stackoverflow.com/comment/40656820
upvote count: 0
answer count: 1
favorite count: 0
has title: Verify JtextFiled in java Swing
accepted answer: http://stackoverflow.com/a/25966603
has comment: http://stackoverflow.com/comment/40656962
tagged with: swing
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: jtextfield

http://stackoverflow.com/q/25906676
favorite count: 0
tagged with: ibm-mq
accepted answer: http://stackoverflow.com/a/25908109
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25908109
has body: Let's take this code snippet as a starting point: import com.ibm.mq.MQEnvironment; import com.ibm.mq.MQException; import com.ibm.mq.MQGetMessageOptions; import com.ibm.mq.MQMessage; ... int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF; MQQueue queue = qMgr.accessQueue(qName, openOptions); ... MQMessage rcvMessage = new MQMessage(); MQGetMessageOptions gmo = new MQGetMessageOptions(); queue.get(rcvMessage, gmo); Now I want to get the message type and the reply to queue manager for example. It can't be too hard but I did not find anything on how to do that.
has title: How to read values out of the WebSphrere MQ MQMD header with the IBM MQ libraries
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/40715463
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25998674
type: AnswerComment
has text: The answer is pretty commented so the OP can perfectly understand what's going on and not just copy paste the code. Also the OP is not a 1rep user. Quite obvious he has some knowledge and can see the logic behind the code.

http://stackoverflow.com/comment/40735818
score: 1
has text: @KickButtowski that's how you specify a literal character `T` in the pattern, instead of indicating a type of field to the formatter.
comment on: http://stackoverflow.com/q/26009841
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25987222
has comment: http://stackoverflow.com/comment/40695629
score: 0
has body: public class Loops { public static void main ( String[] args ) { int oddNumber = 1; int totalOdd = 0; int evenNumber = 2; int totalEven = 0; while ( oddNumber &lt;= 25 ) { totalOdd = totalOdd + oddNumber; oddNumber = oddNumber + 2; } System.out.printf ( "Total sum of the odd number is %d\n", totalOdd); while (evenNumber &lt;= 50) { totalEven = totalEven + evenNumber; evenNumber = evenNumber + 2; } System.out.printf ( "Total sum of the even number is %d\n", totalEven); } } Quick question, it says 1-25 and 1-50, does that include 25 and 50, or exclude 25 and 50??? If it's excluding, code is fine as is, else, change the &lt; into &lt;= for the 2 while loops. Your question was difficult to understand so let me know if this is what you were looking for! I added the 2 new variables, totalOdd and totalEven to capture the totals of the odds and evens. Before, you were just returning the value of the odd and even number at top, namely, 25 and 50. And the way you got there didn't make sense either, you were just adding by 2 on the odd and even trail until you got to the desired number that would stop the while loop. You weren't even tracking the number of iterations. So I changed the code to just add up every number from 1- 25 that's odd and every number 1-50 that's even, and displayed the results. If anything don't make sense, just ask. ---EDIT--- You said 25 and 50 ARE included, in which case, I have now updated the while loops to include the end numbers.
has comment: http://stackoverflow.com/comment/41002426
type: Answer
has comment: http://stackoverflow.com/comment/40695729
answers question: http://stackoverflow.com/q/25987137
accepted answer of: http://stackoverflow.com/q/25987137
has comment: http://stackoverflow.com/comment/40695934
type: AcceptedAnswer

http://stackoverflow.com/q/25877978
has answer: http://stackoverflow.com/a/25878153
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/40497989
has comment: http://stackoverflow.com/comment/40498568
tagged with: oop
has comment: http://stackoverflow.com/comment/40497897
tagged with: java
has comment: http://stackoverflow.com/comment/40497880
has comment: http://stackoverflow.com/comment/40498541
has body: Is it possible to modify or extend the content of a method of an abstract class? public abstract class MainClass{ public void func(){ // content... } } public class FirstClass extends MainClass{ public void func(){ // content from MainClass // own content } } public class SecondClass extends MainClass{ public void func(){ // content from MainClass // other content } } I need the method func in both classes, but with a small modification.
answer count: 4
has title: Modifying abstract method
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25878400
tagged with: abstract-class
has answer: http://stackoverflow.com/a/25879210
has answer: http://stackoverflow.com/a/25878002
score: 1
favorite count: 0

http://stackoverflow.com/comment/40530619
has text: Restore ./metadata from backup?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25896044
score: 0

http://stackoverflow.com/a/25934603
has comment: http://stackoverflow.com/comment/40611343
type: Answer
has body: EDIT: http://ideone.com/zHX7NI import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here factor_transitivity(new HashMap&lt;String,String&gt;(){{ put("abc","abc"); put("ghi","ghi"); }},false ); } private static void factor_transitivity(Map&lt;String,String&gt; dataset, boolean complete) { if (!complete) { complete = true; // Assume that on this check everything will come out to be OK. for (Map.Entry&lt;String, String&gt; pair : dataset.entrySet()) { if (dataset.containsKey(pair.getValue())) { complete = false; String value = dataset.get(pair.getValue()); dataset.put(pair.getKey(),value); System.out.print("hello"); break; } } factor_transitivity(dataset, complete); } } } Now you can see this code being recursive it keeps calling the factor_transitivity method and printing "hello" again and again. Even when I comment out the line the same error occurs(http://ideone.com/ffA0pG) due to the recursive nature of the method.
upvote count: 0
has comment: http://stackoverflow.com/comment/40611853
downvote count: 1
has comment: http://stackoverflow.com/comment/40612754
score: -1
answers question: http://stackoverflow.com/q/25934463

http://stackoverflow.com/comment/40699620
type: AnswerComment
comment on: http://stackoverflow.com/a/25977686
type: Comment
has text: Hi Axel, i am using mysql and this problem i am getting from getting started tutorial.
score: 0

string-utils
tags question: http://stackoverflow.com/q/25945854
type: Tag
tag name: string-utils

http://stackoverflow.com/comment/40545362
score: 0
type: AnswerComment
type: Comment
has text: normally you would be right, but since he is using Spring MVC, spring is able to show jsp files inside web-inf, and it's actually done a lot in their examples. Spring has a filter that intercepts the request, and determines where to get the view from. His view resolver is configured to get it from within web-inf, which is perfectly fine since the access is coming through the filter, in other words, not accessed directly by http request.
comment on: http://stackoverflow.com/a/25904352

http://stackoverflow.com/q/25936369
type: UnansweredQuestion
tagged with: excel
tagged with: data-distribution-service
score: 3
upvote count: 3
tagged with: java
has body: I'm looking at the RTI DDS add-in for Excel, and I'm trying to rewrite the Hello_simple HelloPublisher.java example that comes with it to publish a string, and get Excel to pick it up. Everything works, apart from displaying the value of the string I feed it. (It picks up the time the message was sent, and all the other meta-data just fine) My code looks something like this: public class Publish { public static void main(final String[] args){ // Create the DDS Domain participant on domain ID 123 final DomainParticipant participant = DomainParticipantFactory.get_instance().create_participant( 123, //Domain ID DomainParticipantFactory.PARTICIPANT_QOS_DEFAULT, null, // Listener StatusKind.STATUS_MASK_NONE); if (participant == null) { System.err.println("Unable to create domain participant"); return; } // Create the topic "Message" for the String type final Topic topic = participant.create_topic( "Message", StringTypeSupport.get_type_name(), DomainParticipant.TOPIC_QOS_DEFAULT, null, // listener StatusKind.STATUS_MASK_NONE); if (topic == null) { System.err.println("Unable to create topic."); return; } // Create the data writer using the default publisher final StringDataWriter dataWriter = (StringDataWriter) participant.create_datawriter( topic, Publisher.DATAWRITER_QOS_DEFAULT, null, // listener StatusKind.STATUS_MASK_NONE); if (dataWriter == null) { System.err.println("Unable to create data writer\n"); return; } System.out.println("Ready to write data."); System.out.println("When the subscriber is ready, you can start writing."); System.out.print("Press CTRL+C to terminate or enter an empty line to do a clean shutdown.\n\n"); final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try { while (true) { System.out.print("Please type a message&gt; "); final String value = reader.readLine(); if (value == null) {break;} dataWriter.write(value, InstanceHandle_t.HANDLE_NIL); if (value.equals("")) { break; } } } catch (final IOException e) {e.print…
has title: Reading RTI DDS data generated in Java in Excel
has comment: http://stackoverflow.com/comment/40611080
type: Question
has comment: http://stackoverflow.com/comment/40617825
downvote count: 0
favorite count: 0
answer count: 0

http://stackoverflow.com/q/25887729
possible better answer: http://stackoverflow.com/a/25888633
favorite count: 0
has answer: http://stackoverflow.com/a/25888633
has answer: http://stackoverflow.com/a/25888124
accepted answer: http://stackoverflow.com/a/25888124
score: 2
has title: Spring Context Initialization fails
upvote count: 2
has comment: http://stackoverflow.com/comment/40514849
tagged with: spring-data
tagged with: spring
type: AnsweredQuestion
has body: I'm pretty much stucked and I hope you guys can help me out. Somehow I can't manage to get my spring context initialized. I have these nice Bean Configuration classes: @Configuration public class CoreConfig { @Bean public TeamService createService(TeamPersistenceService teamPersistenceService) { return new TeamEventHandler(teamPersistenceService); } } And this one: @Configuration @EnableJpaRepositories(basePackages = "de.ktv.persistence.repository", // includeFilters = @ComponentScan.Filter(value = { TeamsRepository.class }, type = FilterType.ASSIGNABLE_TYPE)) @EnableTransactionManagement public class PersistenceConfig { @Bean public TeamPersistenceService createService(TeamsRepository repository) { return new TeamPersistenceEventHandler(repository); } } And in this test I want to use them: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { CoreConfig.class, PersistenceConfig.class }) public class CoreIntegrationTest { @Autowired TeamService teamService; @Test public void addNewTeamToTheSystem() { //some test } The PersistenceConfig.class I am using in a different test and it works fine. But somehow here combined with CoreConfig.class it fails to initialize. That is the error I get: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [de.ktv.core.services.TeamService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} I would really appreciate any help/hint.Thanks!
has comment: http://stackoverflow.com/comment/40514914
tagged with: java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/40523987
has text: No. It's not possible in Java and it's not possible in C++.
comment on: http://stackoverflow.com/q/25892659
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25884362
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25884250
type: Answer
has body: Without further information you have to rely on conjecture to form an IP address from a variable length string. You should disallow that and ensure that your string is 12 characters long. Once you've formed a candidate IP address though, you can validate it using the following regular expression (using String.matches) \b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\. (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\. (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\. (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

log4j
tags question: http://stackoverflow.com/q/26015004
tags question: http://stackoverflow.com/q/25919653
tags question: http://stackoverflow.com/q/26007178
tags question: http://stackoverflow.com/q/26005149
tags question: http://stackoverflow.com/q/25971598
tags question: http://stackoverflow.com/q/25980058
tags question: http://stackoverflow.com/q/25976120
tags question: http://stackoverflow.com/q/25940842
tags question: http://stackoverflow.com/q/26023683
tag name: log4j
tags question: http://stackoverflow.com/q/25891737
tags question: http://stackoverflow.com/q/25875881
tags question: http://stackoverflow.com/q/25986614
tags question: http://stackoverflow.com/q/25926532
tags question: http://stackoverflow.com/q/25997556
tags question: http://stackoverflow.com/q/25877102
tags question: http://stackoverflow.com/q/25921723
tags question: http://stackoverflow.com/q/25994710
tags question: http://stackoverflow.com/q/25993787
tags question: http://stackoverflow.com/q/25896998
tags question: http://stackoverflow.com/q/25911236
type: Tag
tags question: http://stackoverflow.com/q/25885758
tags question: http://stackoverflow.com/q/25907687
tags question: http://stackoverflow.com/q/25994279
tags question: http://stackoverflow.com/q/25935836

http://stackoverflow.com/a/26006613
answers question: http://stackoverflow.com/q/26006598
type: Answer
downvote count: 0
score: 1
has body: protected members in Java are also visible to other classes in the package. Move your main() method to a different package and you'll get an error.
has comment: http://stackoverflow.com/comment/40730027
upvote count: 1

http://stackoverflow.com/q/25916796
has comment: http://stackoverflow.com/comment/40567993
answer count: 1
downvote count: 0
tagged with: inheritance
score: 27
has comment: http://stackoverflow.com/comment/46350277
tagged with: rest
tagged with: jax-rs
favorite count: 0
tagged with: annotations
type: AnsweredQuestion
has body: I am using JAX-RS for my web services. I have common functionality and would like to use inheritance. I am providing simple CRUD operations. I have defined an interface like so: public interface ICRUD { @POST @Consumes("application/json") @Produces("application/json") @Path("create") public String createREST(String transferObject); @GET @Consumes("application/json") @Produces("application/json") @Path("retrieve/{id}") public String retrieveREST(@PathParam("id") String id); @POST @Consumes("application/json") @Produces("application/json") @Path("update") public void updateREST(@Suspended final AsyncResponse asyncResponse, final String transferObject) ; @DELETE @Consumes("application/json") @Produces("application/json") @Path("delete/{id}") public String deleteREST(@PathParam("id") String id); } I have an abstract class that implements this interface: public abstract class BaseREST implements ICRUD{ private final ExecutorService executorService = Executors.newCachedThreadPool(); @Override public String createREST(String transferObject) { return create(transferObject).toJson(); } @Override public String retreiveREST(@PathParam("id") String id) { return retreive(id).toJson(); } @Override public String deleteREST( @PathParam("id") String id) { return delete(id).toJson(); } @Override public void updateREST(@Suspended final AsyncResponse asyncResponse, final String transferObject) { executorService.submit(new Runnable() { @Override public void run() { asyncResponse.resume(doUpdateREST(transferObject)); } }); } } And lastly, my implementing class simply provides a PATH for the resource: @Path("meeting") public class MeetingRestServices extends BaseREST { } When I try to access my resource at (assuming the context root is /): http://localhost:8080/webresources/meeting/retreive/0 I get a 404, it says it can not find it. My thoughts are that somewhere in the inheritance, it is messing with the path of where I think the resource should be. Any thoughts on this? EDIT webresource…
tagged with: java
has title: Inheritance with JAX-RS
linked to: http://stackoverflow.com/q/5875772
has answer: http://stackoverflow.com/a/25924310
accepted answer: http://stackoverflow.com/a/25924310
type: Question
upvote count: 27
has comment: http://stackoverflow.com/comment/40568083

http://stackoverflow.com/comment/40510379
has text: What's your expected output?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25885095

http://stackoverflow.com/q/26028833
favorite count: 0
has title: Java Physics loop (repaint on interval) is choppy unless mouse is moving
type: UnansweredQuestion
tagged with: animation
has body: I have a simple physics loop that does a calculation for a time interval, waits for the interval to pass, and then renders the results on the screen. It's very simple code (even though the timing is probably wrong, but that's exactly what I'm trying to learn about) and works well when I am moving the mouse around the screen. package physicssim; import java.awt.Graphics; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JPanel; public class PhysicsSim extends JFrame { private static class PhysicsObject { public PhysicsObject(double x, double y, double v_x, double v_y) { this.x = x; this.y = y; this.v_x = v_x; this.v_y = v_y; } public double x; public double y; public double v_x; public double v_y; } PhysicsObject particle; boolean running = true; DrawPane drawPane; public PhysicsSim() { particle = new PhysicsObject(10,10, .1, .2); drawPane = new DrawPane(particle); this.setSize(800,600); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setContentPane(drawPane); this.setVisible(true); } private static class DrawPane extends JPanel { PhysicsObject p; public DrawPane(PhysicsObject p) { this.p = p; } @Override public void paint(Graphics g) { super.paint(g); //To change body of generated methods, choose Tools | Templates. g.fillOval((int)p.x, (int) p.y, 10, 10); } } public void start() { int FPS = 60; long TIME_BETWEEN_FRAMES_NS = 1000000000/FPS; // Initial draw drawPane.repaint(); long lastDrawTime = System.nanoTime(); while(running) { // Update physics particle.x+=particle.v_x*(TIME_BETWEEN_FRAMES_NS*.0000001); particle.y+=particle.v_y*(TIME_BETWEEN_FRAMES_NS*.0000001); // While there is time until the next draw wait while(TIME_BETWEEN_FRAMES_NS &gt; (System.nanoTime()-lastDrawTime)) { try { Thread.sleep(1); } catch (InterruptedException ex) { Logger.getLogger(PhysicsSim.class.getName()).log(Level.SEVERE, null, ex); } } drawPane.repaint(); long currentTime = System.nanoTime(); System.out.println(curre…
has comment: http://stackoverflow.com/comment/40775774
tagged with: paint
has answer: http://stackoverflow.com/a/26029175
score: 1
has comment: http://stackoverflow.com/comment/40771304
tagged with: java
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/40775891
has comment: http://stackoverflow.com/comment/40775850
tagged with: awt
has comment: http://stackoverflow.com/comment/40770659
has comment: http://stackoverflow.com/comment/40770764
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40771134

http://stackoverflow.com/comment/40723748
type: Comment
type: QuestionComment
has text: Is the version that you are trying to deploy already present ?
comment on: http://stackoverflow.com/q/26003271
score: 0

http://stackoverflow.com/q/26011305
score: -2
has comment: http://stackoverflow.com/comment/40740615
favorite count: 0
type: UnansweredQuestion
downvote count: 2
type: Question
linked to: http://stackoverflow.com/q/21338735
has comment: http://stackoverflow.com/comment/40754616
has title: How to find the saddlePoint in IntMatrix
tagged with: java
tagged with: saddle
duplicate of: http://stackoverflow.com/q/21338735
tagged with: methods
has comment: http://stackoverflow.com/comment/40740866
tagged with: point
upvote count: 0
has body: This is my program in finding the Saddle Point of a Matrix (IntMatrix). Please help me make another method for IntMatrix m, for the Parameters inside the saddlePoints method? public class SaddlePoint{ public void saddlePoints(IntMatrix m, int[] rows, int[] cols) { int rows = m.length; int cols = m[0].length; boolean[][] flagArr = new boolean[rows][cols]; for(int i=0; i&lt;rows; i++){ for(int j=0; j&lt;cols; j++){ if(m[i][j]==0){ flagArr[i][j]=true; } } } for(int i=0; i&lt;rows; i++){ for(int j=0; j&lt;cols; j++){ if(flagArr[i][j]==true){ /*for rows*/ for(int k=0; k&lt;rows; k++){ m[k][j]=0; } /*for cols*/ for(int z=0; z&lt;cols; z++){ m[i][z]=0; } } } } } } this is the requirement but i need the saddlePoint method only because I already have the other methods IntMatrix Class: //represents a 2-dimensional matrix of integers Constructor Signature: IntMatrix(int rows, int cols, int ... elements) //elements are provided in row major order IntMatrixUtilityClass Static Methods: IntMatrix sum(IntMatrix ... matrices) //returns the sum of its arguments IntMatrix product(IntMatrix m1, IntMatrix m2, IntMatrix ... others) //returns the product of its arguments boolean[] saddlePoints(IntMatrix m, int[] rows, int[] cols) /*for each of the row and column pairs, returns true if the specified element of m is a saddle point for the matrix; returns false otherwise*/ this is my program, I only need the saddlePoints public class IntMatrix { private int[][] matrix; private int rows; private int cols; private int[] elements; public IntMatrix(int r, int c, int... e) { this.rows = r; this.cols = c; this.elements = e; matrix = new int[rows][cols]; int l = 0; for (int i = 0; i &lt; matrix.length; i++) { for (int j = 0; j &lt; matrix[0].length; j++) { this.matrix[i][j] = elements[l]; l++; } } } public static IntMatrix sum(IntMatrix... matrices) { int[] result = new int[matrices[0].rows * matrices[0].cols]; for (IntMatrix matrix : matrices) { int l = 0; for (int i = 0; i &lt; matrix.rows; i++) …
has comment: http://stackoverflow.com/comment/40761108
answer count: 1
has comment: http://stackoverflow.com/comment/40739966
has answer: http://stackoverflow.com/a/26011621

http://stackoverflow.com/q/25985791
has answer: http://stackoverflow.com/a/25985854
score: 0
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/25985866
has comment: http://stackoverflow.com/comment/40692449
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has title: Check If Two Dimensional Array is empty
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40692413
answer count: 2
has comment: http://stackoverflow.com/comment/40692406
tagged with: arrays
has body: I'm working on a class project and hit a roadblock. I've been looking everywhere on how to check if a Two Dimensional Array is empty and if so then it'll continue on with the project. If the array is full then it'll ask the customer to be put on a waiting list. I'm really new to java so if you can please help me out with this! I've been thinking of using a boolean statement but I'm not sure if that'll work. Any case I've written this so far for the array. char [][] seats = new char [13][6]; //array for row and columns for (int row = 0; row &lt; seats.length; row ++) {//output seating to * with no passengers for (int col = 0; col &lt; seats[row].length; col ++) { seats [row][col] = '*'; } }
favorite count: 0

http://stackoverflow.com/comment/40620456
has text: Are threading the print process in anyway?
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25945840

http://stackoverflow.com/q/25964515
upvote count: 0
has comment: http://stackoverflow.com/comment/40688983
favorite count: 0
has answer: http://stackoverflow.com/a/25964838
tagged with: system
type: Question
score: -2
has comment: http://stackoverflow.com/comment/40654146
duplicate of: http://stackoverflow.com/q/1096404
tagged with: java
downvote count: 2
tagged with: file
answer count: 1
has comment: http://stackoverflow.com/comment/40657389
has comment: http://stackoverflow.com/comment/43056195
has title: Can I write a program to monitor files using Java or another language?
type: UnansweredQuestion
has body: Is there a way to monitor files using java in Linux ? I don't mean modifying files, but any reading operations. For example if I have a file x.txt can I know if the user printed, emailed, or copied data from this file? If I can't do that in java, is it doable in other languages? Or is there open source program that can do this thing?

http://stackoverflow.com/comment/40661572
comment on: http://stackoverflow.com/q/25969036
type: Comment
type: QuestionComment
has text: Please add a code example of what you are trying to achieve.
score: 0

http://stackoverflow.com/q/25956415
upvote count: 3
type: UnansweredQuestion
has title: Tarsos dsp Android AudioTrack plays static or too fast
has comment: http://stackoverflow.com/comment/51466691
type: Question
tagged with: audio
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/44237636
has body: This problem has been frustrating me for a while. I'm trying to use Tarsos DSP to perform some basic signal processing on a project I'm working on for Android. The audio comes from a standard WAV file that is 44.1k, 16bit stereo. When I set up and run a Tarsos AudioDispatcher using an AudioProcessor that uses Android's AudioTrack to output sound I get static or audio that plays way too fast. Here is the code that sets up the Audio Dispatcher public void Play(String source, double startTime, final double endTime){ InputStream wavStream; try { wavStream = new FileInputStream(source); UniversalAudioInputStream audioStream = new UniversalAudioInputStream(wavStream, audioFormat); dispatcher = new AudioDispatcher(audioStream, bufferSize, overLap); AndroidAudioPlayer player = new AndroidAudioPlayer(audioFormat, buffersize); dispatcher.addAudioProcessor(player); dispatcher.skip(startTime); new Thread(new Runnable() { @Override public void run() { while (dispatcher.secondsProcessed() &lt; endTime) { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } dispatcher.stop(); } }).start(); dispatcher.run(); try { audioStream.close(); } catch (IOException e) { e.printStackTrace(); } }catch (FileNotFoundException e){e.printStackTrace();} } One thing that I've noted is that if I let the AudioDispatcher run through the entire WAV file it reports a total number of seconds processed that is longer than what is indicated in the header of the WAV file which makes the methods that set the start and end times inaccurate but still within bounds (usually). (Why does this happen?)** Here is the code for the AndroidAudioPlayer that implements a Tarsos AudioProcessor: public class AndroidAudioPlayer implements AudioProcessor { private AudioTrack audioTrack; AndroidAudioPlayer(TarsosDSPAudioFormat audioFormat, int bufferSize){ audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, (int)audioFormat.getSampleRate(), AudioFormat.CHANNEL_OUT_STEREO, AudioFormat.ENCODING…
tagged with: signal-processing
downvote count: 0
favorite count: 0
tagged with: audiotrack
tagged with: android
answer count: 0

http://stackoverflow.com/q/26020788
answer count: 1
has title: Passing domain-specific objects to a domain-specific task in jBPM 6 workbench
favorite count: 0
has body: I've been struggling with this for a few days and haven't had much luck. In jBPM 6 workbench running on jboss wildfly, I'm trying to invoke a custom work item handler and pass in an instance of a domain-specific object. Here's my process so far: Define a domain-specific class acme.datamodel.UserBio in an external jar: datamodel.jar. Upload "datamodel.jar" to jbpm-console via the "Artifact repository"->Upload feature. Create a new repository in jbpm-console and create a new jbpm project. Add datamodel.jar as a dependency to my jbpm project via the Project editor. Create a new process in the jbpm project. Create a new process variable of type acme.datamodel.UserBio. Create a new work item definition for my domain-specific task (Greeting.wid) like so: import org.drools.core.process.core.datatype.impl.type.StringDataType; import org.drools.core.process.core.datatype.impl.type.ObjectDataType; [ [ "name" : "Greeting", "parameters" : [ "UserBio" : new ObjectDataType("acme.datamodel.UserBio") ], "results" : [ "Result" : new ObjectDataType("java.util.Map") ], "displayName" : "Greeting", "icon" : "../../../global/defaultservicenodeicon.png" ] ] Add the domain-specific task (Greeting) to my process workflow. Map the process variable from step 5 as the input parameter for the Greeting task. Define my custom work item handler in an external jar (workitems.jar) like so: package acme.workitem.greeting; import java.util.Map; import org.kie.api.runtime.process.WorkItem; import org.kie.api.runtime.process.WorkItemManager; import org.kie.internal.runtime.StatefulKnowledgeSession; import acme.datamodel.UserBio; public class GreetingWorkItemHandler implements WorkItemHandler { private StatefulKnowledgeSession ksession; public GreetingWorkItemHandler(StatefulKnowledgeSession ksession) { this.ksession = ksession; } public void executeWorkItem(WorkItem workItem, WorkItemManager workItemManager) { // Extract required parameters UserBio bio = (UserBio) workItem.getParameter("UserBio"); // Do…
upvote count: 5
type: UnansweredQuestion
downvote count: 0
tagged with: java
tagged with: wildfly
has answer: http://stackoverflow.com/a/26103124
type: Question
tagged with: jboss
tagged with: jbpm
score: 5

http://stackoverflow.com/comment/40681851
has text: I activated the sql log but in that operation nothing happens. what do you mean with transaction management methods? @Antoniossss
comment on: http://stackoverflow.com/q/25977534
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25950325
downvote count: 0
tagged with: fonts
score: 1
tagged with: java
type: Question
tagged with: libgdx
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25979855
favorite count: 0
has body: Im trying to implement a different font than the default one using TextFieldStyle as I´ve been told. It´s inside a textbox that I want to change the font. But have yet not manage to do it. This is the class itself: public class StoneScreen implements Screen { OrthographicCamera camera; final TombStone game; //Textures and art. public Texture background, sdStone, arrowBack; public Sprite backgrounds; //TextField´s stuff private Stage stage; private Skin skin; ImageButton btnArrow; public StoneScreen(TombStone gam) { this.game = gam; camera = new OrthographicCamera(); camera.setToOrtho(false, 136, 204); game.assets.load(); loadStandard(); } public void loadStandard(){ background = game.assets.background; sdStone = game.assets.sdStone; //backgrounds = Assets.backgrounds; } @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0.2f,1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); //Recieves the screen width and height float gameHeight = Gdx.graphics.getHeight(); float gameWidth = Gdx.graphics.getWidth(); camera.update(); game.batch.setProjectionMatrix(camera.combined); game.batch.begin(); Gdx.app.log("X", "FPS:" + Gdx.graphics.getFramesPerSecond()); game.batch.draw(background,0,0, 136, 204); game.batch.draw(sdStone, 40, 20, 70, 110); //SpriteBatch batcher = (SpriteBatch)stage.getBatch(); game.batch.end(); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); } @Override public void resize(int width, int height) { // TODO Auto-generated method stub } @Override public void show() { BitmapFont textFont; FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("NothingYouCouldDoBold.ttf")); FreeTypeFontParameter parameter = new FreeTypeFontParameter(); parameter.size = 12; textFont = generator.generateFont(parameter); //String text = Gdx.app.getPreferences("prefs").getString("text", "Default text if missing"); //String txtArea = Gdx.app.getPreferences("prefs").getString("text", "Default text if missing"); Preferences prefs = Gdx.app.getPre…
has title: TextFieldStyle in Libgdx
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/40588409
has text: are you using a new device or an old one?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25927701
type: Comment

http://stackoverflow.com/comment/40636453
type: QuestionComment
comment on: http://stackoverflow.com/q/25955445
score: 0
has text: @AvinashRaj absolutely not
type: Comment

http://stackoverflow.com/q/25995651
type: Question
possible better answer: http://stackoverflow.com/a/26041890
answer count: 2
tagged with: playframework
has answer: http://stackoverflow.com/a/26041890
tagged with: slf4j
score: 0
has body: I wrote a play 2.2.1 application and I have problems with logging. I defined a logger per class in this way: import org.slf4j.LoggerFactory; import org.slf4j.Logger; public class Foo extends Controller { private static Logger logger = LoggerFactory.getLogger(Foo.class); public Result bar(){ logger.info("Bar called"); . . . } } I am not using a logger.xml. Everything perfectly works in dev mode and every class logs fine. When I run in dist mode, it stops logging after the application is started. Any idea about what I am doing wrong or what else could I check? Thanks in advance!
linked to: http://stackoverflow.com/q/16906837
has title: Playframework quit logging after application starts, but works for Global.onStart()
accepted answer: http://stackoverflow.com/a/26103278
tagged with: logging
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26103278

http://stackoverflow.com/a/25980141
answers question: http://stackoverflow.com/q/25979929
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: Some hints or advice about your code that help you : 1. try to define your setter and getters for encapsulation purposes ,and having access to each field. for example: private int ID; getter method is public int getID(){ return this.ID; } setter method is public void setID(int newID){ this.ID = newID; } 2. Instead of having displayMinionData() , it is good practice to override toString method For example if your variables are : private String came; private String city; public String toString(){ return name + " " + city; } I am not sure what you by accessing the solider in main method: but you have this Minion soldier = new Minion(0, "Soldier", "Human", "The First minion", 2, 1, 1); As I told you 1. you can printout the whole info by using overridden toString on the console 2. you can extract each portion of the soldier variable by using getters 3. you can update each portion of the soldier variable by using setters sample for toString: System.out.print("Info about the current soldier is " + soldier.toString()); sample for getters: System.out.println("ID:" + soldier .getID()): sample for setters: int newID = 123456789; soldier.setID(newID); System.out.println("The new id of current soldier is " + soldier.getID()):

http://stackoverflow.com/a/25875416
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: You have to initilalize application context properly in your main method. You can check this link for example.
answers question: http://stackoverflow.com/q/25874978

http://stackoverflow.com/a/25901413
has body: You can simply use String.format in the following way: String plain = "f424376fe38e496eb77d7841d915b074"; String uuid = String.format("%1$-%2$-%3$-%4$", plain.substring(0,7), plain.substring(7,11), plain.substring(11,15), plain.substring(15,20)); Or with more library methods using Apache Commons Codec (org.apache.commons.codec.binary.Hex class) and JDK (java.util.UUID class): byte[] data = Hex.decodeHex("f424376fe38e496eb77d7841d915b074".toCharArray()); String uuid = new UUID(ByteBuffer.wrap(data, 0, 8).getLong(), ByteBuffer.wrap(data, 8, 8).getLong()).toString();
type: Answer
score: 18
accepted answer of: http://stackoverflow.com/q/25895225
upvote count: 18
answers question: http://stackoverflow.com/q/25895225
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25951117
tagged with: module
has body: I am a beginner when it comes to IntelliJ plugin development but i want my plugin to register a new Module Type in the "New Project" / "New Module" windows. I already searched through the Documentation for plugin developers but wasn't able to find anything useful. I also looked at existing plugins like Kotlin and Scala which also add new Module types but I can't figure out how to get a finished ModuleType to show up in the dialogs mentioned above. What do I have to change in the plugin.xml file? I already added extensions and created java classes for ModuleType, ModuleBuilder and the ModuleConfigurationExtensionProvider but that doesn't change anything. I hope you can help me and thanks in advance.
has answer: http://stackoverflow.com/a/26911457
type: AnsweredQuestion
tagged with: project
tagged with: java
has comment: http://stackoverflow.com/comment/97769644
score: 12
type: Question
upvote count: 12
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/26911457
downvote count: 0
answer count: 1
has title: How do I "register" a new Module Type in an IntelliJ Plugin?
favorite count: 0
tagged with: intellij-plugin

http://stackoverflow.com/q/25888459
favorite count: 0
type: UnansweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41041101
tagged with: java
tagged with: nsis
tagged with: windows-services
type: Question
has answer: http://stackoverflow.com/a/25888572
has comment: http://stackoverflow.com/comment/40516264
has title: Install and run application as service on Windows linux and MAC
upvote count: 3
tagged with: linux
tagged with: windows
answer count: 1
has body: Hi all I have creates a Java stand alone application with Swing Now I wanted to distribute this application as .exe or .sh file. Also I wanted to install and start my application as service on Windows,Linux and MAC machines ? so how can I How I can start my application as service on this OS. How to create installer of my application so when I double click on it it will get installed and started as service on this OS. What I have done so far I google around and I came across the tool called YAJSW, I followed the steps given in this Quick Start topic and created wrapper class of my application and its works as intended on my machine, but I don't know how I can bundle this wrapper and distribute my application as .exe or .sh so that my application will get install and execute as service on my client machine. any help or point to direction will be appreciated.. Thanks...

http://stackoverflow.com/comment/40580311
type: Comment
has text: I don't have enough reputation to vote but I really appreciate your help :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25922962

http://stackoverflow.com/comment/40615257
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25942381
has text: You probably got the wrong version or put them in the wrong place. You'll need to provide more detail or just carefully review what you did.
score: 0

http://stackoverflow.com/a/25960272
has comment: http://stackoverflow.com/comment/40646078
has comment: http://stackoverflow.com/comment/40645490
answers question: http://stackoverflow.com/q/25960164
has comment: http://stackoverflow.com/comment/40647135
score: 0
type: Answer
has body: You mean something like that: package p1; class C1 { public void publicMethod() {} } In another package: package p2; import p1.C1; // not allowed public class C2 { C1 c1; // not allowed void test() { c1.publicMethod(); // not allowed } } In case of inheritance, the publicMethod can be used: package p1; public class C2 extends C1 {} Now the publicMethod can be access: package p2; import p1.C2; // C2 is public, ok ! public class C3 { C2 c2; // C2 is public, ok ! void test() { c2.publicMethod(); // C2 is public, use publicMethod of C1 ! } } So, reduce a class visibility can be usefull for kind of abtract class that should not be used directly outside the package.
has comment: http://stackoverflow.com/comment/40648524
has comment: http://stackoverflow.com/comment/40647003
has comment: http://stackoverflow.com/comment/40648355

http://stackoverflow.com/a/25876943
score: 2
downvote count: 0
has body: The addon needs another library to work: net.tanesha.recaptcha4j:recaptcha4j:0.0.7 see https://github.com/wbstr/vaadin-recaptcha/blob/master/vaadin-recaptcha/pom.xml
answers question: http://stackoverflow.com/q/25876095
accepted answer of: http://stackoverflow.com/q/25876095
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40511066
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25883759
score: 0
has text: Multiplication operations act on numbers with a finite representation (not depending on n), therefore an arithmetic operation in your case is constant time.

http://stackoverflow.com/comment/40679770
type: QuestionComment
has text: @AleksandrM i did'nt get you....
comment on: http://stackoverflow.com/q/25975679
score: 0
type: Comment

http://stackoverflow.com/comment/40618723
comment on: http://stackoverflow.com/q/25944718
has text: Basically, if you can't do it with overloading and you can't do it with "reflections" then you can't do it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25954066
has comment: http://stackoverflow.com/comment/40959130
type: AnsweredQuestion
has title: None of the events are working in eclipse for JavaFX
score: 1
tagged with: java
tagged with: javafx
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/25963426
tagged with: user-interface
answer count: 1
downvote count: 0
favorite count: 0
has body: I am trying to integrate a GUI created in JavaFX SceneBuilder into a java program. I have some buttons, sliders, and checkboxes inside of an Accordion container and the events for those objects never get handled. It always gives this error: Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at sun.reflect.misc.Trampoline.invoke(Unknown Source) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at sun.reflect.misc.MethodUtil.invoke(Unknown Source) at javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source) at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source) at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source) at javafx.event.Event.fireEvent(Unknown Source) at javafx.scene…
accepted answer: http://stackoverflow.com/a/25963426
upvote count: 1

http://stackoverflow.com/comment/40787665
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26037852
type: Comment
has text: I already this your suggested code but in this way the problem is cursor remains to HAND_CURSOR even if has moved from tab head to its panel.

http://stackoverflow.com/comment/40497769
has text: Just a note, handling image loading for items in a `ListView` can get a bit complex. As views get recycled, you will need to keep track of your request threads to cancel them as well - otherwise you'll end up with the wrong image for a certain item. [Picasso](http://square.github.io/picasso/) is a nice library which handles this for you.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25877837
type: AnswerComment

http://stackoverflow.com/q/25880584
type: Question
has answer: http://stackoverflow.com/a/25880681
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40502729
accepted answer: http://stackoverflow.com/a/25880681
has comment: http://stackoverflow.com/comment/40502626
has title: Printing the amount of digits to the right and left of a decimal place
type: AnsweredQuestion
has body: I'm having trouble getting the number of digits to the left of the decimal place. I've got the digits to the right of the decimal point working and able to print out but not to the left. Can anyone help? import java.lang.Math; import java.util.Scanner; import java.text.DecimalFormat; public class FormulaCalculation { public static void main(String[] args) { Scanner userInput = new Scanner(System.in); double x; //Prompt user for value. System.out.print("Enter a value for x: "); x = userInput.nextDouble(); double result = (Math.sqrt(7 * Math.pow(x, 4) - 5 * Math.pow(x, 2) + Math.abs(98 * x)) + 13) * (3 * Math.pow(x, 5) + 4 * Math.pow(x, 3) + 1); String resultString = Double.toString(result); int integerPlaces = resultString.indexOf('.'); int digitsLeft = resultString.length(); int digitsRight = resultString.length() - integerPlaces - 1; //Output System.out.println("Result: " + result); System.out.println("# digits to left of the decimal point: " + digitsLeft); System.out.println("# digits to right of the decimal point: " + digitsRight); System.out.println("Formatted Result: "); } }
tagged with: java

http://stackoverflow.com/comment/40548225
has text: Works as a charm. You are thE bEst!
comment on: http://stackoverflow.com/a/25903957
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25934304
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40600679
tagged with: matlab
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40600139
has title: Use the main method of a .jar file inside a Matlab script
has comment: http://stackoverflow.com/comment/40735444
tagged with: jar
has comment: http://stackoverflow.com/comment/40607750
answer count: 0
has body: I am trying to execute a method "main" from a Java class integrated into a JAR file. I tried to do it as follows: javaclasspath 'file.jar'; javaMethod('main', 'JavaClass') However, I get the following error: Error using javaMethod No class DemoClient can be located on the Java class path Does anyone know how I can to integrate this JAR into my Matlab routine for carrying out an advanced Matlab operation.
score: 0

http://stackoverflow.com/a/25922518
has comment: http://stackoverflow.com/comment/40579228
has comment: http://stackoverflow.com/comment/40579278
upvote count: 1
type: AcceptedAnswer
has body: Don't use JTextArea#setText, use JTextArea#append instead. setText does just that, changes the text of the text area to what ever you specify, discarding what ever was previous applied to it.
type: Answer
answers question: http://stackoverflow.com/q/25922336
has comment: http://stackoverflow.com/comment/40579141
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40579194
accepted answer of: http://stackoverflow.com/q/25922336
has comment: http://stackoverflow.com/comment/40579572
has comment: http://stackoverflow.com/comment/40579699

http://stackoverflow.com/q/25974354
tagged with: java
type: Question
score: 9
has title: Creating zip file in memory out of byte[]. Zip file is allways corrupted
upvote count: 9
accepted answer: http://stackoverflow.com/a/25974946
linked to: http://stackoverflow.com/q/23612864
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
has body: I have a problem with my created zip file. I am using Java 7. I tried to create a zip file out of a byte array, which contains two or more Excel files. The application finishes allways without any exceptions. So, I thought everything is alright. After I tried to open the zip file, there was an error message from Windows 7, that the zip file is maybe corrupted. I couldn't open it and I have no idea why...! I googled for this problem but the code snippets I found, looks exactly the same than in my implementation. This is my code: if (repsList.size() &gt; 1) { String today = DateUtilities.convertDateToString(new Date(), "dd_MM_yyyy"); String prefix = "recs_" + today; String suffix = ".zip"; ByteArrayOutputStream baos = null; ZipOutputStream zos = null; try { baos = new ByteArrayOutputStream(); zos = new ZipOutputStream(baos); for (RepBean rep : repsList) { String filename = rep.getFilename(); ZipEntry entry = new ZipEntry(filename); entry.setSize(rep.getContent().length); zos.putNextEntry(entry); zos.write(rep.getContent()); zos.closeEntry(); } // this is the zip file as byte[] reportContent = baos.toByteArray(); } catch (UnsupportedEncodingException e) { ... } catch (ZipException e) { ... } catch (IOException e) { ... } finally { try { if (zos != null) { zos.close(); } if (baos != null) { baos.close(); } } catch (IOException e) { // Nothing to do ... e.printStackTrace(); } } } try { response.setContentLength(reportContent.length); response.getOutputStream().write(reportContent); } catch (IOException e) { ... } finally { try { response.getOutputStream().flush(); response.getOutputStream().close(); } catch (IOException e) { ... } } It must be a very simple failure but I cannot find it. Would be nice if you can help me with my problem. Thanks a lot in advance.
has answer: http://stackoverflow.com/a/25974946
type: AnsweredQuestion

http://stackoverflow.com/a/25895710
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40533674
has comment: http://stackoverflow.com/comment/40530155
has comment: http://stackoverflow.com/comment/40580214
downvote count: 0
has comment: http://stackoverflow.com/comment/40533337
has comment: http://stackoverflow.com/comment/40627157
answers question: http://stackoverflow.com/q/25894820
score: 1
has comment: http://stackoverflow.com/comment/40617920
has comment: http://stackoverflow.com/comment/40692816
has body: Trying to do this with a regex is a mistake - you are not parsing a regular expression. Start with something like this - you will fail with a regex: public void test() { System.out.println(parse("\"This is it!\" \"[\\\",;']\" \"Really?\" 3 5")); } List&lt;String&gt; parse(String s) { List&lt;String&gt; parsed = new ArrayList&lt;String&gt;(); boolean inQuotes = false; boolean escape = false; int from = 0; for (int i = 0; i &lt; s.length(); i++) { char ch = s.charAt(i); switch (ch) { case ' ': if (!inQuotes &amp;&amp; !escape) { parsed.add(s.substring(from, i)); from = i + 1; } break; case '\"': if (!escape) { inQuotes = !inQuotes; } escape = false; break; case '\\': escape = !escape; break; default: escape = false; break; } } if (from &lt; s.length()) { parsed.add(s.substring(from, s.length())); } return parsed; } Added With the specific string in question, here is my interpretation: String str = "my_command \"Something [\"abc']\" \"text\" NA 1 1"; // ............ .. ....... // ^ ^ ^ ^ ^ I have used a ^ to indicate a quote and used . for all characters therefore in quotes. Thus no further splits after the first quote as there are no unquoted spaces after that.
has comment: http://stackoverflow.com/comment/40533155

http://stackoverflow.com/comment/40629340
comment on: http://stackoverflow.com/q/25950888
score: 0
type: Comment
type: QuestionComment
has text: can anyone provide regex to extract the operators also?

http://stackoverflow.com/a/25967646
has comment: http://stackoverflow.com/comment/40659069
has comment: http://stackoverflow.com/comment/40659028
type: Answer
has comment: http://stackoverflow.com/comment/40659012
answers question: http://stackoverflow.com/q/25967611
score: 1
accepted answer of: http://stackoverflow.com/q/25967611
upvote count: 1
has body: Change if (gameInput == g.getId()){ to if (gameInput != null &amp;&amp; gameInput.equals(g.getId())){
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40749152
score: 0
type: AnswerComment
type: Comment
has text: @Adi .. okay, so there is NO solution with pure Spring usage, is there? Autowiring in unit tests can NOT be disabled. Is that what you're saying?.
comment on: http://stackoverflow.com/a/26016737

http://stackoverflow.com/comment/40549263
comment on: http://stackoverflow.com/a/25906437
score: 0
type: AnswerComment
has text: this is not a full implementation. This code example shall show how you can resolve this issue. I know your statements but i wrote this code example on the fly. The OP does not give us the context in which method he is so i barely guess.. @MadProgrammer
type: Comment

http://stackoverflow.com/q/25991953
has answer: http://stackoverflow.com/a/25993712
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40703221
has answer: http://stackoverflow.com/a/25993533
accepted answer: http://stackoverflow.com/a/25993712
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/25992698
has title: Invalid answer while printing child elements from an XML file in JAVA
has answer: http://stackoverflow.com/a/25992698
has body: Im trying to get the number of child elements of a parent element from a XML file using JAVA. Here is the code I'm working with: File fXmlFile = new File("SearchPromotions.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); NodeList l = doc.getElementsByTagName("TestCase"); Node parentNode = l.item(0); int count = parentNode.getChildNodes().getLength(); System.out.println(count); And here is the XML file: &lt;TestCase&gt; &lt;SelectedDataTableNames name="SearchData"&gt; &lt;/SelectedDataTableNames&gt; &lt;Open page="hsbc" ms="5000" /&gt; &lt;Click object="hsbc.Personal_Link" /&gt; &lt;Click object="hsbc.CreditCard_tab" /&gt; &lt;Call businessComponent="Global.Verify_Search"&gt; &lt;Param name="HotelName_Param" value="@SearchData_link" /&gt; &lt;/Call&gt; &lt;CheckElementPresent object="hsbc.Img_Hotel_logo" Identifire="Hotel_Name_PARAM:@SearchData_ResultHotelName" fail="true" customErrorMessage="Searched hotel name is not present in the page." /&gt; &lt;/TestCase&gt; The problem im facing is that it is printing a wrong value. The value printed is 13. But as you can see there are only 6 child elements for the parent element "TestCase". Where did i go wrong. Please help
answer count: 3
downvote count: 0

http://stackoverflow.com/a/25918268
has body: I tested the config in a test project and it works without any issues. Ensure that you do not have any locks on the file and have correct read/write privileges on the file/directory.
answers question: http://stackoverflow.com/q/25917885
has comment: http://stackoverflow.com/comment/40570923
accepted answer of: http://stackoverflow.com/q/25917885
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/25967551
accepted answer: http://stackoverflow.com/a/25969714
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has body: ExpiryFilter.java import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; public class ExpiryFilter implements Filter { // add a five years expiry private Integer years = 1; @Override public void destroy() { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (years > -1) { Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.add(Calendar.YEAR, years); // HTTP header date format: Thu, 01 Dec 1994 16:00:00 GMT String o = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz") .format(c.getTime()); ((HttpServletResponse) response).setHeader("Expires", o); } chain.doFilter(request, response); } @Override public void init(FilterConfig filterConfig) throws ServletException { } } I am creating one web application in that i want to give validity time period. So am using filter for mapping. web.xml Set cache expiry for static content ExpiryFilter ExpiryFilter ExpiryFilter /ExpiryDate/* REQUEST This is my local host linkhttp://localhost:8080/ExpiryDate/test.jsp. I need to filter after one year. After one year or particular time period that particular link could not be run.So please help me to find out the solution. Thank you.
has title: filter mapping for particular url
has answer: http://stackoverflow.com/a/25969714
tagged with: filter
downvote count: 0
answer count: 1
tagged with: jsp
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 2
tagged with: servlet-filters

http://stackoverflow.com/comment/43253742
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26004012
type: Comment
has text: @SecretService: Maybe I misunderstood. I think what you need is this: http://www.ibm.com/developerworks/library/j-typesafejpa/ So instead of "Person.$Fields.firstname" you'd use "Person_.firstname".

http://stackoverflow.com/q/25922439
score: 3
has answer: http://stackoverflow.com/a/25922488
upvote count: 3
type: UnansweredQuestion
has body: I have a simple code first I use this Long.parseLong(4250120140405520712) And it works but when I do this Long.parseLong(42501201404055207123) It fails. Adding an extra digit makes it throw a Number Format Exception. Can someone please explain
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25922520
answer count: 2
tagged with: long-integer
downvote count: 0
has title: Java Long parselong throwing Number Format exception
favorite count: 0

http://stackoverflow.com/comment/40519843
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25889780
has text: Thanks for a prompt reply. I have updated my question. I am using apache batik for it.
type: Comment

http://stackoverflow.com/a/25984289
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40691922
type: Answer
has body: The reason the value brother1ID in your Memory object is null is because you're using a new instance of that object. I strongly recommend you read up on how object instances are scoped in Java, and what it means to create a new instance, versus using an existing one. For example, when you do this: Memory mem = new Memory(); mem.brother1ID = "1234"; mem = new Memory(); System.out.println(mem.brother1ID); The value printed will be null. This is because you're using a new instance of that class. If you wanted to maintain the values throughout multiple method calls, your best bet might be to save the Memory object as an instance variable of whatever class contains the methods you've shown. i.e.: private Memory memory = new Memory(); ... private void searchFieldKeyReleased(java.awt.event.KeyEvent evt) { // Use 'this.memory' this.memory.brother1ID = "1234"; //(or) System.out.println(this.memory.brother1ID); } private void brotherViewButton1ActionPerformed(java.awt.event.ActionEvent evt) { // Use 'this.memory' }
has comment: http://stackoverflow.com/comment/40689951
has comment: http://stackoverflow.com/comment/40689590
upvote count: 1
has comment: http://stackoverflow.com/comment/40689623
answers question: http://stackoverflow.com/q/25984189
accepted answer of: http://stackoverflow.com/q/25984189

http://stackoverflow.com/q/25983852
tagged with: java
has answer: http://stackoverflow.com/a/31987763
has answer: http://stackoverflow.com/a/35155860
type: Question
has comment: http://stackoverflow.com/comment/40690782
accepted answer: http://stackoverflow.com/a/25986409
has answer: http://stackoverflow.com/a/70360337
tagged with: maven-javadoc-plugin
upvote count: 38
downvote count: 0
answer count: 7
has body: I'm trying to execute mvn release:perform on three projects that I have released to our Nexus server many times in the past. Suddenly today, for no apparent reason, all releases are failing to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10:jar (attach-javadocs). With full stack tracing and debug logging turned on (-e and -X), I see several hundred lines of errors about missing packages: ... package org.apache.http does not exist package org.slf4j does not exist package org.joda.time does not exist ... However, all of these packages are in both my local repository and Nexus server. Moreover, I don't get any of these errors from mvn clean install. All the projects (Java web apps) actually launch from IntelliJ without issues. So clearly, I'm not actually missing hundreds of packages. What could be preventing mvn release:perform from finding these packages when mvn clean install and mvn release:prepare don't have any problems?
favorite count: 0
has comment: http://stackoverflow.com/comment/40690900
has answer: http://stackoverflow.com/a/29984168
tagged with: nexus
tagged with: maven
possible better answer: http://stackoverflow.com/a/25992395
has title: maven-javadoc-plugin breaks mvn release:perform
has answer: http://stackoverflow.com/a/25986409
tagged with: maven-release-plugin
has answer: http://stackoverflow.com/a/25992395
has answer: http://stackoverflow.com/a/35856810
type: AnsweredQuestion
score: 38

http://stackoverflow.com/a/29150032
has body: You need to go to http://download.eclipse.org/releases/indigo or luna or whatever version of eclipse you are using and select Web, XML, Java EE and OSGi Enterprise Development.
type: Answer
downvote count: 1
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/25910341

http://stackoverflow.com/comment/40604484
comment on: http://stackoverflow.com/q/25936890
score: 1
has text: I don't even see an array here.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25900757
type: Question
answer count: 2
has title: Best practice for defining superclass instance fields based on the subclass
possible better answer: http://stackoverflow.com/a/25900816
score: 0
has comment: http://stackoverflow.com/comment/40539676
has comment: http://stackoverflow.com/comment/40540357
tagged with: superclass
has body: I have an abstract super class and several subclasses that inherit fields defined in the super class, but each subclass has different values for those fields. When the subclass is called, I use the constructor to set the fields appropriately. Should I use direct references to do this field = value, or should I use the super class set methods setField(value);? I'd rather keep the fields private, so I want to avoid direct references. The other alternative is to call the super constructor, which would allow me to use direct references in the super class constructor super (T value) and in the super class SuperClass(T value){ field = value}. Would this be the best way? I could even use set methods inside the super constructor, but this seems like it would be redundant.
has comment: http://stackoverflow.com/comment/40539820
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25900816
has answer: http://stackoverflow.com/a/25900892
accepted answer: http://stackoverflow.com/a/25900892
tagged with: java
has comment: http://stackoverflow.com/comment/40539360

http://stackoverflow.com/q/25889698
has answer: http://stackoverflow.com/a/25889743
has answer: http://stackoverflow.com/a/25890228
tagged with: dictionary
tagged with: void
has body: I know the basic that a HasMap is a Key-Value pair but I want to have a HashMap with keys only(No Values) I want to put below java snippet in my complex method(i.e HashMap with only Keys and no value associated to those Keys). My requirement is that i am processing a List of Duplicate Records, and during comparisons, I am keeping only one identifier value(from group of duplicates) in a HasMap which I can later compare that whether the system has already processed it or not. Here is the code snippet(gives Compile time error as Void class is uninstantiable). Map&lt;Integer,Void&gt; map=new HashMap&lt;Integer, Void&gt;(); //Some Logic goes here map.put("ss",new Void()); Any suggestion/help to have a HasMap only Keys with no value are welcome.
score: 0
has comment: http://stackoverflow.com/comment/40518351
tagged with: java
has comment: http://stackoverflow.com/comment/40518155
has comment: http://stackoverflow.com/comment/40518451
tagged with: collections
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/25890228
has answer: http://stackoverflow.com/a/25889845
answer count: 5
has title: Void Class in HashMap as a Value object
has answer: http://stackoverflow.com/a/25889808
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40518123
possible better answer: http://stackoverflow.com/a/25889826
has answer: http://stackoverflow.com/a/25889826
type: Question

http://stackoverflow.com/q/26018391
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40756586
has comment: http://stackoverflow.com/comment/40754220
has body: I have two questions: 1) Is there a way to open the search-page on facebook app from my android application? 2) If there is a way, can I open the activity with extras and tell facebook what to search? I tried to find in the internet an answer, but I came with no success.
tagged with: android
tagged with: facebook
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40751818
linked to: http://stackoverflow.com/q/4191492
tagged with: java
has title: How to open the search-for-friends page on facebook from an android app?

http://stackoverflow.com/q/25975301
type: Question
has answer: http://stackoverflow.com/a/49965419
has answer: http://stackoverflow.com/a/25975923
has comment: http://stackoverflow.com/comment/40686282
has comment: http://stackoverflow.com/comment/40676182
has comment: http://stackoverflow.com/comment/40674858
downvote count: 0
has answer: http://stackoverflow.com/a/65889604
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/40686550
answer count: 4
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/31407503
score: 3
upvote count: 3
tagged with: java
tagged with: selenium
has body: I am working on a simple test scenario which checks the successful login into facebook, with my own credentials.I want the password to be encrypted and login with the same. How can this be done? Some code snippet would be helpful.Would decryption also be required? I am looking for somewhat the same capability like QTP has. My code snippet is as below WebDriver driver = new FirefoxDriver(); driver.get("https://www.facebook.com/"); driver.findElement(By.id("email")).sendKeys("abc@gmail.com"); driver.findElement(By.id("pass")).sendKEys("encrypted password)//would want the encrypted pwd Pl help
has title: Encrypt and Decrypt passwords in Selenium Webdriver

http://stackoverflow.com/q/25930029
has comment: http://stackoverflow.com/comment/40592539
has comment: http://stackoverflow.com/comment/40592745
answer count: 3
has comment: http://stackoverflow.com/comment/40592504
has comment: http://stackoverflow.com/comment/40593188
has comment: http://stackoverflow.com/comment/40592317
has comment: http://stackoverflow.com/comment/40592353
possible better answer: http://stackoverflow.com/a/25930416
has comment: http://stackoverflow.com/comment/40593336
has answer: http://stackoverflow.com/a/25930416
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25930529
has answer: http://stackoverflow.com/a/25930624
has title: need suggestion in optimizing below code
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40594899
has comment: http://stackoverflow.com/comment/40592921
has body: I have an array and length is 3 but it may or may not contain data in 3 index , i have to append three queries based on the data in the array. Let me put an example. array[0]="A"; array[1]="B"; array[2]="C"; String strqry1 = "so and so"; String strqry2 = "so and so"; String strqry3 = "so ans so"; String mainQuery = ""; int arrayLength = array.legth; if(arrayLength == 1 ){ if(array[0].equals("A")){ mainQuery = strqry1 ; }else if(array[0].equals("B")){ mainQuery = strqry2 ; }else if(array[0].equals("c")){ mainQuery = strqry3 ; } } if(arrayLength == 2){ if(array[0].equals("A") &amp;&amp; array[1].equals("B")){ mainQuery = strqry1 +"union all"+ strqry2 ; }else if(array[0].equals("A") &amp;&amp; array[1].equals("C")){ mainQuery = strqry1 +"union all"+ strqry3 ; }else if(array[0].equals("B") &amp;&amp; array[1].equals("C")){ mainQuery = strqry2 +"union all"+ strqry3 ; } } if(arrayLength == 3){ if(array[0].equals("A") &amp;&amp; array[1].equals("B") &amp;&amp; array[2].equals("C")){ mainQuery = strqry1 +"union all"+strqry2 +"union all"+ strqry3 ; } } I need suggestion on , do i need write such permutation and combinations for the 3 sets of If conditions. Any other way i can optimize the code. Please suggest me.
accepted answer: http://stackoverflow.com/a/25930624

http://stackoverflow.com/comment/40602226
comment on: http://stackoverflow.com/q/25935551
score: 0
type: QuestionComment
has text: I have Java version 7 @assylias
type: Comment

playframework
tags question: http://stackoverflow.com/q/25876160
tags question: http://stackoverflow.com/q/25970000
tags question: http://stackoverflow.com/q/25890118
tags question: http://stackoverflow.com/q/25937421
tags question: http://stackoverflow.com/q/25922747
tags question: http://stackoverflow.com/q/25949561
tags question: http://stackoverflow.com/q/25989850
tags question: http://stackoverflow.com/q/26016604
tags question: http://stackoverflow.com/q/25906990
tags question: http://stackoverflow.com/q/25974759
tags question: http://stackoverflow.com/q/25988571
tags question: http://stackoverflow.com/q/25922163
tags question: http://stackoverflow.com/q/25995651
tags question: http://stackoverflow.com/q/25969072
tags question: http://stackoverflow.com/q/25957138
tags question: http://stackoverflow.com/q/25960146
tags question: http://stackoverflow.com/q/25949553
type: Tag
tag name: playframework
tags question: http://stackoverflow.com/q/25959816
tags question: http://stackoverflow.com/q/25953201

http://stackoverflow.com/comment/40636477
type: AnswerComment
has text: Ok got it working. Ive removed all the keystores in the app and added the certificates in cacerts. All working good now.
type: Comment
comment on: http://stackoverflow.com/a/25937264
score: 1

http://stackoverflow.com/comment/40524886
type: Comment
has text: @Chris311: Check out [Adam Bien's article](http://www.oracle.com/technetwork/articles/java/intondemand-1444614.html) on how to get rid of interfaces and factories for the use case above with Java EE.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25889141

http://stackoverflow.com/q/25971895
tagged with: java
has title: java web app memory heap needed
has body: I need to upload 3 war applications on the server space i rent. Right now the heap size I am paying for is 128mb. By just uploading the 3 war files I get a message showing 228/128 mb are being used (so I guess I am exceeding the mbs) but 2 out 3 can run simultaneously. I tried to run the "Profile Project" in Netbeans (for only one of my applications) and I get a graph flunctuating between 100mb and 450mb. How I am I going to determine how much memory heap I need? Moreover what happens when multiple users need to access the application at he same time? Will I need more memory heap then?
type: Question
tagged with: memory
score: 0
has comment: http://stackoverflow.com/comment/40666312
tagged with: heap-memory
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/40666822

http://stackoverflow.com/comment/53083652
has text: @MarianP depends on definition "much slower"; typically speed will converge to difference in encoded size; meaning that binary formats may be up to twice as fast. But implementation differences mean that variation is high.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25973062
type: Comment

http://stackoverflow.com/comment/40498698
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25877688
has text: You could put whatever you're doing in the `else{ //invalid image}` in the `finally` block in your try/catch

http://stackoverflow.com/a/26155423
accepted answer of: http://stackoverflow.com/q/25962516
type: Answer
upvote count: 4
downvote count: 0
has body: The easiest way to do this is with a ScrollPane. Inside your ScrollPane you define your rows and their layouts (probably each row is an HBox containing an ImageView and a TableView which is set to the height of the ImageView). Then, the TableViews inside your ScrollPane need to let the ScrollPane override their scrolling - that is, their onScroll bubbles up to the ScrollPane. Then you override the onScroll behavior for your ScrollPane. The algorithm for the scrolling could go like this: There are two modes. 1) Scrolling IN an album scrolls the TableView in that row. If the scrolling goes beyond the boundaries of the TableView's scrollHeight (the range between 0 and scrollHeight), then the mode switches to scrolling TO an album. 2) Scrolling TO an album scrolls the ScrollPane an amount up to the height of the current row. Scrolling an amount greater than the current row's height moves to the next album and switches the mode back to Scrolling IN that album. 3) Edge Cases: Scrolling within the ScrollPane beyond the boundaries of the ScrollPane's scrollHeight (the range between 0 and scrollHeight) immediately moves to the next album and switches the mode back to Scrolling IN that album. I'd give a code example, but I've never actually seen anybody try to do this. I just know you CAN do it.
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/25962516
has comment: http://stackoverflow.com/comment/41031458

http://stackoverflow.com/comment/40606472
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25933432
has text: If it works *by hand* and not from Angular.js, my advice would be to use a tool to spy the exact content of requests like [wireshark](http://www.wireshark.org), and simply run the same request first by hand, next through Angular.js and look the actual HTTP requests. It you do not find the reason of the error, you could at least post relevant details here.
score: 0

http://stackoverflow.com/q/26019857
tagged with: annotations
has answer: http://stackoverflow.com/a/26021559
type: Question
has answer: http://stackoverflow.com/a/26020054
score: 0
answer count: 2
has body: I use hibernate ORM in my project. Now I map entities like this : &lt;mapping class="entities.User"/&gt; but I have to do this for each entity I create - is there anything I can put in the hibernate configuration to make it scan itself for annotated entities in certain package? thank you
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40753919
has title: configure hibernate to map entities automaticly
tagged with: java
tagged with: hibernate
tagged with: orm

http://stackoverflow.com/q/25882689
has comment: http://stackoverflow.com/comment/40506923
tagged with: regex
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25882763
type: Question
type: AnsweredQuestion
has title: Regular Expression for custom query language's date format Java
accepted answer: http://stackoverflow.com/a/25882763
has comment: http://stackoverflow.com/comment/40506609
upvote count: 0
answer count: 1
favorite count: 0
has body: I have date format in below pattern. dates [2014_09_01,2014_09_01] dates 2014_04_01 last_nn_days nn = days in number Example: select * from someTable t where t.name is not null and dates[2014_09_01,2014_09_15] select * from someTable t where t.name is not null and dates 2014_09_01 select * from someTable t where t.name is not null and dates last_30_days From this: I want to generate a new query with select * from someTable t where t.name is not null and dates [%s,%s] select * from someTable t where t.name is not null and dates [%s,%s] select * from someTable t where t.name is not null and dates [%s,%s] I want to search these Strings and want to replace this part with dates [%s,%s]. Could it be possible with Regex in Java?
score: -3

http://stackoverflow.com/q/25910930
has comment: http://stackoverflow.com/comment/40557285
accepted answer: http://stackoverflow.com/a/25911587
type: Question
type: AnsweredQuestion
has body: I'm interested, is there any good method for running java programms (for example tests) at any specific time on Windows? Just can't find anything good as of now.
tagged with: java
has comment: http://stackoverflow.com/comment/40557014
answer count: 1
has answer: http://stackoverflow.com/a/25911587
score: 0
tagged with: windows
has comment: http://stackoverflow.com/comment/40556858
has title: Autorun Java programms at specific time on windows

http://stackoverflow.com/comment/40780662
has text: what do u mean by stacktrace
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26033729
score: 0

http://stackoverflow.com/q/25918569
has body: Having problem populating the JTable with contents from MySQL. First, it works when I output the contents of the table on console (system.out). The Error: NullPointerException happens when I try display it on JTable. Code: import javax.swing.table.DefaultTableModel; import java.sql.*; import javax.swing.JOptionPane; import net.proteanit.sql.DbUtils; public class ProductTable extends javax.swing.JFrame { public ProductTable() { try{ Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/inventory_db","root",""); }catch(Exception ex){ System.out.println("Error: "+ex); } try{ String query = "SELECT * FROM items_in_hand"; st = con.prepareStatement(query); rs = st.executeQuery(query); System.out.println("Records from Inventory Database:"); itemTable.setModel(DbUtils.resultSetToTableModel(rs)); //this line here causes the error while(rs.next()){ String iname = rs.getString("ItemName"); String price = rs.getString("Price"); String qty = rs.getString("Quantity"); System.out.println("Item: "+ iname +" Price (each): "+price+" Quantity: "+qty); } } catch(Exception ex){ System.out.println("Error: "+ ex); } initComponents(); // i have long initComponent codes; } private void btn_addActionPerformed(java.awt.event.ActionEvent evt) { message.setText(""); message2.setText(""); DefaultTableModel model = (DefaultTableModel) itemTable.getModel(); if(!txt_item.getText().trim().equals("")){ try{ String sql = "INSERT INTO items_in_hand (ItemName, Price, Quantity) VALUES (?,?,?)"; st = con.prepareStatement(sql); st.setString(1,txt_item.getText()); st.setString(2,txt_price.getText()); st.setString(3,txt_quantity.getText()); st.execute(); JOptionPane.showMessageDialog(null , "Saved."); model.addRow(new Object[] {txt_item.getText(),txt_price.getText(),txt_quantity.getText()}); message2.setText("Successfully Added."); }catch(Exception ex){ JOptionPane.showMessageDialog(null , ex); } } else{ message.setText("The Item name must be provided."); } } …
has comment: http://stackoverflow.com/comment/40572701
has comment: http://stackoverflow.com/comment/40572565
has comment: http://stackoverflow.com/comment/40572269
answer count: 1
has comment: http://stackoverflow.com/comment/40571537
has comment: http://stackoverflow.com/comment/40572044
has title: Error: java.lang.NullPointerException (jtable)
has comment: http://stackoverflow.com/comment/40571862
has comment: http://stackoverflow.com/comment/40571635
has answer: http://stackoverflow.com/a/25918942
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40573047
has comment: http://stackoverflow.com/comment/40571968
tagged with: java
has comment: http://stackoverflow.com/comment/40571501
tagged with: mysql
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/40571559
has comment: http://stackoverflow.com/comment/40572078
accepted answer: http://stackoverflow.com/a/25918942
score: 0
has comment: http://stackoverflow.com/comment/40572405

http://stackoverflow.com/q/25895657
has title: ExpandableListView Position Changes
accepted answer: http://stackoverflow.com/a/25895909
tagged with: android
has body: I have an ExpandableListView used as a Navigation Drawer. I also have a function, switchFragment. One of the parameters of switchFragment is the position. But, when I expand all groups and press an item, that item doesn't get highlighted. When I collapse a group, it does. How can I 'stable' that position?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25895909
tagged with: expandablelistview
type: Question
tagged with: java
score: 0
answer count: 1

http://stackoverflow.com/a/25992711
score: 5
answers question: http://stackoverflow.com/q/25991094
type: AcceptedAnswer
has body: Adding an answer for someone facing the same issue in future : ControlsFX 8.0.6 was released in two separate releases ControlsFX 8.0.6, for developers using JavaFX 8.0 ControlsFX 8.0.6_20, for developers building with JavaFX 8u20 If you are wondering why ? here is an explanation to it If you are using JDK8, go with ControlsFX 8.0.6 If you are using JDK8_20 or later, go with ControlsFX 8.0.6_20
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25991094

http://stackoverflow.com/comment/40612877
score: 0
type: Comment
has text: Find the wrong part,Create increasing detail .The first short. I'll try your code
comment on: http://stackoverflow.com/a/25941167
type: AnswerComment

http://stackoverflow.com/a/25982854
answers question: http://stackoverflow.com/q/25982781
type: Answer
has body: You are using the variable before their declaration. try with int P; int Y; double R; Scanner input = new Scanner (System.in); //double P; System.out.println("Enter loan amount: $" + P); P = input.nextInt(); //double Y; System.out.println("Enter number of years: " + Y); Y = input.nextInt(); //double R; System.out.println("Enter interest rate: %" + R); R = input.nextDouble(); int r = R / 1200; double n = 12 * Y; double payment = (P * r) / (1 - Math.pow(1+r, -n)); double interest = payment * n - P; System.out.println("Monthly payments = " + payment); System.out.println("Total interest = " + interest); Don't forget to cast R/1200 to int if you want it to be an int or just change the type of 'r' to double to become: double r = R / 1200;
has comment: http://stackoverflow.com/comment/40687248
score: 0

http://stackoverflow.com/q/25968690
has comment: http://stackoverflow.com/comment/46794561
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: pmd
has body: I'd like to create a rule to detect calls to a method named "method" of class "Task". Sounds basic but can't find how to do it. Did: public class CustomRule extends AbstractJavaRule { public Object visit(ASTVariableDeclaratorId node, Object data) { if (!TypeHelper.isA(node.getNameDeclaration(), Task.class)) { return data; } for (NameOccurrence occ : node.getUsages()) { NameOccurrence qualifier = occ.getNameForWhichThisIsAQualifier(); if (qualifier != null) { if (qualifier.getImage().equals("method")) { addViolation(data, occ.getLocation()); } } } return data; } } This works for Task t = new Task(); t.method(); but not for context.getTask().method();
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: PMD rule to detect a call to a method
tagged with: rule

http://stackoverflow.com/q/25894131
answer count: 1
accepted answer: http://stackoverflow.com/a/25895194
tagged with: openssl
score: 0
tagged with: jce
tagged with: cryptography
tagged with: encryption
type: AnsweredQuestion
has title: Exception when decrypting a "der" file generated with OpenSSL: Input length must be multiple of 8 when decrypting with padded cipher
has answer: http://stackoverflow.com/a/25895194
tagged with: java
type: Question
has body: first I generate a private RSA keyfile with OpenSSL and then convert it into an encrypted "der" file: $ openssl pkcs8 -topk8 -inform PEM -outform DER -in private_key.pem -out private_key.der Next I try to decrypt this file from Java using the following code(at this stage I already read the file into the byte[] key array using code that is at the bottom of this post): public static byte[] decryptPrivateKey(byte[] key) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { PBEKeySpec passKeySpec = new PBEKeySpec("p".toCharArray()); //my password EncryptedPrivateKeyInfo encryptedKey = new EncryptedPrivateKeyInfo(key); System.out.println(encryptedKey.getAlgName()); //PBEWithMD5AndDES System.out.println("key length: " + key.length); //key length: 677 SecretKeyFactory keyFac = SecretKeyFactory.getInstance(encryptedKey.getAlgName()); SecretKey passKey = keyFac.generateSecret(passKeySpec); // Create PBE Cipher Cipher pbeCipher = Cipher.getInstance(encryptedKey.getAlgName()); // Initialize PBE Cipher with key and parameters pbeCipher.init(Cipher.DECRYPT_MODE, passKey, encryptedKey.getAlgParameters()); // Decrypt the private key(throws the exception) return pbeCipher.doFinal(key); } I get the following stack trace on the return statement above: Exception in thread "main" javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:750) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676) at com.sun.crypto.provider.PBECipherCore.doFinal(PBECipherCore.java:422) at com.sun.crypto.provider.PBEWithMD5AndDESCipher.engineDoFinal(PBEWithMD5AndDESCipher.java:316) at javax.crypto.Cipher.doFinal(Cipher.java:2087) at roland.test.crypto.Test.decryptPrivateKey(Test.java:96) at roland.test.crypto.Test.getPrivateKey(Test.java…

http://stackoverflow.com/comment/40970060
has text: Great tut! But I'd suggest NOT leaving the variable declaration part out of the tutorial. Also - show methods like createContactAddress() and createViaHeader(). Details are what usually get beginners like me :)
type: Comment
comment on: http://stackoverflow.com/a/25914564
type: AnswerComment
score: 0

http://stackoverflow.com/q/25910341
tagged with: eclipse-luna
has comment: http://stackoverflow.com/comment/40555973
has comment: http://stackoverflow.com/comment/40555981
has title: Not able to create Dynamic web project in Eclipse Luna
has body: I have installed Eclipse Luna for windows 64 bit. But I am not able to create a new Dynamic Web Project. I also installed Web, XML, Java EE and OSGi Enterprise Development , but still it shows only Static Web Project inside Web projects. Is there anything else to be installed ?
has answer: http://stackoverflow.com/a/25910792
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/29798849
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40555904
has answer: http://stackoverflow.com/a/29798849
type: Question
has comment: http://stackoverflow.com/comment/40556335
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/29150032
has comment: http://stackoverflow.com/comment/40556282
downvote count: 0
accepted answer: http://stackoverflow.com/a/25910792
answer count: 3
has comment: http://stackoverflow.com/comment/40556085
has comment: http://stackoverflow.com/comment/40556403
favorite count: 0
linked to: http://stackoverflow.com/q/25126669

http://stackoverflow.com/comment/48668396
score: 0
comment on: http://stackoverflow.com/a/25903725
type: AnswerComment
has text: @delive Use singletons and init them in your main controller, for example.
type: Comment

http://stackoverflow.com/comment/40599681
has text: I'm going to print all JPanel individually. I think that it is the best way
comment on: http://stackoverflow.com/a/25919384
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40565078
has text: @JonSkeet In summary I'm trying to remove all whitespace repetitions that are not line breaks while writing into a `Writer`. For example, the output for `this is an\n example` would be `this is an\nexample`. I also make other complex operations.
score: 0
comment on: http://stackoverflow.com/q/25915073
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25984711
type: Answer
has body: for(int i = 0; i &lt; 100; i++){ x++; y++; panel.repaint(); try{ Thread.sleep(50); } catch(Exception ex){} } x and y are int types, not pointers. so when you do x++ and y++. it is actually not updating the x, y values which you passed in in the constructor
score: 0
answers question: http://stackoverflow.com/q/25984671

http://stackoverflow.com/comment/40585726
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25925822
has text: @WeVie you are welcome. Well not really, always learn from your mistakes is all I can say. The more you code the better you will get so just remember what you did wrong now for next time :)
score: 0

http://stackoverflow.com/comment/40682844
score: 0
type: AnswerComment
has text: this seems like it would work, when the button has a string, and when the property is literal rather "built". Sometimes the gettext property name is more dynamically constructed. Also sometimes said text could come from something like a database.
type: Comment
comment on: http://stackoverflow.com/a/25980488

http://stackoverflow.com/q/25905073
has body: I have configured the maven surefire-report-plugin as well: org.apache.maven.plugins maven-surefire-report-plugin 2.17 ${myPath} UTF-8 create-surefire-report test report Here is the configuration of the Maven-surefire-plugin: org.apache.maven.plugins maven-surefire-plugin 2.16 false How can I solve this problem? What should be changed in this configuration? Thanks !
score: 0
answer count: 1
tagged with: maven
tagged with: maven-surefire-plugin
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40552008
tagged with: java
has answer: http://stackoverflow.com/a/25905532
has title: Why the Maven surefire-report-plugin creates the error message "Character encoding ${outputEncoding} is not supported by this plattform"?
type: Question
accepted answer: http://stackoverflow.com/a/25905532

http://stackoverflow.com/comment/40726928
comment on: http://stackoverflow.com/q/26004603
has text: I think, your first version would not work the way you want. Since you have to supply the parameters to the constructor, you could just write the formatted text. Remove "params" as parameter and member and use your getMessage method.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/25964838
has body: The Linux inotify API can emit an IN_ACCESS event for a watched file. Unfortunately, for some reason (Windows compatibility?), the default Java APIs don't expose this. The third-party library https://bitbucket.org/nbargnesi/inotify-java loads a C++ .so lib that hooks into the native libraries to get around this. I haven't used the library personally, but reading around the test files a basic approach seems to be: InotifyContext ic = new InotifyContext(); Random random = new Random(); // for generating file descriptors ic.addPath("file/you/want/to/monitor", random.nextInt()); final InotifyEventListener i = new InotifyEventListener() { @Override public void filesystemEventOccurred(InotifyEvent e) { if (e.isAccess()) // handle file being accessed } }; ic.addListener(i, random.nextInt()); Note: This catches any read from a file, e.g. your own program (I think, you'd need to test that), the user simply opening the file in a text editor and immediately closing it without doing anything, some filesystem crawler automatically finding the file and scanning it for viruses (although Linux, so...). You'll probably want to do some additional checking on the event before immediately yelling at the user or whatever.
answers question: http://stackoverflow.com/q/25964515
score: 0
has comment: http://stackoverflow.com/comment/40719078
type: Answer

http://stackoverflow.com/comment/40576118
has text: You should never use a KeyListener in a JTextField as it will mess up the JTextField's processing of text (which goes through key bindings). Better to add an ActionListener to your JTextField as this will be activated on pressing the enter key.
comment on: http://stackoverflow.com/a/25918655
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40730611
has text: @LJ_1102 The class name isn't necessary as the methods are part of the same class, however some will tell you it is a best practice.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26006827

http://stackoverflow.com/a/25942940
downvote count: 0
score: 9
answers question: http://stackoverflow.com/q/25942911
has body: You cannot. The best you can do is implement stubs that throw something like NotImplementedException and document this fact. I would use this as an opportunity to examine the definition of the top-level interface. If you need to hide some of its methods then the real problem may be that it aggregates unrelated functionality. You may need to split it into two separate interfaces. Remember, you can "inherit" (i.e. implement) multiple interfaces.
upvote count: 9
has comment: http://stackoverflow.com/comment/40616071
type: Answer

http://stackoverflow.com/q/25959518
has title: how to input data into an arraylist for user defined class?
has comment: http://stackoverflow.com/comment/40643523
has comment: http://stackoverflow.com/comment/40643544
type: Question
has answer: http://stackoverflow.com/a/25959917
has body: for(i=0;i&lt;in.length;i++) { for(j=i+1;j&lt;in.length;j++) { //System.out.println("for"+in[i].val); //System.out.println("for "+in[j].val); if(comp(in[i].bin,in[j].bin,n)!=null) { String bi=comp(in[i].bin,in[j].bin,n); //System.out.println("is it null "+co[k]); coin.a(in[i],in[j],bi);//taken input co.add(coin);//now passing to array list HERE LIES THE PROBLEM!!! System.out.println(in[i].val+","+in[j].val+"="+coin.bin); in[i].combo=true; in[j].combo=true; k++; } } } 55f96302address of coin 55f96302 55f96302address of coin @55f96302 55f96302address of coin @55f96302 55f96302address of coin @55f96302 55f96302address of coin @55f96302 55f96302address of coin @55f96302 55f96302address of coin @55f96302 55f96302address of coin @55f96302 55f96302address of coin @55f96302 As you can see the reference of all elements in the list is same as that of "coin" what should i do to solve this?
has comment: http://stackoverflow.com/comment/40643536
has comment: http://stackoverflow.com/comment/40643530
tagged with: arraylist
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40643711
has comment: http://stackoverflow.com/comment/40643564
has answer: http://stackoverflow.com/a/25959614
has comment: http://stackoverflow.com/comment/40643748
has comment: http://stackoverflow.com/comment/40643534
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/40562745
comment on: http://stackoverflow.com/q/25904827
has text: I am attempting to make AwddbWebService_Service a reference to the package usda.nrcs.wcc.awdbWebService which I generated from a wsimport from the wsdl @ http://www.wcc.nrcs.usda.gov/awdbWebService/services?WSDL -- so the package contains multiple methods/java classes. My intent is to use m_webService to make the calls from.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26019132
answer count: 5
has answer: http://stackoverflow.com/a/26019282
has answer: http://stackoverflow.com/a/26019182
type: AnsweredQuestion
tagged with: java
has body: I have this string in my Android Application: /storage/emulated/0/temp.jpg I need manipulate the string and to split the string for this output: temp.jpg I need always take the last element of the string. How to this output in java? I would greatly appreciate any help you can give me in working this problem.
has comment: http://stackoverflow.com/comment/40753168
type: Question
upvote count: 15
tagged with: split
has answer: http://stackoverflow.com/a/26019206
linked to: http://stackoverflow.com/q/3481828
possible better answer: http://stackoverflow.com/a/26019243
downvote count: 0
duplicate of: http://stackoverflow.com/q/14526260
has answer: http://stackoverflow.com/a/26019243
score: 15
tagged with: android
has answer: http://stackoverflow.com/a/26019213
favorite count: 0
accepted answer: http://stackoverflow.com/a/26019206
has title: How to split a file path to get the file name?

http://stackoverflow.com/comment/40586009
type: Comment
comment on: http://stackoverflow.com/q/25926518
has text: Have you read this: http://stackoverflow.com/questions/2723397/java-generics-what-is-pecs
score: 1
type: QuestionComment

http://stackoverflow.com/q/25969320
has title: How to configure m2e eclipse plugin to support parent version ranges?
has answer: http://stackoverflow.com/a/26172119
type: AnsweredQuestion
tagged with: maven
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26172119
has body: Since Maven 3.2.2 supports defining the pom's parent version with ranges, is it possible to configure m2e plugin to resolve the version range? How? Edit 1: (2014-09-29 @ 09:50 AEST) Scenario: Importing a maven project with the following parent definition into eclipse with m2e plugin (the project is not a module of its parent) artifactId groupId [1.0,1.1) M2E plugin fails to resolve the version range, showing this error message in the POM editor: Could not transfer artifact groupId:artifactId:pom:[1.0,1.1) from/to nexus-releases (http://nexus.proxy/content/groups/public/): Illegal character in path at index 82: http://nexus.proxy/content/groups/public/groupId/artifactId/[1.0,1.1)/artifactId-[1.0,1.1).pom and 'parent.relativePath' points at wrong local POM It works when running with Run as... > Maven install, see the log snippet below: [INFO] Scanning for projects... [INFO] Downloading: http://nexus.proxy/content/groups/public/groupId/artifactId/maven-metadata.xml [INFO] Downloading: http://nexus.proxy/content/groups/public/groupId/artifactId/maven-metadata.xml [INFO] Downloading: http://nexus.proxy/content/groups/public-snapshot/groupId/artifactId/maven-metadata.xml [INFO] Downloaded: http://nexus.proxy/content/groups/public-snapshot/groupId/artifactId/maven-metadata.xml (488 B at 0.8 KB/sec) [INFO] Downloaded: http://nexus.proxy/content/groups/public/groupId/artifactId/maven-metadata.xml (2 KB at 2.1 KB/sec) [INFO] Downloaded: http://nexus.proxy/content/groups/public/groupId/artifactId/maven-metadata.xml (2 KB at 2.1 KB/sec) [INFO] Downloading: http://nexus.proxy/content/groups/public/groupId/artifactId/[1.0,1.1)/artifactId-[1.0,1.1).pom [INFO] Downloading: http://nexus.proxy/content/groups/public/groupId/artifactId/[1.0,1.1)/artifactId-[1.0,1.1).pom PS.: The question is not whether or not this is a good practice, please refer to Benjamin's comment for some background. Related to How to configure maven or eclipse in order to use the RELEASE constant within versions?
tagged with: java
linked to: http://stackoverflow.com/q/12371231
tagged with: m2e
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40690497
has comment: http://stackoverflow.com/comment/40667579
answer count: 1
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/q/25972946
favorite count: 0
tagged with: regex
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25972978
tagged with: java
type: Question
answer count: 2
score: 5
upvote count: 5
downvote count: 0
has body: The online REGEX testers shows the non-captuting groups are getting ignored but from java code it is not ignored. import java.util.*; import java.lang.*; import java.io.*; import java.util.regex.Matcher; import java.util.regex.Pattern; class Ideone { public static void main (String[] args) throws java.lang.Exception { Pattern PATTERN = Pattern.compile("(?:execute: ID: \\[\\s)([0-9]*)(?:\\s\\])"); Matcher matcher = PATTERN.matcher("controllers.pring execute: ID: [ 290825814 ] executing bean: [ strong ]"); if (matcher.find()) { System.out.println(matcher.group(0)); } } } Output execute: ID: [ 290825814 ] Expected 290825814
accepted answer: http://stackoverflow.com/a/25972978
has answer: http://stackoverflow.com/a/25972985
has title: Non-Capturing group regex not working in Java
possible better answer: http://stackoverflow.com/a/25972985

http://stackoverflow.com/q/25892982
has answer: http://stackoverflow.com/a/25893045
tagged with: exception
tagged with: sql
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40524438
favorite count: 0
has title: Exception Handling using while loop
has answer: http://stackoverflow.com/a/25893181
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25893181
has comment: http://stackoverflow.com/comment/40546892
downvote count: 0
has body: i am using postgreSql and Java , here is the error shown in eclipse console org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "km_rel_user_test_details_pkey", Here the cause of the error is(i guess ) due to duplicate key present in database , I have written a while loop to handle this exception, i just want to know, whether this approach is correct and will work for every situation, any error found/ ask for improvement will be appreciated, thanks in advance, here is my java method. public String saveConceptTestDetails(String testId,String userId,String selected_ans, String check_user_save, String conceptTestOrder , int ans) { boolean isInserted=false; String newId1=null; while(!isInserted){ try{ newId1=getNextVal(DBKeys.SEQ_REL_USER_TEST_DETAILS); // this is what generatres new Id Hashtable resultHash=executeUpdate(new StringBuffer(" insert into "+DBKeys.TABLENAME_REL_USER_TEST_DETAILS+" ("+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_ID+","+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_TESTID+","+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_USERID+","+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_CREATEDDT+","+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_MODIFIEDDT+","+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_SELECTED_ANS+","+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_CHECK_USER_SAVE_TEST+","+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_TEST_TYPEORDER+","+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_TEST_VERSION+","+DBKeys.COLUMNNAME_REL_USER_TEST_DETAILS_SAVEANS+")values ("+newId1+","+testId+","+userId+",current_date,current_date,"+selected_ans+","+check_user_save+","+conceptTestOrder+",0,"+ans+")")); isInserted=true; } catch (Exception e) { System.out.println("Exception"); isInserted=false; } } return newId1; }
has comment: http://stackoverflow.com/comment/40524590
possible better answer: http://stackoverflow.com/a/25893045
tagged with: postgresql
has comment: http://stackoverflow.com/comment/40527699

http://stackoverflow.com/a/25983990
type: Answer
has body: Font#createFont returns a font of 1pt...you should assign the result to a Font variable and use Font#deriveFont to specify a size and style
answers question: http://stackoverflow.com/q/25983787
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/40594470
comment on: http://stackoverflow.com/a/25926675
score: 0
type: AnswerComment
has text: this is too costly operation and is not efficient as we are incrementing values and checking the characters for each value
type: Comment

http://stackoverflow.com/comment/40527667
type: QuestionComment
comment on: http://stackoverflow.com/q/25894686
score: 1
has text: In that case the method is not executed in a transaction
type: Comment

http://stackoverflow.com/q/25902974
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/68324204
tagged with: mapreduce
has answer: http://stackoverflow.com/a/68324204
type: Question
tagged with: hadoop
answer count: 2
score: 0
tagged with: classnotfoundexception
accepted answer: http://stackoverflow.com/a/25903442
has body: I have written a mapper program with an intention to read JSON data. The code looks like this: public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { System.out.println("Into Map"); try { String line = value.toString(); JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = new JSONObject(); jsonObject = (JSONObject) jsonParser.parse(line); String content = (String) jsonObject.get("content"); System.out.println(content); StringTokenizer tokenizer = new StringTokenizer(content); while (tokenizer.hasMoreTokens()) { word.set(tokenizer.nextToken()); String strword = word.toString(); context.write(word, one); } } catch (ParseException ex) { ex.printStackTrace(); } } However, when I try to run the mapper, I get following error: Error: java.lang.ClassNotFoundException: org.json.simple.parser.ParseException at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:249) at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:810) at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:855) at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:199) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:718) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:364) at org.apache.hadoop.mapred.Child$4.run(Child.java:255) 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:1190) at org.apache.hadoop.mapred.Child.main(Child.java:249) Can someon…
has answer: http://stackoverflow.com/a/25903442
has title: Getting "java.lang.ClassNotFoundException: org.json.simple.parser.ParseException" while reading JSON object as input value of mapper
type: AnsweredQuestion

http://stackoverflow.com/comment/40523197
type: QuestionComment
score: 0
has text: `LIMIT` is 0x7FFFFFFF except on very old versions of Windows when it is 0x7FFF.
comment on: http://stackoverflow.com/q/25891029
type: Comment

http://stackoverflow.com/comment/40681145
score: 1
has text: @brso05 Serious question: where does it say that on the site? I haven't seen those two items prioritized anywhere.
comment on: http://stackoverflow.com/q/25979664
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25983096
has answer: http://stackoverflow.com/a/25983223
type: UnansweredQuestion
upvote count: 1
has body: I'm using an array of String[3] to store user input which is got from 4 JTextFields I then output the array to a txt file: String[] userInfo = new String[3]; userInfo[0] = sourceTextField.getText(); userInfo[1] = usernameTextField.getText(); userInfo[2] = passwordTextField.getText(); userInfo[3] = emailTextField.getText(); for (String userInfo1 : userInfo) { try { BufferedWriter writer = new BufferedWriter(new FileWriter("C:\\Users\\Peace Infinity\\Desktop\\[programming]Projects\\DataFiles\\PasswordRepository.txt", true)); String s; s = userInfo1; writer.write(s + " "); writer.flush(); }catch (IOException ex) { Logger.getLogger(ADD_dialogBox_v1.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(null, "Error processing file!"); } } Can someone tell me why I'm getting exception "array index out of bounds"? Thank you
downvote count: 1
duplicate of: http://stackoverflow.com/q/1200621
tagged with: bufferedwriter
tagged with: java
tagged with: filewriter
tagged with: jtextfield
type: Question
has answer: http://stackoverflow.com/a/25994028
tagged with: arrays
linked to: http://stackoverflow.com/q/3988788
favorite count: 0
score: 0
has title: Array "out of bounds"
answer count: 3
duplicate of: http://stackoverflow.com/q/3988788
has answer: http://stackoverflow.com/a/25983259
linked to: http://stackoverflow.com/q/1200621

postgresql
tags question: http://stackoverflow.com/q/25932934
tags question: http://stackoverflow.com/q/25951491
tags question: http://stackoverflow.com/q/25930119
tags question: http://stackoverflow.com/q/25932089
tags question: http://stackoverflow.com/q/25889105
tags question: http://stackoverflow.com/q/25892982
tags question: http://stackoverflow.com/q/26031243
tags question: http://stackoverflow.com/q/25978233
tags question: http://stackoverflow.com/q/25985482
tags question: http://stackoverflow.com/q/25938594
tags question: http://stackoverflow.com/q/25911678
tags question: http://stackoverflow.com/q/25960847
tags question: http://stackoverflow.com/q/25960146
tags question: http://stackoverflow.com/q/25931397
tags question: http://stackoverflow.com/q/25930628
tags question: http://stackoverflow.com/q/25911359
tags question: http://stackoverflow.com/q/26030196
tags question: http://stackoverflow.com/q/25896073
tag name: postgresql
tags question: http://stackoverflow.com/q/25950605
type: Tag
tags question: http://stackoverflow.com/q/25930427
tags question: http://stackoverflow.com/q/25999014
tags question: http://stackoverflow.com/q/25895645
tags question: http://stackoverflow.com/q/25939624
tags question: http://stackoverflow.com/q/26003074
tags question: http://stackoverflow.com/q/26025405
tags question: http://stackoverflow.com/q/25954286
tags question: http://stackoverflow.com/q/25968660

http://stackoverflow.com/comment/40521070
comment on: http://stackoverflow.com/a/25890278
has text: @TheLostMind: Exactly, and I made that implicit thinking to work like explicit
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40620102
has text: Don't put `test` in the cell, put the actual value you want in that cell. Other wise you need to re-arrange your data
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25945630
type: Comment

http://stackoverflow.com/comment/40570886
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25897388
has text: I am using multiple classes, the main one just happens to be big. Not why I came here. Render is called every frame, yes. `target = new Rectangle(x, y, 64, 64);` is how I create the rectangle, and then I draw a texture on the same coordinates.

http://stackoverflow.com/comment/40618385
type: QuestionComment
comment on: http://stackoverflow.com/q/25944389
has text: yes ... my guess is that something is blocking Java from opening the local connection :P
score: 0
type: Comment

http://stackoverflow.com/a/25976077
has comment: http://stackoverflow.com/comment/40674168
has comment: http://stackoverflow.com/comment/40674112
accepted answer of: http://stackoverflow.com/q/25975988
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40695773
upvote count: 1
type: Answer
has body: You can use this bit to get the pid: JBOSS_PID=`ps -ef | grep org.jboss.modules.Main | grep -v grep | awk '{print $2}'` This is an example for a jboss server, you can see the main class in the grep. Switch this for your own class. If the pid does not exist, start it. Run as frequently as you want.
has comment: http://stackoverflow.com/comment/40674352
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25975988

http://stackoverflow.com/a/25955190
accepted answer of: http://stackoverflow.com/q/25955149
has body: This is constructor chaining. Constructor chaining occurs through the use of inheritance. A subclass constructor method's first task is to call its superclass' constructor method. First the constructor of base class will run and then only the constructor of the child class or deriving class will run. As you have extended class javax.mail.Authenticator , the constructor gets called automatically
has comment: http://stackoverflow.com/comment/40636033
score: 0
has comment: http://stackoverflow.com/comment/40635980
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40636068
has comment: http://stackoverflow.com/comment/40636092
type: Answer
answers question: http://stackoverflow.com/q/25955149

http://stackoverflow.com/q/25961581
tagged with: string
score: 0
tagged with: byte
has comment: http://stackoverflow.com/comment/40647681
answer count: 0
tagged with: biginteger
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40657982
has comment: http://stackoverflow.com/comment/40648510
type: Question
tagged with: java
has body: I got a little problem, I got this lines of code: for(int i = 0; i&lt;splits.length; i++){ if(splits[i].length() &lt; 8){ remainder = splits[i]; } else if(splits[i].length() == 8){ System.out.println("'"+splits[i]+"'"); byte[] bval = new BigInteger(splits[i], 2).toByteArray(); dos.write(bval); } } So the problem is on this line: byte[] bval = new BigInteger(splits[i], 2).toByteArray(); Here is what the print returns: '11111111' '11111110' '11111111' '11111011' '11111111' '11111101' '11111111' '11111110' '11111011' '11111111' '11111110' So it just crashes for no apparent reason as 11111110 is there multiple times. Why is that?
tagged with: numberformatexception
has title: Zero length BigInteger (Transforming string into bytes)
has comment: http://stackoverflow.com/comment/40647697

http://stackoverflow.com/q/25894285
has body: In a type promotion example I am getting the output as 515. I know that the value of char c (which is 'a') after it gets promoted to an int; but on what system is the value of char decided while promoting it to int? public class Main { public static void main(String args[]) { char c = 'a'; int i = 50000; int result = i / c; System.out.println("i / c is " + result); } }
answer count: 1
has answer: http://stackoverflow.com/a/25894312
tagged with: type-promotion
favorite count: 0
has comment: http://stackoverflow.com/comment/40528176
has comment: http://stackoverflow.com/comment/40527358
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25894312
tagged with: java
downvote count: 2
has title: how is the value coming after type promotion?
upvote count: 1
type: Question
score: -1

http://stackoverflow.com/q/25909540
type: UnansweredQuestion
type: Question
tagged with: oracle-database
tagged with: sql
has answer: http://stackoverflow.com/a/29077273
has body: I am using ibatis SCRIPRunner which supports triggers and procedure for running my sql script on oracle db but some create statement are failing for with ivalid charcter can any one help me which character it is taking as invalid character Executing: ALTER TABLE BFTB_BUSINESSDATELOG ADD CONSTRAINT PK_BUSINESSDTLOG PRIMARY KEY (BFBUSINESSDATEIDPK); CREATE TABLE BFTB_CATEGORY ( BFCATEGORYIDPK VARCHAR(30) NOT NULL, BFCATEGORYTYPE VARCHAR(10), BFDESCRIPTION VARCHAR(40), VERSIONNUM INTEGER, BFAPPLICATIONID VARCHAR(100) ) Error: ORA-00911: invalid character Executing: ALTER TABLE BFTB_CATEGORY ADD CONSTRAINT PK_CATEGORY PRIMARY KEY (BFCATEGORYIDPK); CREATE TABLE BFTB_CTGARTEFACTLINK ( BFLINKIDPK VARCHAR(20) NOT NULL, BFARTEFACTNAME VARCHAR(256), BFCATEGORYID VARCHAR(30), VERSIONNUM INTEGER, BFARTEFACTID VARCHAR(256), BFAPPLICATIONID VARCHAR(100) ) Error: ORA-00911: invalid character script runner package com.rj.installer.action; public class ScriptRunner { private static final String LINE_SEPARATOR = System.getProperty("line.separator","\n"); private static final String DEFAULT_DELIMITER = ";"; private FileOutputStream logFile ; private BufferedWriter writer ; private MyLogger logs ; private static final String S_N = "(\\s|\\n)+"; private static final String IDENTIFIER = "(\\S+|\"[^\"]+\")"; private static final String BLOCK_START = "(^|" + S_N + ")" + "create" + S_N + "(or" + S_N + "replace" + S_N + ")?" + "(function|library|package(" + S_N + "body)?|procedure|trigger|type)" + S_N + IDENTIFIER + S_N + ".*"; private final Pattern blockStart = Pattern.compile(BLOCK_START, Pattern.CASE_INSENSITIVE); private Connection connection; private boolean stopOnError; private boolean autoCommit; private boolean sendFullScript; private PrintWriter logWriter = new PrintWriter(System.out); private PrintWriter errorLogWriter = new PrintWriter(System.err); private String DatabaseProductName; private String delimiter = DEFAULT_DELIMITER; private boolean fullLineDelimiter = false; public Sc…
answer count: 1
score: 0
tagged with: java
has title: ibatis scriptrunner failing to create table-says invalid character

http://stackoverflow.com/a/26020363
upvote count: 0
score: -1
has body: 1.Split the String by space. 2.In String array check the length of each string and make the choice.
answers question: http://stackoverflow.com/q/26020326
downvote count: 1
type: Answer

http://stackoverflow.com/comment/40588952
score: 0
type: Comment
type: QuestionComment
has text: setReceipient method is not for this purpose. Setting pRecipient to null will not help as it is setting value to some variable which already has retained previous emails.
comment on: http://stackoverflow.com/q/25927922

http://stackoverflow.com/q/25903686
linked to: http://stackoverflow.com/q/25903504
downvote count: 0
has comment: http://stackoverflow.com/comment/115596524
favorite count: 0
has answer: http://stackoverflow.com/a/71797630
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26157868
upvote count: 29
has comment: http://stackoverflow.com/comment/40550289
has answer: http://stackoverflow.com/a/49608811
tagged with: java
score: 29
has body: I just finished posting this issue on SO about Lombok not generating my getters/setters. It turns out that it is conflicting with AspectJ. If I disable AspectJ, then the getters/setters are appropriately generated. My guess is that the ajc compiler is not able to recognize lombok. Are Lombok and AspectJ mutually exclusive? Do both technologies work together?
type: Question
tagged with: lombok
has title: How to make Lombok and AspectJ work together?
has comment: http://stackoverflow.com/comment/40567586
tagged with: aspectj
answer count: 3

http://stackoverflow.com/a/25949133
score: 1
answers question: http://stackoverflow.com/q/25948806
upvote count: 1
has body: Simple convert of your string to int array: private int[] convertStringToIntArray(String str) { int[] resultArray = new int[str.length()]; for (int i = 0; i &lt; str.length(); i++) resultArray[i] = Character.getNumericValue(str.charAt(i)); return resultArray; }
type: Answer
downvote count: 0

http://stackoverflow.com/q/25915598
tagged with: jax-ws
has comment: http://stackoverflow.com/comment/40566763
answer count: 2
has answer: http://stackoverflow.com/a/30681267
downvote count: 0
has title: Disable Jax-WS Apache CXF HTTPConduit Message Logging
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40566110
has body: I've been stuck on this one the last couple of days to no avail and after a lot of googling and trial and error I'm back at the beginning with no luck. I'm currently working on a Java Application which connects to a third party via JAX-WS. They provide a WSDL which we run in using the jaxws-maven-plugin to generate the services. Implemented via Spring, HTTPConduit is then used to change the endpoints and provide relevant config (e.g. keystores) for connecting to various environments (e.g. SysTest, UAT, Production etc). The issue is, I haven't set any logging (in fact removing the two interceptors there previously), however the xml message being sent to the third party is appearing in the logs. This is a major issue as we're sending credit card information to the third parties which can no way be logged for obvious reasons. I can change the log4j properties in order to prevent the logging that way, but that's no way a fix. Here is some code: This is our beans file. &lt;jaxws:client id="client1" xmlns:hsn="http://example.com" serviceClass="com.example.Service1" address="${service1.url}" endpointName="hsn:service1"/&gt; &lt;jaxws:client id="client2" xmlns:hsn="http://example.com" serviceClass="com.example.Service2" address="${service2.url}" endpointName="hsn:service2"/&gt; &lt;jaxws:client id="client3" xmlns:hsn="http://example.com" serviceClass="com.example.Service3" address="${service3.url}" endpointName="hsn:service3"/&gt; &lt;http:conduit name="https://*/.*"&gt; &lt;http:tlsClientParameters disableCNCheck="${service.disable-cn-check}"&gt; &lt;sec:keyManagers keyPassword="${service.keystore.password}"&gt; &lt;sec:keyStore type="JKS" password="${service.keystore.password}" resource="${service.keystore.name}"/&gt; &lt;/sec:keyManagers&gt; &lt;sec:trustManagers&gt; &lt;sec:keyStore type="JKS" password="${service.truststore.password}" resource="${service.truststore.name}"/&gt; &lt;/sec:trustManagers&gt; &lt;sec:cipherSuitesFilter&gt; &lt;sec:include&gt;.*_EXPORT_.*&lt;/…
tagged with: cxf
type: UnansweredQuestion
upvote count: 1
tagged with: spring
tagged with: logging
has comment: http://stackoverflow.com/comment/40569288
type: Question
has answer: http://stackoverflow.com/a/25920676
tagged with: java

http://stackoverflow.com/comment/48947600
type: Comment
type: QuestionComment
has text: Not really, I found that you can add an option within the web service to log the xml in the OC4J logs, but not how to capture the XML itself in code.
score: 0
comment on: http://stackoverflow.com/q/25880119

http://stackoverflow.com/comment/40631162
score: 0
comment on: http://stackoverflow.com/q/25912037
type: QuestionComment
type: Comment
has text: It's not entirely clear whether the problem is solved now. (But I +1'ed the question, for the research and information that you provided in the question until now)

http://stackoverflow.com/a/26001211
has body: Instead of your way, you can store the key and values in JSON format. That way it would be easier for you to parse the data and get the value based on the item number (key). You can even use Google's Gson lib o make things simpler. JSON.simple example – Read and write JSON will help as well.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40720374
type: Answer
accepted answer of: http://stackoverflow.com/q/26000508
answers question: http://stackoverflow.com/q/26000508
score: 0

http://stackoverflow.com/comment/40776183
type: QuestionComment
comment on: http://stackoverflow.com/q/26028542
has text: Are you using jvlc, or vlcj? You may like to check your tag.
score: 0
type: Comment

audio
tags question: http://stackoverflow.com/q/26017835
tags question: http://stackoverflow.com/q/25956415
type: Tag
tag name: audio
tags question: http://stackoverflow.com/q/25927751
tags question: http://stackoverflow.com/q/25996956
tags question: http://stackoverflow.com/q/25932983
tags question: http://stackoverflow.com/q/26028044
tags question: http://stackoverflow.com/q/25954052

http://stackoverflow.com/q/25908343
downvote count: 8
has answer: http://stackoverflow.com/a/25909079
accepted answer: http://stackoverflow.com/a/25909079
answer count: 1
favorite count: 0
score: -8
tagged with: android
has body: I have day of week. And 2 buttons, I just need to set next day and previous on click switch (dayOfWeek) { case Calendar.MONDAY: text1.setText("some text for MONDAY"); break; case Calendar.TUESDAY: text1.setText("some Text for TU"); break; case Calendar.WEDNESDAY: text1.setText("WEn"); break; case Calendar.THURSDAY: text1.setText("TH"); etc.. And Buttons btnPlus.setOnClick...{ //from case1 to case2, from case2 to case3 etc } btnMnius.setOnCli..{ //from case1 to case7 } I need a loop something like this http://www.java-examples.com/display-day-week-using-java-calendar
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has title: Day of week Android

http://stackoverflow.com/q/25951858
has body: I wrote a small program to check the given movie name exist in a folder. I am getting the warning on eclipse "the value of local variable is not used" Here is the main method public static void main(String[] args) { // TODO Auto-generated method stub boolean movie_exist=false; System.out.println("Hellow world!"); try{ FileWriting newfolrder = new FileWriting("H:\\breakinbad2\\Breaking Bad Season 2 Complete 720p.BRrip.Sujaidr"); //movie_exist=newfolrder.checkfilesname("Movie name"); System.out.println(newfolrder.checkMovieExist("Breaking Bad")); movie_exist = newfolrder.checkMovieExist("Breaking Bad"); }catch(NullPointerException e){ System.out.println("Exception is :"+ e); } } I get the warning against this variable declaration boolean movie_exist=false; I have assign a value to the variable. movie_exist = newfolrder.checkMovieExist("Breaking Bad"); Why do I get this warning?
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40629384
score: 1
tagged with: java
type: Question
answer count: 2
duplicate of: http://stackoverflow.com/q/11062919
has title: the value of local variable is not used
has answer: http://stackoverflow.com/a/25951882
downvote count: 0
possible better answer: http://stackoverflow.com/a/25951885
has answer: http://stackoverflow.com/a/25951885
has comment: http://stackoverflow.com/comment/40630263
favorite count: 0
accepted answer: http://stackoverflow.com/a/25951882
linked to: http://stackoverflow.com/q/11062919

http://stackoverflow.com/comment/40648079
has text: k can you check it now please?? :)
comment on: http://stackoverflow.com/a/25961203
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40723194
comment on: http://stackoverflow.com/q/26002738
type: Comment
type: QuestionComment
score: 0
has text: @AIL I have the semicolon there it probably got removed when i copied it

http://stackoverflow.com/a/25892425
type: Answer
has comment: http://stackoverflow.com/comment/40529548
upvote count: 3
has comment: http://stackoverflow.com/comment/40533425
has comment: http://stackoverflow.com/comment/40528976
score: 3
has body: You can do try (InputStream s1 = new FileInputStream("file"); InputStream s2 = new BufferedInputStream(s1); ZipInputStream zin = new ZipInputStream(s2)) { // ... } catch (IOException e) { // ... } Further reading: The Java™ Tutorials: The try-with-resources Statement.
answers question: http://stackoverflow.com/q/25892379
has comment: http://stackoverflow.com/comment/40526307
downvote count: 0
has comment: http://stackoverflow.com/comment/40532452
has comment: http://stackoverflow.com/comment/40528018

http://stackoverflow.com/a/26015931
has body: In C++, you have to declare as: Piece *** myPieces; then, allocate as: myPieces = new Piece **[8]; then, for (int i = 0; i &lt; 8; i++) { myPieces[i] = new Piece *; } Now, if you do, myPieces[0][0] = new Piece(); // C++, calls default constructor of Piece In Java, Piece[][] myPieces; myPieces = new Piece[8][8]; now, if you do, myPieces[0][0] = new Piece(); // Java, calls default constructor of Piece Since you have 8x8 known already, you may also declare as (in C++): Piece * myPieces[8][8]; // 64 pointers preallocated as 8 rows, 8 cols then, Now, if you do, for (int i = 0; i &lt; 8; i++) { for (int j = 0; j &lt; 8; j++) { myPieces[i][j] = new Piece(); // or new Pawn or new Knight etc, subclass of Piece }} or allocate as needed e.g. myPieces[0][0] = new Piece(); // or new Pawn or new Knight etc, subclass of Piece
answers question: http://stackoverflow.com/q/26015704
has comment: http://stackoverflow.com/comment/40747895
has comment: http://stackoverflow.com/comment/40747810
has comment: http://stackoverflow.com/comment/40750063
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/40747755
has comment: http://stackoverflow.com/comment/40747678
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40783308

http://stackoverflow.com/comment/40719080
has text: You need to split the string with a valid character and not "" ... check my solution ... for a similar issue ...
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25998990
type: AnswerComment

http://stackoverflow.com/q/26009223
tagged with: java
tagged with: middleware
type: Question
score: 0
has answer: http://stackoverflow.com/a/26014220
tagged with: apache
answer count: 1
tagged with: jms
has body: What all problems with broker or network can be detected using Transport Listener? I am using failover uri with master/slave architecture. I want my clients to get notify if there is any problem with connection from client to broker. Though as soon as there will be problem with primary, failover will takeover and vice versa, but I want my client to know that there was some problem. I know I can implement TransportListener and set it to my connection..but what all can be detected using TransportListener?
has title: What all problems with broker or network can be detected using Transport Listener?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26014220
tagged with: activemq-classic

http://stackoverflow.com/comment/40596665
score: 0
comment on: http://stackoverflow.com/q/25921226
type: Comment
type: QuestionComment
has text: Thanks, that was it! It's always the little things that one doesn't notice.

eclipse
tags question: http://stackoverflow.com/q/25893178
tags question: http://stackoverflow.com/q/25884837
tags question: http://stackoverflow.com/q/25908719
tags question: http://stackoverflow.com/q/26032311
tags question: http://stackoverflow.com/q/25915548
tag name: eclipse
tags question: http://stackoverflow.com/q/25970318
tags question: http://stackoverflow.com/q/25990294
tags question: http://stackoverflow.com/q/25890617
tags question: http://stackoverflow.com/q/25952307
tags question: http://stackoverflow.com/q/25959311
tags question: http://stackoverflow.com/q/25915717
tags question: http://stackoverflow.com/q/25951758
tags question: http://stackoverflow.com/q/26029109
tags question: http://stackoverflow.com/q/25885323
tags question: http://stackoverflow.com/q/25958471
tags question: http://stackoverflow.com/q/26021189
tags question: http://stackoverflow.com/q/25953687
tags question: http://stackoverflow.com/q/25898988
tags question: http://stackoverflow.com/q/26027475
tags question: http://stackoverflow.com/q/25921597
tags question: http://stackoverflow.com/q/26024326
tags question: http://stackoverflow.com/q/25909854
tags question: http://stackoverflow.com/q/25875396
tags question: http://stackoverflow.com/q/26023421
tags question: http://stackoverflow.com/q/25952082
tags question: http://stackoverflow.com/q/25995969
tags question: http://stackoverflow.com/q/25970693
tags question: http://stackoverflow.com/q/25979073
tags question: http://stackoverflow.com/q/25946099
tags question: http://stackoverflow.com/q/25958274
tags question: http://stackoverflow.com/q/25934496
tags question: http://stackoverflow.com/q/25987815
tags question: http://stackoverflow.com/q/25963062
tags question: http://stackoverflow.com/q/25891582
tags question: http://stackoverflow.com/q/26011696
tags question: http://stackoverflow.com/q/25881023
tags question: http://stackoverflow.com/q/25921711
tags question: http://stackoverflow.com/q/25926339
tags question: http://stackoverflow.com/q/25907727
tags question: http://stackoverflow.com/q/25970771
tags question: http://stackoverflow.com/q/25888012
tags question: http://stackoverflow.com/q/25910341
tags question: http://stackoverflow.com/q/25928681
tags question: http://stackoverflow.com/q/25983336
tags question: http://stackoverflow.com/q/25954066
tags question: http://stackoverflow.com/q/25913416
tags question: http://stackoverflow.com/q/25966036
tags question: http://stackoverflow.com/q/25912727
tags question: http://stackoverflow.com/q/25904779
tags question: http://stackoverflow.com/q/25902804
tags question: http://stackoverflow.com/q/25905694
tags question: http://stackoverflow.com/q/25921977
tags question: http://stackoverflow.com/q/25894106
tags question: http://stackoverflow.com/q/25900245
tags question: http://stackoverflow.com/q/25924721
tags question: http://stackoverflow.com/q/26025156
tags question: http://stackoverflow.com/q/25893249
tags question: http://stackoverflow.com/q/25909055
tags question: http://stackoverflow.com/q/26003352
tags question: http://stackoverflow.com/q/25944876
tags question: http://stackoverflow.com/q/25977138
tags question: http://stackoverflow.com/q/26024486
tags question: http://stackoverflow.com/q/25919215
tags question: http://stackoverflow.com/q/25876448
tags question: http://stackoverflow.com/q/25907145
tags question: http://stackoverflow.com/q/25902727
tags question: http://stackoverflow.com/q/26017055
tags question: http://stackoverflow.com/q/25938248
tags question: http://stackoverflow.com/q/25890198
tags question: http://stackoverflow.com/q/26018963
tags question: http://stackoverflow.com/q/25933941
tags question: http://stackoverflow.com/q/25878498
tags question: http://stackoverflow.com/q/25888007
tags question: http://stackoverflow.com/q/25903898
tags question: http://stackoverflow.com/q/26010209
tags question: http://stackoverflow.com/q/25956716
tags question: http://stackoverflow.com/q/25982621
tags question: http://stackoverflow.com/q/25981263
tags question: http://stackoverflow.com/q/25961216

http://stackoverflow.com/q/25914151
answer count: 3
tagged with: string
tagged with: android
has answer: http://stackoverflow.com/a/25914242
has title: How do I convert textview to double on eclipse ADT?
score: 0
type: UnansweredQuestion
tagged with: double
has answer: http://stackoverflow.com/a/25914240
has answer: http://stackoverflow.com/a/25914223
has body: I'm trying to develop calculator, and found out that when using dot for decimal, it force closes. I asked my computer teacher but he said just double it.. idk how since i'm still newb here. as I need to double the value, which is currently supports integer only. here's my code package id.duo.ka.mycalc; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { TextView disp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); disp=(TextView)findViewById(R.id.textView1); disp.setText("0"); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } static boolean isempty=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); } public void num_Clicked(View sender) { Button bt=(Button)sender; if(disp.getText().length()&gt;7)return; if(isempty) { if(bt.getText().toString().equals("0"))return; disp.setText(bt.getText()); isempty=false; } else { disp.append(bt.getText()); } } static int accumulator=0; static short operationToDo=0; public void op_Clicked(View sender) { Button bt=(Button)sender; switch (operationToDo) { case 0: accumulator+=Integer.par…
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40566807
type: Question

http://stackoverflow.com/comment/40512836
has text: Surely allowing this to be managed by a single JVM would reduce overhead. Modify your jar to take an input directory and process all files from that directory into an output directory, then allow this to be multi-threaded. :) - I think your issue here is likely to be disk read speed.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25886478
type: QuestionComment

http://stackoverflow.com/a/25888031
upvote count: 2
answers question: http://stackoverflow.com/q/25886805
has comment: http://stackoverflow.com/comment/40523763
type: Answer
downvote count: 0
has body: The simplest way of handling that is by using the @Primary annotation. Spring will inject the primary instead of failing with the duplicate bean exception.
has comment: http://stackoverflow.com/comment/40517933
score: 2
has comment: http://stackoverflow.com/comment/40523959

http://stackoverflow.com/q/25922868
type: Question
answer count: 1
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/25982022
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has title: Custom implementation for MessageConverter for Spring boot REST application not working
tagged with: java
has body: I have an rest application build using Spring boot. The api request object is a custom object containing String and ASN1OctetString. So i have written a custom implementation for message converter. But iam unable to convert the inputStream to customVO object containing String andASN1OctetString. How can i convert the input stream to customVo object? I tried using the ObjectInput ois = new ObjectInputStream(is);, but it is giving an error like header not valid. Please let me know how i can solve this issue. The deatils of code are given below. The application has a controller as below :- @RequestMapping(method = RequestMethod.POST, value = "/MyApp/postMessage", produces = "application/json;charset=UTF-8",consumes="ASN1OctetString/bytes;charset=UTF-8") public DeferredResult&lt;MyCustomVO&gt; process(@Valid @RequestBody MyCustomVO myCustomVO, HttpServletRequest request){ //service code } The Request bean is as follows:- import com.unboundid.asn1.ASN1OctetString; public class MyCustomVO { protected String actionDesc; protected ASN1OctetString transId; //setter getter methods } The custom implementation for message converter:- public class MyCustomVOConverter extends AbstractHttpMessageConverter&lt;MyCustomVO&gt; { public MyCustomVOConverter() { super(); } public MyCustomVOConverter(org.springframework.http.MediaType supportedMediaType) { super(supportedMediaType); } public MyCustomVOConverter(MediaType... supportedMediaTypes) { super(supportedMediaTypes); } @Override protected boolean supports(Class&lt;?&gt; clazz) { return MyCustomVO.class.equals(clazz); } @Override protected MyCustomVO readInternal(Class&lt;? extends MyCustomVO&gt; clazz, HttpInputMessage httpInputMessage) throws IOException, HttpMessageNotReadableException { MyCustomVO MyCustomVORequest= new MyCustomVO(); InputStream is= httpInputMessage.getBody(); **//Need to convert the stream to customVO object** } @Override protected void writeInternal(MyCustomVO MyCustomVOResp, HttpOutputMessage httpOutputMessag…

http://stackoverflow.com/a/25985038
has body: Try running namenode with the following (as opposed to using the start-dfs.sh) and see if that works. hadoop-daemon.sh start namenode hadoop-daemon.sh start secondarynamenode hadoop-daemon.sh start datanode hadoop-daemon.sh start nodemanager mr-jobhistory-daemon.sh start historyserver
accepted answer of: http://stackoverflow.com/q/25978863
score: 0
answers question: http://stackoverflow.com/q/25978863
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/58689143
score: 0
type: Answer
has body: I also got the same exception when i was trying to cast map value to my cacheEntity like given below. IMap&lt;Object, UserCacheEntity&gt; imap = hzClient.getMap("userMap"); System.out.println(imap.size()); Collection&lt;UserCacheEntity&gt; coll = imap.values(); coll.forEach(entity -&gt; { System.out.println(entity); }); In my case(hazelcast version 3.12.4.), workaround was to keep UserCacheEntity in same package name as it was in cacheServer. i.e, make sure your entity package not changes. It should be same package in client as it was declared in cache server.
answers question: http://stackoverflow.com/q/26033192

http://stackoverflow.com/comment/40775072
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26023866
has text: Yes, i tried inputting the local and public ip. However, neither worked.
score: 0

http://stackoverflow.com/q/25900541
has answer: http://stackoverflow.com/a/25901157
has comment: http://stackoverflow.com/comment/40538672
type: UnansweredQuestion
tagged with: libraries
tagged with: java
tagged with: eclipse
has body: when I run the program it works until i press the dibs button. When I do i get this error Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/eclipse/swt/events/MouseListener at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getDeclaredConstructor(Unknown Source) at chrriis.dj.nativeswing.swtimpl.internal.NativeCoreObjectFactory.create(NativeCoreObjectFactory.java:36) at chrriis.dj.nativeswing.swtimpl.components.JWebBrowser.&lt;init&gt;(JWebBrowser.java:189) at workoutSchema.WorkoutSchema.getDibsVideo(WorkoutSchema.java:195) at workoutSchema.WorkoutSchema$1.actionPerformed(WorkoutSchema.java:165) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$400(Unknown Source) at java.awt.EventQueue$3.run(Unkno…
type: Question
has comment: http://stackoverflow.com/comment/40538909
answer count: 1
has title: I can't find out which library I'm missing
score: 0

http://stackoverflow.com/a/25927543
has comment: http://stackoverflow.com/comment/40587927
has body: You're ignoring the result of countRec() - and you're iterating within the recursive call, defeating the purpose. (You're also making a recursive call on the same object, with no parameters and no change in state... so that can't do any good.) My recursive approach would be based on a design of: If the next node is null, then the size of the list is 1 Otherwise, the size is 1 + the size from the next node onwards. So: private int countRec() { return next == null ? 1 : 1 + next.countRec(); } Now that doesn't allow for a list of length 0 of course... you probably want to separate the idea of the list from the node, in which case the list class would have something like: public int count() { return head == null ? 0 : head.countRec(); } where the value of head is a reference to the head node if there is one, or null otherwise. Of course, this will be O(n) in time and space. You can get O(1) space using iteration instead of recursion, and O(1) time by just keeping the size of the list as an instance variable in the list, updating it when you need to. I'm hoping that this question was based on an educational requirement rather than real code though - in production code, you'd just use the collections provided already.
downvote count: 0
has comment: http://stackoverflow.com/comment/40587888
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40587967
answers question: http://stackoverflow.com/q/25927496
accepted answer of: http://stackoverflow.com/q/25927496
type: Answer
score: 11
upvote count: 11

class
tags question: http://stackoverflow.com/q/26029634
tags question: http://stackoverflow.com/q/25961327
tags question: http://stackoverflow.com/q/25944119
tags question: http://stackoverflow.com/q/25995063
tags question: http://stackoverflow.com/q/25880608
tags question: http://stackoverflow.com/q/26004651
tags question: http://stackoverflow.com/q/25901393
tags question: http://stackoverflow.com/q/25875769
tags question: http://stackoverflow.com/q/26001386
tags question: http://stackoverflow.com/q/26001903
tags question: http://stackoverflow.com/q/25985933
tags question: http://stackoverflow.com/q/25905368
tags question: http://stackoverflow.com/q/25920991
tags question: http://stackoverflow.com/q/25908287
tags question: http://stackoverflow.com/q/25944819
tags question: http://stackoverflow.com/q/25900130
tags question: http://stackoverflow.com/q/25944573
tags question: http://stackoverflow.com/q/25986177
type: Tag
tags question: http://stackoverflow.com/q/25925307
tags question: http://stackoverflow.com/q/25902289
tags question: http://stackoverflow.com/q/25983129
tags question: http://stackoverflow.com/q/25882658
tag name: class
tags question: http://stackoverflow.com/q/25977437
tags question: http://stackoverflow.com/q/25985512
tags question: http://stackoverflow.com/q/25926606
tags question: http://stackoverflow.com/q/26017414
tags question: http://stackoverflow.com/q/25924690
tags question: http://stackoverflow.com/q/25981283
tags question: http://stackoverflow.com/q/25913490
tags question: http://stackoverflow.com/q/25966715
tags question: http://stackoverflow.com/q/25926844

http://stackoverflow.com/q/26030642
has title: Reading/storing a text file in java
has comment: http://stackoverflow.com/comment/40774386
downvote count: 1
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/26031007
upvote count: 0
answer count: 1
has body: I'm trying to read a text file in the following format and store it (java). The format of the text file is like this: 1111 1010 1100 1000 It's a Hadamard matrix as you can tell. I'm very new to java and can't figure out how to accomplish this. I want to be able to perform computations on the matrix. Can someone help me with this
favorite count: 0
has comment: http://stackoverflow.com/comment/40773934
has comment: http://stackoverflow.com/comment/40773791
score: -1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26031007

http://stackoverflow.com/q/25951167
type: Question
has title: Id parsing error in Servlet
tagged with: servlets
answer count: 2
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/25951271
favorite count: 0
possible better answer: http://stackoverflow.com/a/25951351
has answer: http://stackoverflow.com/a/25951351
score: 2
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/25951271
tagged with: java
has body: I have edit servlet. Parsing error is only the problem while editing. Even though I have been trying since a half of month I am not able to solve.Please help me package com.intermediateDemo.home.controller; import com.intermediateDemo.home.dao.ItemDao; import com.intermediateDemo.home.dao.ItemDaoFactory; import com.intermediateDemo.home.dto.ItemBean; import com.intermediateDemo.login.dto.LoginBean; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; public class EditExpense extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws NumberFormatException, ServletException, IOException { try { ItemBean item = new ItemBean(); ItemDao dao = ItemDaoFactory.getItemDao(); HttpSession session = request.getSession(false); LoginBean user = (LoginBean) session.getAttribute("user"); item.setId(Integer.parseInt(request.getParameter("id"))); item.setItemName(request.getParameter("itemname")); item.setItemPrice(Double.valueOf(request.getParameter("itemprice"))); item.setTransactionTime(request.getParameter("transactiontime")); item.setEmail(user.getEmail()); System.out.println("at edit servlet" +item); dao.updateexpense(item, user); } catch (NumberFormatException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { response.sendRedirect("homeservlet"); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher view; view = request.getRequestDispatcher("/home/editexpense.jsp"); view.forward(request,response); } } and jsp to take inpute is <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> editing <jsp:include page="../includ…

http://stackoverflow.com/q/25986995
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40694513
has answer: http://stackoverflow.com/a/25987101
has comment: http://stackoverflow.com/comment/40694605
has body: I am working on a project which has two slider menus on left and right of the mainactivity.When the left slider opens it shows a list of four items.On clicking an item in the list i want the framelayout in the main activity to be replaced by a fragment.So i passed the integer postion of the listview to the mainactivity.The code is shown below: The mainactivity package com.navdrawer.demo.simple; import com.navdrawer.SimpleSideDrawer; import android.os.Bundle; import android.app.Activity; import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; public class MainActivity extends Activity { private SimpleSideDrawer mNav; Button btn1; RightFragment rf; ListView lv_countries; String[] values; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); values = new String[] { "Android List View", "Adapter implementation", "Simple List View In Android", "Create List View Android", "Android Example", "List View Source Code", "List View Array Adapter", "Android Example List View" }; mNav = new SimpleSideDrawer(this); mNav.setLeftBehindContentView(R.layout.activity_behind_left_simple); findViewById(R.id.leftBtn).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mNav.toggleLeftDrawer(); } }); mNav.setRightBehindContentView(R.layout.activity_behind_right_simple); final LayoutInflater factory = getLayoutInflater(); final View textEntryView = factory.inflate(R.layout.activity_behind_right_simple, null); lv_countries = (ListView) textEntryView.findViewById(R.id.lv_countries); ArrayAdapter&lt;String&gt; adapter =new ArrayAdapter&lt;String&gt;(getApplicationContext(),android.R.layout.simple_list_item_1,values); lv_countries.setAdapter(adapter); findViewById(R.id.rightBtn).setOnClickListener(new OnClickListene…
type: Question
tagged with: java
has title: IllegalStateException Activity has been destroyed error android
has comment: http://stackoverflow.com/comment/40694487
accepted answer: http://stackoverflow.com/a/25987101
score: 0
has comment: http://stackoverflow.com/comment/40694474
answer count: 1
has comment: http://stackoverflow.com/comment/40694541
has comment: http://stackoverflow.com/comment/40694557
tagged with: android
has comment: http://stackoverflow.com/comment/40694450
has comment: http://stackoverflow.com/comment/40694586

http://stackoverflow.com/q/25885591
tagged with: timezone
score: 13
tagged with: java-8
possible better answer: http://stackoverflow.com/a/39780992
upvote count: 13
accepted answer: http://stackoverflow.com/a/25885786
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39780992
has body: In Java 8, I want to convert a datetime from UTC to ACST (UTC+9:30). input -> 2014-09-14T17:00:00+00:00 output-> 2014-09-15 02:30:00 String isoDateTime = "2014-09-14T17:00:00+00:00"; LocalDateTime fromIsoDate = LocalDateTime.parse(isoDateTime, DateTimeFormatter.ISO_OFFSET_DATE_TIME); ZoneOffset offset = ZoneOffset.of("+09:30"); OffsetDateTime acst = OffsetDateTime.of(fromIsoDate, offset); System.out.println(acst.toString()); // 2014-09-14T17:00+09:30 System.out.println(acst.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)); // 2014-09-14T17:00:00+09:30 Why is the offset not performed?
tagged with: java
has title: Java 8 timezone conversions
type: Question
answer count: 2
downvote count: 0
tagged with: timezone-offset
favorite count: 0
has answer: http://stackoverflow.com/a/25885786

simulate
tags question: http://stackoverflow.com/q/26008173
type: Tag
tag name: simulate

http://stackoverflow.com/a/25977555
upvote count: 8
accepted answer of: http://stackoverflow.com/q/25976985
type: Answer
has comment: http://stackoverflow.com/comment/40697365
has comment: http://stackoverflow.com/comment/40735831
has body: As per JMeter Performance and Tuning Tips Default JMeter java configuration comes with 512 Mo and very little GC tuning. First ensure you set -Xmx option value to a reasonable value regarding your test requirements. Then change MaxNewSize option in jmeter file to respect the original ratio between MaxNewSize and -Xmx. Java Virtual Machine parameters can be tuned in jmeter script file which lives under /bin folder of JMeter installation. So Open jmeter script with text editor of your choice Look for the line HEAP="-Xms512m -Xmx512m" Change minimum and maximum values according to your desires Save the file and make sure that you're executing jmeter, not jmeter.sh If you're looking for once-only command-line JVM args overriding you can call JMeter main jar directly without any shell script wrappers as java -Xms1G -Xmx3G -jar ApacheJMeter.jar The command above assumes that you're invoking it from /bin folder of your JMeter installation.
downvote count: 0
has comment: http://stackoverflow.com/comment/40679366
has comment: http://stackoverflow.com/comment/40867649
answers question: http://stackoverflow.com/q/25976985
has comment: http://stackoverflow.com/comment/40736535
type: AcceptedAnswer
score: 8

http://stackoverflow.com/q/25960882
tagged with: windows
tagged with: cmd
favorite count: 0
has answer: http://stackoverflow.com/a/31089085
upvote count: 1
tagged with: python
possible better answer: http://stackoverflow.com/a/25962265
type: AnsweredQuestion
has title: Launching Minecraft via Python subprocess doesn't work
has answer: http://stackoverflow.com/a/25962265
has comment: http://stackoverflow.com/comment/40646237
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40655018
accepted answer: http://stackoverflow.com/a/31089085
has comment: http://stackoverflow.com/comment/40646352
has body: Today I've tried to start the Minecraft client via command line on Windows 7. It works! With this code: java -Xmx1024M -Djava.library.path="%APPDATA%\.minecraft\versions\1.7.10\1.7.10-natives" -cp "%APPDATA%\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;%APPDATA%\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;%APPDATA%\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;%APPDATA%\.minecraft\libraries\com\mojang\authlib\1.3\authlib-1.3.jar;%APPDATA%\.minecraft\libraries\io\netty\netty-all\4.0.10.Final\netty-all-4.0.10.Final.jar;%APPDATA%\.minecraft\libraries\java3d\vecmath\1.3.1\vecmath-1.3.1.jar;%APPDATA%\.minecraft\libraries\net\sf\trove4j\trove4j\3.0.3\trove4j-3.0.3.jar;%APPDATA%\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.5\jopt-simple-4.5.jar;%APPDATA%\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;%APPDATA%\.minecraft\libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;%APPDATA%\.minecraft\libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;%APPDATA%\.minecraft\libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;%APPDATA%\.minecraft\libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;%APPDATA%\.minecraft\libraries\com\google\guava\guava\15.0\guava-15.0.jar;%APPDATA%\.minecraft\libraries\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar;%APPDATA%\.minecraft\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;%APPDATA%\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;%APPDATA%\.minecraft\libraries\net\java\jinput\jinput-platform\2.0.5\jinput-platform-2.0.5-natives-windows.jar;%APPDATA%\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;%APPDATA%\.minecraft\libraries\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;%APPDATA%\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.…
type: Question
answer count: 2
tagged with: minecraft
downvote count: 0

http://stackoverflow.com/comment/40726337
type: QuestionComment
comment on: http://stackoverflow.com/q/26004443
score: 0
has text: That's a lot of code to expect people to review. I suggest stating your problem more succinctly if possible.
type: Comment

http://stackoverflow.com/q/26033084
score: 0
answer count: 1
tagged with: memcached
tagged with: java
type: UnansweredQuestion
has title: How does a Shiro enabled web application handle CacheExceptions
tagged with: caching
tagged with: shiro
type: Question
has body: I have a question about handling org.apache.shiro.cache.CacheException. What is shiro's responsibility when a cache exception occurs? This RTE ripples through the whole stack, but I'm unclear where it is handled and in what manner. Can a shiro enabled web application recover? Is the cache manager reinitialised? Do I have to restart the application when a cache exception occurs? For example, a timeout exception or a failed to connect to node exception occurs on cache.get(key). What's the expected outcome apart from bubble to the stop and die? Thanks
has answer: http://stackoverflow.com/a/26033685

http://stackoverflow.com/comment/40721612
type: Comment
has text: Is there any know problems with Java 8 Update 11 and Netty 4.0?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25991797

http://stackoverflow.com/q/25985037
has body: In my program I am using Swing windows for my GUI, and I know that I'm supposed to use repaint and paintComponent methods to render swing components. I also have several custom class objects that need to be rendered inside the main window. For the sake of understanding, my program is a game that will have moving objects that need to be rendered 60 times per second. In a game development tutorial I watched, the guy used a Jframe with Canvas, but he didn't use the paintComponent method. He simply made his own render() methods to draw all the graphics using graphics context he obtained from creating a bufferStrategy. So if that works (which it does), why does everyone say to use the paintComponent methods and what exactly is the difference between them? If I were to use the paintComponent way of doing things, how would I use bufferStrategy with that?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40691089
type: Question
has answer: http://stackoverflow.com/a/25985085
has title: Swing rendering... does it always have to be repaint() and paintComponent()?
score: 0
has comment: http://stackoverflow.com/comment/40691117
answer count: 1
tagged with: paintcomponent
accepted answer: http://stackoverflow.com/a/25985085
has comment: http://stackoverflow.com/comment/40691041
tagged with: swing

http://stackoverflow.com/comment/92627034
type: Comment
has text: This is deprecated, the new configuration name is `server.servlet.session.cookie.name`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/34334070

http://stackoverflow.com/comment/40630545
has text: So, for your case where the values are not inserted in the Database, put a breakpoint at the method you want to investigate and run the application in debug mode. In the debug view of Eclipse, you will be able t investigate what is going on. I'm sorry if I do not fully understand the question. Maybe you can add the code that seems not to work as intended? Edit: http://www.vogella.com/tutorials/EclipseDebugging/article.html here's a tutorial on how to debug with Eclipse with a lot of pictures. Edit2: Also, the problem may be in your database connection. It's hard to tell
score: 1
comment on: http://stackoverflow.com/q/25952305
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40648111
has text: possible duplicate of [Loading images from jars for Swing HTML](http://stackoverflow.com/questions/6373621/loading-images-from-jars-for-swing-html)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25961837

http://stackoverflow.com/comment/40621238
has text: The point is, you are trying to `getValueAt` from a row of data that is no longer the same data from before you called `removeRow()`
score: 1
comment on: http://stackoverflow.com/q/25946308
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40512260
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25885742
has text: try "software like manage engine" in google, I saw some results there, like [15 Popular Sites Like Manageengine](http://www.moreofit.com/similar-to/www.manageengine.com/Top_10_Sites_Like_Manageengine/) or [Alternatives to ManageEngine Products?](http://community.spiceworks.com/topic/355378-alternatives-to-manageengine-products) or [openNMS-vs-ManageEngine-OpManager](http://network-management.findthebest.com/compare/4-6/openNMS-vs-ManageEngine-OpManager) or....

http://stackoverflow.com/comment/40593017
has text: I don't think anybody would *actually* call and answer your question. So please don't post *personal* data (email id / phone numbers) here.
comment on: http://stackoverflow.com/q/25930528
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40646402
comment on: http://stackoverflow.com/q/25960885
type: Comment
has text: @AgilePro Well, the problem is the list of "listeners" is ever growing. The listeners really do very specialized business logic. For example on receiving an ALARM message, an SNMP trap should be triggered. Also on receiving the alarm, a client specific representation must be calculated. If I start doing all this in the Alarm message, I am afraid the Alarm object is sooner going to be un-maintainable. Isn't this an anti pattern in itself?
score: 0
type: QuestionComment

http://stackoverflow.com/q/25901960
score: 0
has answer: http://stackoverflow.com/a/25902051
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25902125
has comment: http://stackoverflow.com/comment/40542372
has comment: http://stackoverflow.com/comment/40541088
has body: So, Lets say I have a String s = "{(30,2884090,1410450570357,235),(30,2863348,1410451100148,285)}"; Matcher match = Pattern.compile("(\\d+,)*\\d+").matcher(s); So the issue is sometimes, the String s is so big that I get heap error: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOfRange(Arrays.java:2694) at java.lang.String.&lt;init&gt;(String.java:203) How do i handle this as an exception, so that my code still keeps on going Any better way to handle such large strings?
tagged with: java
has comment: http://stackoverflow.com/comment/40541096
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40541108
has comment: http://stackoverflow.com/comment/40541075
linked to: http://stackoverflow.com/q/14763079
has title: handling java heap space exceptions
has comment: http://stackoverflow.com/comment/40541422

http://stackoverflow.com/a/25901423
answers question: http://stackoverflow.com/q/25900992
has body: Effectively there is the possibility, you need to have a main(String[] args) function into your main class in the jar, then the args that you pass in the command line after : java -jar /usr/local/bin/processmail.jar oneemail@onedomain.com, otheremail@otherdomain.com Here oneemail@onedomain.com and otheremail@otherdomain.com will be passed to the body of main method as part of args variable to be processed, of course you have to manage the implementation of the main method as you need for your intentions, something like: ... main(String[] args) { doSomething(args[0]); doSomething(args[1]); . . . }
has comment: http://stackoverflow.com/comment/40540129
type: Answer
score: 0

http://stackoverflow.com/comment/40649223
comment on: http://stackoverflow.com/q/25941783
score: 0
type: Comment
type: QuestionComment
has text: Good questions, yes, the key was to put them in the process-sources phase. I'll have a look at the project.build.directory too, thanks for the heads up.

http://stackoverflow.com/comment/40523314
has text: @PauloMoura Very possibly. It will also be worth checking the harness that is being used to invoke the command or to start prolog. At least we have been able to help you rule out the basics. From here I would dump the properties table as above at each point of hand over and see if the properties are being past along as you expect. I'll let somebody with more JIProlog experience help you from here.
comment on: http://stackoverflow.com/a/25891990
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25946387
has answer: http://stackoverflow.com/a/25949252
tagged with: android
tagged with: java
downvote count: 2
has title: How to increment a click amount by 1 every second
type: Question
score: -2
has comment: http://stackoverflow.com/comment/40625238
answer count: 2
has comment: http://stackoverflow.com/comment/40621131
has comment: http://stackoverflow.com/comment/40620978
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25948407
has body: So I have been trying to figure out how to make the total amount of current clicks go up by one every second. Say the amount of clicks is 0. Everytime I click it goes up by 20. But I also want it to go up by 1 every second. I have tried using time handler and I believe I have just been messing it up. public class MainActivity extends Activity implements OnClickListener { private static final String TAG = MainActivity.class.getSimpleName(); private static final String KEY_COUNT = "count"; private SharedPreferences mPrefs; private TextView mTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate!"); mPrefs = getPreferences(MODE_PRIVATE); int count = mPrefs.getInt(KEY_COUNT, 0); count = count + 1; Editor editor = mPrefs.edit(); editor.putInt(KEY_COUNT, count); editor.commit(); mTextView = new TextView(this); setContentView(mTextView); mTextView.setTextSize(40); mTextView.setText("Count : " + count); Log.d(TAG, "Count is " + count); setContentView(mTextView); //setContentView(R.layout.activity_main); mTextView.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onClick(View arg0) { // SystemClock.sleep(2000); int clickCount = 20 + mPrefs.getInt("clicked", 0); mPrefs.edit().putInt("clicked", clickCount).putBoolean("user", true).commit(); mTextView.setTextColor(0xff00ff00); mTextView.setText("The amount of times Lee Ji Eun has clicked:" + clickCount); } }
type: UnansweredQuestion

http://stackoverflow.com/q/25981968
duplicate of: http://stackoverflow.com/q/18880962
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/40685113
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: android-layout
has answer: http://stackoverflow.com/a/25982052
tagged with: java
has title: Need assistance with onclick
has comment: http://stackoverflow.com/comment/40685039
type: Question
linked to: http://stackoverflow.com/q/18880962
has body: I am building an Android app and basically I want it to count tapping on the screen(anywhere). Now I tried to put the RelativeLayout to have android:clickable="true" and my 1 TextView the same, but when I try to start the Activity the app crashes. I would like it to show time, lets say 30 seconds, and then to count taps for these 30 seconds. 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" tools:context="com.orion.peky.thetapgame.Game"&gt; &lt;TextView android:text="Tap to start" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:textSize="50dp" android:textColor="#FFFFFFFF" android:id="@+id/tekst" /&gt; &lt;/RelativeLayout&gt; Activity MAIN package com.orion.peky.thetapgame; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; public class Game extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); } TextView tekst=(TextView)findViewById(R.id.tekst); int brojac=0; public void broji(View view){ brojac=brojac+1; tekst.setText("Tapped "+brojac+" times"); } }

http://stackoverflow.com/q/25999077
has comment: http://stackoverflow.com/comment/40716526
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40716615
has comment: http://stackoverflow.com/comment/40716248
type: UnansweredQuestion
score: 6
has title: java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor error: Spring Mvc Project
tagged with: spring
upvote count: 6
tagged with: spring-mvc
tagged with: transactions
has answer: http://stackoverflow.com/a/26005537
tagged with: java
tagged with: noclassdeffounderror
has body: I have spent the whole day just figuring out the solution to this problem but I couldn't find one. Error HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet.init() for servlet appServlet threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) java.lang.Thread.run(Thread.java:722) root cause org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.l…
has answer: http://stackoverflow.com/a/25999435
type: Question
has comment: http://stackoverflow.com/comment/40715968

http://stackoverflow.com/q/26024582
type: Question
has answer: http://stackoverflow.com/a/77523062
has answer: http://stackoverflow.com/a/26024633
accepted answer: http://stackoverflow.com/a/26024633
upvote count: 44
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
downvote count: 0
has title: maven : Failed to install metadata project Could not parse metadata maven-metadata-local.xml: only whitespace content allowed before start tag
answer count: 5
tagged with: maven
has answer: http://stackoverflow.com/a/52034772
has answer: http://stackoverflow.com/a/58929931
type: AnsweredQuestion
tagged with: installation
tagged with: java
possible better answer: http://stackoverflow.com/a/57505999
score: 44
has body: Got this error when I was trying to build a project which I just downloaded from SVN. Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project : Failed to install metadata project:1.0-SNAPSHOT/maven-metadata.xml: Could not parse metadata C:\Users.m2\project\1.0-SNAPSHOT\maven-metadata-local.xml: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:1) -> [Help 1]
has answer: http://stackoverflow.com/a/57505999

http://stackoverflow.com/comment/40532523
comment on: http://stackoverflow.com/a/25888710
type: AnswerComment
has text: Yes it does. Cool. http://www.osgi.org/javadoc/r4v42/org/osgi/util/tracker/BundleTracker.html#BundleTracker(org.osgi.framework.BundleContext, int, org.osgi.util.tracker.BundleTrackerCustomizer)
score: 0
type: Comment

http://stackoverflow.com/a/25935140
has comment: http://stackoverflow.com/comment/40603458
answers question: http://stackoverflow.com/q/25934968
has body: I will try to answer every question (based on my experience and expectations), but I am pretty sure it really depends on whether you work with JTA transactions or with UserTransactions (a.k.a resource-local transactions): If EntityManager is using hibernate's session behind the scenes when it is opened and when it is closed? For every instantion of an EntityManager, a new hibernate session is opened. If you work with JTA transactions, the entityManager is closed when the transaction is closed (when your first service bean method returns). If it keeps on a single session for whole life of application will not it be creating problems as entities are not automatically evicted? it may lead to out of memory error? It does not keep a single hibernate session. If you configured so, it will has a pool of reusable connection, but for every new created bean it will generate a new entity manager with a new Hibernate session behind it.
has comment: http://stackoverflow.com/comment/40602113
score: 0
has comment: http://stackoverflow.com/comment/40602394
has comment: http://stackoverflow.com/comment/40604023
has comment: http://stackoverflow.com/comment/40603257
has comment: http://stackoverflow.com/comment/40603209
type: Answer

http://stackoverflow.com/q/26033706
score: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26034253
tagged with: actionresult
upvote count: 1
linked to: http://stackoverflow.com/q/25674746
downvote count: 1
type: AnsweredQuestion
tagged with: struts-action
has body: Struts version is 2.3.16 In struts.xml, I added this /out.jsp the xml and the UserAccount class are correct, because some request to this url is OK, but some request is 404. This is the successful request Request URL:http://localhost:8080/pp/ajaxuser Request Method:POST Status Code:200 OK Request Headersview source Accept:*/* Accept-Encoding:gzip,deflate Accept-Language:zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4 Connection:keep-alive Content-Length:45 Content-Type:application/x-www-form-urlencoded; charset=UTF-8 Cookie:JSESSIONID=B6D15A95251B1477473BC524E7E9E148; Siggraph-Fontresizer=105; targetEncodinghttp://your-site=1; PHPSESSID=k2fi36gbn8979riffibp2mt1f7; _ga=GA1.1.2049659497.1410967472 Host:localhost:8080 Origin:http://localhost:8080 Referer:http://localhost:8080/pp/user-account User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36 X-Requested-With:XMLHttpRequest Form Dataview sourceview URL encoded userId:2 username:b password:b oper:edit id:8 Response Headersview source Content-Length:5 Content-Type:text/html;charset=ISO-8859-1 Date:Thu, 25 Sep 2014 07:09:26 GMT Server:Apache-Coyote/1.1 And this is the failed request Remote Address:127.0.0.1:8080 Request URL:http://localhost:8080/pp/ajaxuser Request Method:POST Status Code:404 Not Found Request Headersview source Accept:*/* Accept-Encoding:gzip,deflate Accept-Language:zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4 Connection:keep-alive Content-Length:55 Content-Type:application/x-www-form-urlencoded; charset=UTF-8 Cookie:JSESSIONID=B6D15A95251B1477473BC524E7E9E148; Siggraph-Fontresizer=105; targetEncodinghttp://your-site=1; PHPSESSID=k2fi36gbn8979riffibp2mt1f7; _ga=GA1.1.2049659497.1410967472 Host:localhost:8080 Origin:http://localhost:8080 Referer:http://localhost:8080/pp/user-account User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36 X-Requested-With:XMLHttpRequest Form Dataview sourceview …
has comment: http://stackoverflow.com/comment/40779634
tagged with: java
has comment: http://stackoverflow.com/comment/40780721
type: Question
has comment: http://stackoverflow.com/comment/40779601
has answer: http://stackoverflow.com/a/26034253
tagged with: validation
answer count: 1
tagged with: struts2
has title: Why struts.xml is correct, but the page is 404?

http://stackoverflow.com/a/72785478
answers question: http://stackoverflow.com/q/26017545
score: 0
has body: After reading all answers and concluding that all of them have at least one problem I still had to write it myself: import java.io.File; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class Temp { public static void main(String[] args) { final String path = "D:\\"; deleteEmpty(new File(path)); } private static int deleteEmpty(File file) { List<File> toBeDeleted = Arrays.stream(file.listFiles()).sorted() // .filter(File::isDirectory) // // Recursive call to delete sub-directories. // If all files in the sub-directory where deleted, also delete this directory. .filter(f -> f.listFiles().length == deleteEmpty(f)) // .collect(Collectors.toList()); int size = toBeDeleted.size(); toBeDeleted.forEach(t -> { final String path = t.getAbsolutePath(); final boolean delete = t.delete(); System.out.println("Deleting: \t" + delete + "\t" + path); }); return size; } }
has comment: http://stackoverflow.com/comment/135836855
type: Answer
has comment: http://stackoverflow.com/comment/135856918

http://stackoverflow.com/q/25902881
tagged with: edit
score: 3
has body: Is it possible to edit a preparedStatement that was used before in another Method? For example: public class MyDB { private Connection c; private PreparedStatement p; public void foo() { // connecting to DB...try-catch-block... p = c.prepareStatement("SELECT * FROM t WHERE NAME=?"); p.setString(1, "Tom"); } public void boo(){ // connecting to DB...try-catch-block... //Here I want to concat the query with something --&gt; p = ....." AND City=?"; p.setString(2, "London"); ResultSet rs = p.executeQuery(); [...] } }
accepted answer: http://stackoverflow.com/a/25902958
tagged with: database
has comment: http://stackoverflow.com/comment/40542805
upvote count: 4
tagged with: sql
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40543342
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
has title: Edit query in preparedStatement
has comment: http://stackoverflow.com/comment/40542791
has answer: http://stackoverflow.com/a/25902958
downvote count: 1
type: Question

http://stackoverflow.com/q/25885095
has answer: http://stackoverflow.com/a/25885245
type: Question
has answer: http://stackoverflow.com/a/25885146
has title: Regex replace an email
accepted answer: http://stackoverflow.com/a/25885146
tagged with: replace
possible better answer: http://stackoverflow.com/a/25885131
score: 0
has body: In my SQLite database I have a composite key that comprises of an email and a tutorial name (it's an e-learning app) such as sonop@us.ac.zaTutorial 1 or randomperson@gmail.comTutorial 3. I'm having problem splitting the two when I use them later on. I want to get the tutorial (Tutorial 1) and email (sonop@us.ac.za) separately. Seems straightforward but I'm struggling? Here'se what I've tried so far: String Key = cursor.getString(cursor.getColumnIndex("key")); String email = Key.replace("^(.*)(Tutorial)(\\s)(\\d+)$", "$1"); String Tutorial = Key.replace("^(.*)(Tutorial)(\\s)(\\d+)$", "$2$3$4"); However when I use print statements later on, nothing is replaced or changed. Any ideas? Or is there a simpler way to do this?
answer count: 3
has answer: http://stackoverflow.com/a/25885131
tagged with: regex
has comment: http://stackoverflow.com/comment/40897436
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40510379
tagged with: java

http://stackoverflow.com/a/25891276
upvote count: 1
has body: You never call convertToHex, remove the file reading from your main() method. It appears you wanted to do something like, File f = new File("src/hexUtility/test.txt"); convertToHex(System.out, f);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40522121
answers question: http://stackoverflow.com/q/25890660
type: Answer
accepted answer of: http://stackoverflow.com/q/25890660
score: 1

http://stackoverflow.com/a/29867571
upvote count: 1
answers question: http://stackoverflow.com/q/25967177
has body: This is a recursive solution to the problem, one non recursive solution could use a helper method to get the sum of indexes 0 to a current index in a for loop and another one could get the sum of all the elements from the same current index to the end, which works. Now if you wanted to get the elements into an array and compare the sum, first find the point (index) which marks the spilt where both side's sum are equal, then get a list and add the values before that index and another list to go after that index. Here's mine (recursion), which only determines if there is a place to split the array so that the sum of the numbers on one side is equal to the sum of the numbers on the other side. Worry about indexOutOfBounds, which can easily happen in recursion, a slight mistake could prove fatal and yield a lot of exceptions and errors. public boolean canBalance(int[] nums) { return (nums.length &lt;= 1) ? false : canBalanceRecur(nums, 0); } public boolean canBalanceRecur(int[] nums, int index){ //recursive version if(index == nums.length - 1 &amp;&amp; recurSumBeforeIndex(nums, 0, index) != sumAfterIndex(nums, index)){ //if we get here and its still bad return false; } if(recurSumBeforeIndex(nums, 0, index + 1) == sumAfterIndex(nums, index + 1)){ return true; } return canBalanceRecur(nums, index + 1); //move the index up } public int recurSumBeforeIndex(int[] nums, int start, int index){ return (start == index - 1 &amp;&amp; start &lt; nums.length) ? nums[start] : nums[start] + recurSumBeforeIndex(nums, start + 1, index); } public int sumAfterIndex(int[] nums, int startIndex){ return (startIndex == nums.length - 1) ? nums[nums.length - 1] : nums[startIndex] + sumAfterIndex(nums, startIndex + 1); } //non recursively public boolean canBalance(int[] nums) { for(int a = 0; a &lt; nums.length; a++) { int leftSum = 0; int rightSum = 0; for(int b = 0; b &lt; a; b++) { leftSum += nums[b]; } for(int c = a; c &lt; nums.length; c++) { rightSum += nums[c]; } if(leftSum == rightSum…
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/40560377
has text: @BrunoFranco - you will have to use `m.group(1)` not `m.group()`
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25912479
type: Comment

http://stackoverflow.com/comment/40562464
score: 0
comment on: http://stackoverflow.com/a/25913531
type: AnswerComment
has text: OP's quesion is your question, the original question.
type: Comment

http://stackoverflow.com/comment/40654556
comment on: http://stackoverflow.com/q/25965179
type: Comment
type: QuestionComment
score: 1
has text: The line you wrote will leave other programmers scratching their heads. If I read it, I'd have to go dig through the JLS to figure out what the semantics are, or write a test program to try it, since I don't know offhand how this would work. All that hassle so you could save about 30 keystrokes. **Please, please, please, do not try to be clever!** It is _much_ more important to be straightforward.

http://stackoverflow.com/comment/40545086
type: Comment
score: 0
type: AnswerComment
has text: This is exactly what I needed. I had conceptually thought of the last one but didn't know about the instanceof keyword. That is the one I will implement, thanks!
comment on: http://stackoverflow.com/a/25904133

http://stackoverflow.com/comment/40777043
type: QuestionComment
type: Comment
has text: Without any application installed ..this is not possible
score: 5
comment on: http://stackoverflow.com/q/26032364

struts2
tags question: http://stackoverflow.com/q/25931634
tags question: http://stackoverflow.com/q/26023902
tags question: http://stackoverflow.com/q/26033706
tags question: http://stackoverflow.com/q/25883481
tags question: http://stackoverflow.com/q/25975679
tag name: struts2
tags question: http://stackoverflow.com/q/25911946
tags question: http://stackoverflow.com/q/25936387
tags question: http://stackoverflow.com/q/25896815
tags question: http://stackoverflow.com/q/25884614
tags question: http://stackoverflow.com/q/25890991
tags question: http://stackoverflow.com/q/25934796
tags question: http://stackoverflow.com/q/25930882
tags question: http://stackoverflow.com/q/25912457
tags question: http://stackoverflow.com/q/25917748
tags question: http://stackoverflow.com/q/26001865
type: Tag
tags question: http://stackoverflow.com/q/25960338
tags question: http://stackoverflow.com/q/25993547

http://stackoverflow.com/a/25951812
has body: It looks like it is because you are incrementing n on both lines where you store the item: item_name[n++]=name; item_price[n++]=price;
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25951783
downvote count: 0

http://stackoverflow.com/q/26019770
has comment: http://stackoverflow.com/comment/40788977
answer count: 0
has comment: http://stackoverflow.com/comment/40765862
type: UnansweredQuestion
tagged with: arduino
has title: Mouse emulator using Processing, Arduino, and Robot class: inconsistent function
upvote count: 1
tagged with: mouse
type: Question
tagged with: processing
tagged with: java
has comment: http://stackoverflow.com/comment/40753891
has body: I have built a mouse emulator for a severely disabled person, which has a series of buttons arranged in a + pattern, with the center button being a 'click'. The inputs are read into an Arduino Micro, which then connects through USB to the computer. A processing script, using the Arduino library, responds to these changes by moving the mouse, using the Robot class. I exported an application, for both 32-bit and 64-bit windows, but found that the .exe files were problematic, and instead opted for .bat files using the embedded Java. This all works perfectly on my computer (Microsoft Surface, Windows 8, 64-bit). But on the client's computer (Windows 7, 32-bit), the results are erratic. Each time I load the program, I get a different result. For example, sometimes up, down, and click work. Sometimes only up and click work. And so forth. The click usually seems to work, but the directions are less reliable, with vertical working more often than horizontal. I have verified that nothing is wrong with the board. I tried putting in a debug statement which ran println() each time a movement's "if" statement was tripped - I only got printing from directions that worked on that particular run. I see a number of potential sources for this problem: the differences between 32-bit and 64-bit Windows, possible issues with the Robot class, USB performance issues (though I've tried multiple ports on the client's laptop), etc. The client's laptop has generally poor performance (for example, if I click "Control Panel", it may be a full minute before Control Panel opens), so that may also be related. Does anyone have other insights on this? EDIT: As requested, here's a minimal version of the Processing code. The Arduino is just running Firmata: import processing.serial.*; import cc.arduino.*; import java.awt.*; import java.awt.event.*; Arduino arduino; Robot r; final int upPin=8; final int downPin=12; final int leftPin=10; final int rightPin=11; final int buttonPin=9; final int SPEED=8; b…
downvote count: 0
score: 1
favorite count: 0
tagged with: windows

http://stackoverflow.com/comment/40768245
type: QuestionComment
comment on: http://stackoverflow.com/q/26026424
score: 0
has text: [There is another thread](http://stackoverflow.com/questions/7115445/what-is-the-optimal-capacity-and-load-factor-for-a-fixed-size-hashmap), were someone really put some effort into finding an optimal balance between map size, capacity and load factor. Also, he wrote a tltr summary, just skip to the end.
type: Comment

http://stackoverflow.com/comment/40743465
type: AnswerComment
type: Comment
has text: is there a way to configure transport Listner using spring, I saw this [jira request AMQ-1434](https://issues.apache.org/jira/browse/AMQ-1434), if yes then how to configure it.
comment on: http://stackoverflow.com/a/26014220
score: 0

http://stackoverflow.com/q/25905445
score: 1
has comment: http://stackoverflow.com/comment/40547201
tagged with: java
has answer: http://stackoverflow.com/a/25906759
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40547753
accepted answer: http://stackoverflow.com/a/25906759
has comment: http://stackoverflow.com/comment/40547853
has title: Apply Distinct Function on TreeMap
has comment: http://stackoverflow.com/comment/40547323
tagged with: treemap
has comment: http://stackoverflow.com/comment/40547245
has comment: http://stackoverflow.com/comment/40549895
answer count: 3
has comment: http://stackoverflow.com/comment/40549823
has comment: http://stackoverflow.com/comment/40547954
possible better answer: http://stackoverflow.com/a/25908919
downvote count: 0
has answer: http://stackoverflow.com/a/25908919
has answer: http://stackoverflow.com/a/25905492
favorite count: 0
has body: Code: Map&lt;Integer, HashSet&lt;String&gt;&gt; test = new TreeMap&lt;&gt;(); test.put(1, new HashSet&lt;&gt;()); test.put(2, new HashSet&lt;&gt;()); test.put(3, new HashSet&lt;&gt;()); test.put(4, new HashSet&lt;&gt;()); test.get(1).add("1"); test.get(2).add("2"); test.get(3).add("2"); test.get(4).add("3, 33"); //get value of treemap and get rid of the duplicate by using distinct and printout //at the end test.values().stream().distinct().forEach(i -&gt; System.out.println(i)); output: [1] [2] [3, 33] My question is how I can printout the key and value at the same time without having duplicate value? Expected Result: 1= [1] 2= [2] 3= [3, 33] I even try below code, yet it gives me the treemap with the duplicate values: Code: List&lt;Map.Entry&lt;Integer, HashSet&lt;String&gt;&gt;&gt; list = new ArrayList&lt;&gt;(); list.addAll(test.entrySet()); list.stream().distinct().forEach( i -&gt; System.out.println(i)); Output: 1=[1] 2=[2] 3=[2] 4=[3, 33]
has comment: http://stackoverflow.com/comment/40548327
linked to: http://stackoverflow.com/q/23699371
has comment: http://stackoverflow.com/comment/40547371
has comment: http://stackoverflow.com/comment/40548389
tagged with: distinct
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40547418

http://stackoverflow.com/comment/40620890
comment on: http://stackoverflow.com/a/25925021
score: 0
type: AnswerComment
has text: 4) Can I use both UrlBasedViewResolver and InternalResourceViewResolver in dispatcher-servlet.xml (because I am using Apache tiles)? 5) You mentioned in point 6 "The servlet path is basically what you put in the servlet mapping in your web xml. Let me give an example, let's say you have a web app whose context is 'app', and it has a spring MVC servlet whose servlet mapping is '/mvc'.", What you mean by "spring MVC servlet whose servlet mapping is '/mvc'"? Could you please provide code for the case you were explaining /mvc.
type: Comment

http://stackoverflow.com/comment/40525046
type: Comment
comment on: http://stackoverflow.com/q/25893161
has text: Have you tried not autowiring, i.e. instantiating a PersonRepository implementation yourself ? I don't see how Spring is supposed to know which object to instantiate.
score: 0
type: QuestionComment

http://stackoverflow.com/a/25940776
has comment: http://stackoverflow.com/comment/40612545
has comment: http://stackoverflow.com/comment/40611999
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25940748
accepted answer of: http://stackoverflow.com/q/25940748
upvote count: 8
has comment: http://stackoverflow.com/comment/40612501
has comment: http://stackoverflow.com/comment/40612218
has body: No. You cannot do this, switch (age){ case (&gt;79): // Do this stuff break; case (&gt;50): // Do this other stuff break; } You need an if and else, if (age &gt; 79) { // do this stuff. } else if (age &gt; 50) { // do this other stuff. } // ...
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/40612428

http://stackoverflow.com/q/25886300
type: UnansweredQuestion
tagged with: selenium-webdriver
tagged with: java
tagged with: iframe
tagged with: selenium
upvote count: 1
type: Question
has title: How to handle iframe with title
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25886666
score: 1
has body: &lt;iframe frameborder="0" style="border: 0px none; width: 100%; height: 331px; min-width: 0px; min-height: 0px; overflow: auto;" dojoattachpoint="frame" title="Fill Quote - 1235, 娄底市中兴液压件有限公司 (1 item)" coachDebugTrace=none"&gt; How to handle above iframe , I have tried below options , Xpath = //iframe[contains(@title,'Fill Quote')] CSS = iframe[title='Fill Quote')] Still it is not identifying iframe and not able to perform any action inside iframe web elements . In above example title="Fill Quote - 1235, 娄底市中兴液压件有限公司 (1 item) initial text "Fill Quote" will be constant remaining part is dynamic
has answer: http://stackoverflow.com/a/25886670
favorite count: 0

http://stackoverflow.com/comment/40629471
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25951878
has text: @manjunathacitragar Date object is never associated with any timezone

http://stackoverflow.com/comment/40506768
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25883032
type: AnswerComment
has text: @MarshallLee you need to initialize `n` with proper value.

http://stackoverflow.com/a/25887400
type: Answer
answers question: http://stackoverflow.com/q/25886478
has comment: http://stackoverflow.com/comment/40523423
has comment: http://stackoverflow.com/comment/40520435
has comment: http://stackoverflow.com/comment/40514909
has comment: http://stackoverflow.com/comment/40518716
has comment: http://stackoverflow.com/comment/40515062
has comment: http://stackoverflow.com/comment/40525201
has comment: http://stackoverflow.com/comment/40525978
has body: Ok, because I hadn't actually done it before, I knocked this up. It's not great, and the lib I used was a jar I created to crash after 2 mins.. Hopefully you'll be able to reverse engineer this for your needs. package test; import java.io.IOException; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class Test { public static void main(String[] args) throws InterruptedException, IOException { BlockingQueue&lt;Runnable&gt; runnableQueue = new LinkedBlockingQueue&lt;&gt;(); ExecutorService executorServ = new ThreadPoolExecutor(8, 8, 1, TimeUnit.MINUTES, runnableQueue); runnableQueue.add(new RunCrash("Example")); // Add one for each file... executorServ.shutdown(); while(!executorServ.isTerminated()) { // running } } } class RunCrash implements Runnable { private String fileName; RunCrash(String fileName) { this.fileName = fileName; } @Override public void run() { System.out.println(fileName); try { crash.CrashMe.main(new String[]{fileName}); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Oh, you can let the main thread die before the others finish, I believe the JVM will keep the executor and associated queue. :)
score: 0
has comment: http://stackoverflow.com/comment/40515327
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40516589
accepted answer of: http://stackoverflow.com/q/25886478

http://stackoverflow.com/comment/40776483
score: 0
type: Comment
type: QuestionComment
has text: looping is the best way to do this!!!
comment on: http://stackoverflow.com/q/26032103

http://stackoverflow.com/q/26011619
tagged with: java
accepted answer: http://stackoverflow.com/a/26011873
possible better answer: http://stackoverflow.com/a/26011868
answer count: 3
has answer: http://stackoverflow.com/a/26011792
has answer: http://stackoverflow.com/a/26011868
score: 0
tagged with: regex
has answer: http://stackoverflow.com/a/26011873
has title: Regular expression for email using look ahead in java
type: Question
type: AnsweredQuestion
has body: I am trying to write a regular expression for email. For the characters before @ symbol, I want following rules to be obeyed: a-z,A-Z,0-9 are allowed along with special character -,.,_ I write expression in java like "^[a-zA-Z0-9]{1,}(?=[.-_]?+)" for text before @ symbol. But it is also allowing "ddff....." i.e. multiple dots are getting allowed, which should not be the case as I have used ?+ quantifier. It should fail. Can anyone help on this? public class EmailRegex { private static String EMAIL_REGEX_NEW_2="^[a-zA-Z0-9]{1,}(?=[.-_]?+)"; public static void main(String[] args) { System.out.println("Enter the email name to validate"); try (Scanner sc = new Scanner(System.in)) { if (!serverValidationUsingRegexPattern(sc.nextLine(), EMAIL_REGEX_NEW_2)) { System.out.println("Sorry, Email name invalid"); } else { System.out.println("Congrats, Email name valid"); } } } public static boolean serverValidationUsingRegexPattern( String valueToValidate, String regexPattern) { Pattern p = Pattern.compile(regexPattern); Matcher m = p.matcher(valueToValidate); return m.find(); } }

http://stackoverflow.com/comment/40598938
comment on: http://stackoverflow.com/a/25929722
has text: OK, thank you. Then I can the answer to my question in heading is "yes".
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26017149
type: Question
has comment: http://stackoverflow.com/comment/40748769
has comment: http://stackoverflow.com/comment/40749129
has answer: http://stackoverflow.com/a/26017369
accepted answer: http://stackoverflow.com/a/26017369
tagged with: security
score: 0
has comment: http://stackoverflow.com/comment/40748814
has comment: http://stackoverflow.com/comment/40748731
tagged with: email
answer count: 1
has title: One Click UN-subscribe email service through java
has body: I am working on the un-subscribing email service through un-subscribe link for an web application. Email with un-subscribe link will be generated from a java class using MD5 algorithm. currently, i am appending the email id's in the form of encrypted hash with the link as, &lt;a href="http://server name/mailid=3f37c9628c8953d3fdfb0f8" &gt; '3f37c9628c8953d3fdfb0f8' string contains email'id of the user . i am updating the service subscription after validating it. Does this process is secure ? or should i go for any other algorithms to make it more secure ? Thanks in advance
has comment: http://stackoverflow.com/comment/40748772
has comment: http://stackoverflow.com/comment/40748686
has comment: http://stackoverflow.com/comment/40748994
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40749304

http://stackoverflow.com/q/25989805
has comment: http://stackoverflow.com/comment/40704794
tagged with: inputstream
tagged with: chat
type: Question
accepted answer: http://stackoverflow.com/a/25990159
downvote count: 0
answer count: 1
has title: Creating an echo-server: Connected client gets IO-exception
has comment: http://stackoverflow.com/comment/40724139
has body: I'm trying to create a single-threaded echo-server, but I can't figure out how to send the input from the client back to the client again from the server. The client connects to the server alright, but it's when it's waiting for a response that it throws an IOException. I have tried connecting my chat client to other chat servers, hence I'm sure the fault is in the chat server implementation. I'm guessing the "villain of the piece" is this method presented below that takes the input from the connected client and sends it back, but I'm not sure why it doesn't work. private void processClientRequest(Socket clientSocket) throws IOException { InputStream in = clientSocket.getInputStream(); PrintWriter out = new PrintWriter(clientSocket.getOutputStream()); long time = System.currentTimeMillis(); out.write("Server - " + time + ": " + in); out.close(); in.close(); } Please tell me if this method isn't the issue and you need other parts of my code instead. Thanks in advance! Edit: I have now managed to get my server to respond to the client. I did this by changing the processClientRequest method to this: try { BufferedReader in = new BufferedReader( new InputStreamReader(clientSocket.getInputStream())); PrintWriter out = new PrintWriter(clientSocket.getOutputStream()); long time = System.currentTimeMillis(); out.write("Server - " + time + ": " + in.readLine()); out.close(); try { in.close(); } catch (IOException e) { System.err.println("Couldn't close input stream"); } } catch(IOException e) { System.err.println("Got an IOException error while reading or writing from/to client"); } But as of now my server can only respond the client once. If the client writes to the server a second time it does get a response, but instead of the clients message, it's "null". And since I want my echo server to be able to answer the client until the client shuts down or something like that, I need to figure out how to change that. I figure I'm going to need some kind of while loop to make thi…
tagged with: outputstream
favorite count: 0
tagged with: printwriter
has answer: http://stackoverflow.com/a/25990159
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/25995948
has answer: http://stackoverflow.com/a/25996158
type: UnansweredQuestion
has title: Counting odd, even & negative numbers in an array using Java Inheritance & Polymorphism
tagged with: java
type: Question
tagged with: counting
tagged with: inheritance
score: 0
answer count: 1
tagged with: arrays
tagged with: polymorphism
has body: [ClassDiagram]!1 I am a novice learning inheritance and polymorphism in Java. I came across this problem that I have been trying to solve. I seem to be getting the expected answers right, but whenever I run the Tests, I get errors for IsEven and IsNegative. What might I be doing wrong in relation to inheritance and polymorphism that is causing these errors even though my codes in the individual classes are working well? Here is the question: The picture above shows the relationship between the classes. Consider an array of integers as below: int[] a = {5, 2, -4, 3, 0, -5, 7, 11, 6, 13} Complete the method named count(int[] a) in the class Count. The method should return the number of positive numbers in the array. Thus count(a) should return 7 (not counting the 2 negative numbers and 0). On examining your code for count (your solution to part-a), you will see a test similar to this: if (a[i]>0) {...}. If we were to now ask you to modify the count method so that it counted the number of negative numbers, it would be trivial: All that you would have to do is change the greater-than comparison operator (“>”) to the less-than operator (“&lt;”). If we were to ask you to modify the count method to count the number of even numbers (whether positive or negative) then you would modify your code to have a test along the following lines: if (isEven(a[i])) {...}. Similarly, you could change your code for other types of counting (prime numbers, numbers greater than 10, etc). Note that in each case we can do any type of counting we like but we need to edit the code for the count method. This is a simple example of enhancing the functionality of existing code. For this part of the question, you will write Java code that allows you to enhance the counting functionality without modifying the code of existing methods. You will do this using the power of inheritance and polymorphism. a. Complete the method countIF that is similar to your implementation of count (from the earlier part …

http://stackoverflow.com/comment/40660422
has text: and why he should not call it String ?
comment on: http://stackoverflow.com/a/25968439
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26578684
answers question: http://stackoverflow.com/q/25989557
has comment: http://stackoverflow.com/comment/41782147
score: 0
has body: Have the same issue with gwt 2.6 and atmosphere-gwt-2.2.0 and atmosphere client 2.2.5. I've added true to a spring security filter and it seems to work. springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy true
type: Answer

http://stackoverflow.com/comment/40520533
score: 0
has text: possible duplicate of [What is a stack trace, and how can I use it to debug my application errors?](http://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25890677

http://stackoverflow.com/comment/40694487
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25986995
has text: fragmentTransaction.commit(); is in displayfragment method : see edit

http://stackoverflow.com/q/25940796
type: Question
has title: How to get data from a parse object?
has comment: http://stackoverflow.com/comment/40613623
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25941640
has comment: http://stackoverflow.com/comment/40613211
tagged with: android
score: 1
tagged with: parse-platform
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25941640
tagged with: java
has comment: http://stackoverflow.com/comment/40612057
has body: I have a class in parse.com called Messages. I have created a column called sent of type string which stores the object-id of the user to whom the message has to be sent. In my android app I want to retrieve the messages of the current user. But my app does not show any messages. This is how I'm implementing it- public void done(List&lt;ParseObject&gt; postList, ParseException e) { setProgressBarIndeterminateVisibility(false); if (e == null) { // If there are results, update the list of posts // and notify the adapter posts.clear(); //posts is a list of &lt;TextMessage&gt; //TextMessage is a class which holds the details of Messages (parse object) for (ParseObject msg : postList) { if(msg.getParseUser("sent")==ParseUser.getCurrentUser()) { TextMessage note = new TextMessage(msg.getObjectId()); posts.add(note); } } ((ArrayAdapter&lt;TextMessage&gt;) getListAdapter()).notifyDataSetChanged(); } I can't understand why the if conditions are not being implemented, what am I doing wrong. How else can I retrieve the string in the sent column? Feel free to ask for any more information required.

http://stackoverflow.com/comment/40714910
score: 0
type: Comment
type: QuestionComment
has text: Is the org.jboss.as.cmp package something you are referring to in your code? Have you tried removing it or not using it?
comment on: http://stackoverflow.com/q/25996926

http://stackoverflow.com/comment/40660043
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25931634
has text: @Killer included pojo class in question please see

http://stackoverflow.com/comment/40700078
type: Comment
score: 3
comment on: http://stackoverflow.com/q/25989449
type: QuestionComment
has text: @Holger refactoring, compilation time checks, auto-completion and abstraction of the underlying query implementation.

http://stackoverflow.com/q/25993547
downvote count: 0
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/25994676
favorite count: 0
has body: I am currently working with a project, I have multiple select box in my application, each values should change according to the previous value selected in the first list, here is my code, i did not get the second select list. Here is my jsp. <s:form id="onSelectList" action="#"> <s:hidden id="c_country" name="buildingName" value="%{bean.building}"></s:hidden> <s:hidden id="s_state" name="blockName" value="%{bean.block}"></s:hidden> </s:form> <s:hidden name="hospitalFloor.buildingName" id="c_country" ></s:hidden> <s:url id="loadbuildingurl" action="loadbuildingforFloor"/> <s:url id="loadstateurl" action="loadblockForFloor"/> <s:url id="loadbuildingurl" action="loadbuildingforFloor"/> <s:url id="loadstateurl" action="loadblockForFloor"/> Select Building : <sj:select tabindex="10" id="docform_country" cssClass="form-control input-sm" href="%{loadbuildingurl}" name="bean.country" list="building" onchange="loadValue();" onSuccessTopics="s_countryList,s_countryList1" onChangeTopics="c_countryList,c_countryList1" deferredLoading="false" headerKey="-1" headerValue="select" value="%{bean.country}"> </sj:select> Block : <sj:select tabindex="10" id="docform_state" cssClass="form-control input-sm" href="%{loadstateurl}" name="bean.state" list="block" formIds="onSelectList" onchange="loadValue();" onSuccessTopics="s_stateList,s_stateList1" onChangeTopics="c_stateList,c_stateList1" reloadTopics="c_countryList" deferredLoading="false" headerKey="-1" headerValue="select" value="%{bean.state}"> </sj:select> This is my struts.xml. This is my java action class for second selected list. package hart.hospitalManagement; import hart.bean.HospitalFloor; import hart.profilemanagement.DoctorRegistrationHelper; import java.util.Map; import com.opensymphony.xwork2.ActionSupport; public class HospitalBlockListForFloorAction extends ActionSupport { private Map<String, String> block; private String buildingName; private HospitalFloor hospitalfloor; public Map<String, String> getBlock() { return …
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25994676
upvote count: 1
tagged with: struts2-jquery-plugin
type: Question
has title: Implementing <sj:select /> in Struts2
tagged with: struts2
tagged with: struts2-jquery

http://stackoverflow.com/a/26543290
has comment: http://stackoverflow.com/comment/99700611
has comment: http://stackoverflow.com/comment/97879975
accepted answer of: http://stackoverflow.com/q/25996032
type: Answer
answers question: http://stackoverflow.com/q/25996032
has comment: http://stackoverflow.com/comment/128061177
has comment: http://stackoverflow.com/comment/86119280
has comment: http://stackoverflow.com/comment/99699175
has comment: http://stackoverflow.com/comment/90012705
has comment: http://stackoverflow.com/comment/97880739
score: 87
downvote count: 0
upvote count: 87
has body: Using some reflection did the trick for me Java: // https://github.com/android/platform_frameworks_base/blob/kitkat-release/core/java/android/widget/TextView.java#L562-564 Field f = TextView.class.getDeclaredField("mCursorDrawableRes"); f.setAccessible(true); f.set(yourEditText, R.drawable.cursor); XML: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" &gt; &lt;solid android:color="#ff000000" /&gt; &lt;size android:width="1dp" /&gt; &lt;/shape&gt; Here is a method that you can use that doesn't need an XML: public static void setCursorColor(EditText view, @ColorInt int color) { try { // Get the cursor resource id Field field = TextView.class.getDeclaredField("mCursorDrawableRes"); field.setAccessible(true); int drawableResId = field.getInt(view); // Get the editor field = TextView.class.getDeclaredField("mEditor"); field.setAccessible(true); Object editor = field.get(view); // Get the drawable and set a color filter Drawable drawable = ContextCompat.getDrawable(view.getContext(), drawableResId); drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN); Drawable[] drawables = {drawable, drawable}; // Set the drawables field = editor.getClass().getDeclaredField("mCursorDrawable"); field.setAccessible(true); field.set(editor, drawables); } catch (Exception ignored) { } }
has comment: http://stackoverflow.com/comment/99662500
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/99118367

http://stackoverflow.com/q/25955287
tagged with: java
type: Question
upvote count: 1
tagged with: apache
answer count: 1
tagged with: httpclient
favorite count: 0
accepted answer: http://stackoverflow.com/a/25988465
has title: using Apache HttpClient in a new thread, I don't know if it finished running
has answer: http://stackoverflow.com/a/25988465
tagged with: multithreading
has body: I faced a strange problem. I hope someone would find out the reason. code: public static void asyncSend(final RoomNotification notification, final int retryTimes) { Thread thread = new Thread(new Runnable() { @Override public void run() { boolean finish = false; try { ObjectMapper mapper = new ObjectMapper(); String messageString = mapper.writeValueAsString(notification); logger.info("json to send to Hipchat :{}", messageString); #1 Content content = Request.Post("https://api.hipchat.com/v2/room/&lt;hidden&gt;/notification?auth_token=&lt;hidden&gt;") .bodyString(messageString, ContentType.APPLICATION_JSON) .execute().returnContent(); #2 logger.info("Hipchat return:{}", content.asString()); finish = true; } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { #3 logger.info("send Hipchat {}:\n{}", finish ? "successfully" : "unsuccessfully", notification.message); if (finish) { return; } //如果失败，且还有重试次数就重新发送 if (retryTimes &gt; 0) { logger.info("retry sending Hipchat, retry times remain:{}\nmessage:{}", retryTimes, notification.getMessage()); try { Thread.sleep(10000); //重试前暂停10秒 } catch (InterruptedException e) { e.printStackTrace(); } asyncSend(notification, retryTimes - 1); } else { logger.info("no retry times remain, finally send Hipchat unsuccessfully.\nmessage:{}", notification.getMessage()); } } } }); thread.start(); } The problem is that, sometimes the line at neither #2 nor #3 would be run. is that mean the thread crashed without exception, or the line at #1 never finished running? The code at line #1 is reference from Apache Httpcomponents. I analysised the log just now, the output shows below: [wwwuser@mixi-mantou ~]$ grep "json to send to Hipchat" tomcat-mixi/logs/catalina.out | wc -l 216 [wwwuser@mixi-mantou ~]$ grep "send Hipchat successfully" tomcat-mixi/logs/catalina.out | wc -l 197 [wwwuser@mixi-mantou ~]$ grep "send Hipchat unsuccessfully" tomca…
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/40739533
score: 0
type: AnswerComment
has text: Yeah, I thought about it. Thanks for the idea :)
type: Comment
comment on: http://stackoverflow.com/a/26011853

http://stackoverflow.com/q/25924474
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
type: Question
accepted answer: http://stackoverflow.com/a/25925818
has title: cvc-elt.1: Cannot find the declaration of element for RootElement
has body: I've following schema using which i have generated the jaxb object. I'm populating the jaxb object with data and then marshaling it.I want to do schema validation while marshaling the jaxb object. ByteArrayOutputStream formXml = new ByteArrayOutputStream(); new JAXBElement<Form100DIV_V100>(new QName("http://example.org/types/2003/04", "Form100DIV_V100"), Form100DIVV100.class, (Form100DIVV100) form100); if (isSchemaValidationNeeded) { SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); InputStream xsdStream = XmlUtil.class.getClassLoader().getResourceAsStream("schema/form.xsd"); StreamSource xsdSource = new StreamSource(xsdStream); Schema schema = sf.newSchema(xsdSource); //m.setEventHandler(new SchemaValidationEventHandler()); //m.setSchema(schema); Validator validator = schema.newValidator(); try { validator.validate(new StreamSource(new ByteArrayInputStream(formXml.toByteArray()))); System.out.println("File is valid"); } catch (SAXException e) { System.out.println("File is NOT valid"); System.out.println("Reason: " + e.getLocalizedMessage()); } catch (IOException e) { e.printStackTrace(); } } <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://example.org/types/2003/04" targetNamespace="http://example.org/types/2003/04" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="Form100DIV_V100"> <xs:complexContent> <xs:extension base="AbstractForm100"> <xs:sequence> <xs:element name="AMOUNT" type="AmountType" minOccurs="0"/> --- </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> ---- ----- </xs:schema> Here is the xml which i'm getting after marshaling <Form100DIV_V100 xmlns="http://example.org/types/2003/04"> 100.00 ------- --------- </Tax1099Div_V100> I'm getting below error though namespaces are correct in xml and xsd. Reason: cvc-elt.1: Cannot find the declaration of element 'Form100DIV_V100'.
score: 0
has answer: http://stackoverflow.com/a/25925818
answer count: 1

http://stackoverflow.com/a/26010732
has comment: http://stackoverflow.com/comment/40738457
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You need to name the method getvalidate_submitted (in your bean) so that your page is able to pick up the method. Note that your method name isn't really following the Java naming 'standards'. From the best practice point of view you should name the method getValidateSubmitted and use the following EL #{viewScope.DetailsInvoiceAmountBean.validateSubmitted}
accepted answer of: http://stackoverflow.com/q/26006794
score: 1
answers question: http://stackoverflow.com/q/26006794
upvote count: 1

http://stackoverflow.com/comment/40600500
type: QuestionComment
has text: @Ishtiaque if you could resolve the issue please add the solution add accept it , so that people know it's closed.
comment on: http://stackoverflow.com/q/25917852
score: 0
type: Comment

http://stackoverflow.com/comment/40894497
type: Comment
has text: You can invoke transactional methods inside other transactional methods and this can be done without TX nesting. The outer transaction is suspended while the inner transaction is active. Should the inner transaction fail, you can choose to either rollback the outer transaction or keep and commit it (by catching the according Exception). You cannot rollback the inner transaction from the outer one.
comment on: http://stackoverflow.com/a/25974990
type: AnswerComment
score: 0

http://stackoverflow.com/a/25977306
answers question: http://stackoverflow.com/q/25977138
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/40676416
has body: You can create a view programmatically like this: TextView textView = new TextView(this); Then just add it to the layout. You can find more information here: http://www.mysamplecode.com/2011/10/android-programmatically-generate.html
has comment: http://stackoverflow.com/comment/40704793
accepted answer of: http://stackoverflow.com/q/25977138
score: 0

http://stackoverflow.com/q/25879308
tagged with: spymemcached
tagged with: java
has answer: http://stackoverflow.com/a/25890389
tagged with: jboss
score: 4
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
has title: What kind of bean should I use to provide access to a pool of objects in EJB?
accepted answer: http://stackoverflow.com/a/25890389
has body: At a high level, I have a MemcachedPoolService class that has two methods: getClientInstance() and returnClientInstance(client). As expected, getClientInstance() returns an instance of a MemcachedClient (spymemcachced) to the caller, and returnClientInstance(client) returns a MemcachedClient back to the pool. MemcachedPoolService needs to be available to other @Stateless services (injected) that all need access to Memcached. Currently I have MemcachedPoolService marked as a @Singleton, but I'm getting the following error when more than one client tries accessing the app: [0m[31m16:54:22,968 ERROR [org.jboss.as.ejb3.invocation] (http-/0.0.0.0:8080-10) JBAS014134: EJB Invocation failed on component MemcachedPoolService for method public net.spy.memcached.MemcachedClient com.apexlab.cache.MemcachedPoolService.getClientInstance(): javax.ejb.EJBTransactionRolledbackException: JBAS014373: EJB 3.1 PFD2 4.8.5.5.1 concurrent access timeout on org.jboss.invocation.InterceptorContext$Invocation@24bf375e - could not obtain lock within 5000MILLISECONDS What would be the best way to set up my MemcachedPoolService (and my web app in general) for a production environment to avoid getting the concurrent timeout exceptions?
type: AnsweredQuestion
tagged with: memcached
type: Question
tagged with: ejb

http://stackoverflow.com/comment/40563277
score: 0
has text: @ManjunathDR oops sorry. Changed it right away. Thanks.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25914142

http://stackoverflow.com/q/25981283
favorite count: 0
tagged with: class
accepted answer: http://stackoverflow.com/a/25982824
has comment: http://stackoverflow.com/comment/40683963
downvote count: 1
has title: Constructor and classes in Java
has body: I have one class Account (abstract). I have one class SavingsAccount (inherits Account). I have one class CreditAccount (inherints Account). SavingsAccount and CreditAccount are similar, except CreditAccount has a credit limit (variable limit). I have the following problems: I need help with how constructor in CreditAccount looks like. How can I add local variable limit to the constructor? Is it better (easier) if I have a variable limit in base class instead, and let SavingsAccount Always set it to be zero, while CreditAccount let the user set the limit? My teacher says since SavingsAccount and CreditAccount are almost the same, @Override are exactly the same, he recommends me to implement those methods in base class (Account). How will the code look like if I do that? Thank you for your help class Account: public abstract class Account { protected double balance = 0; protected String accountId; protected double interest = 0; public Account() {} public Account(double bal, String id, double inte) { if (balance &gt;= 0) { balance = bal; } else { balance = 0; } accountId = id; interest = inte; } public abstract String getAccountId(); public abstract double getBalance(); public abstract double getInterest(); } class SavingsAccount: public class SavingsAccount extends Account { public SavingsAccount() { super(); } public SavingsAccount(double bal, String id, double inte) { super(bal, id, inte); } @Override public String getAccountId() { return accountId; } @Override public double getInterest() { return interest; } @Override public double getBalance() { return balance; } } Class CreditAccount: class CreditAccount extends Account { private int limit; public CreditAccount() { super(); } public CreditAccount(double bal, String id, double inte) { //How can I add local variable limit to this??? super(bal, id, inte); } public void setLimit(int limit) { this.limit = limit; } @Override public String getAccountId() { return accountId; } @Override public double getInterest(){ retu…
has comment: http://stackoverflow.com/comment/40684180
upvote count: 0
tagged with: constructor
has comment: http://stackoverflow.com/comment/40683832
has answer: http://stackoverflow.com/a/25982824
has comment: http://stackoverflow.com/comment/40685762
has comment: http://stackoverflow.com/comment/40683873
type: Question
type: AnsweredQuestion
tagged with: java
score: -1
answer count: 1
has comment: http://stackoverflow.com/comment/40683750

http://stackoverflow.com/a/25961287
has comment: http://stackoverflow.com/comment/40646977
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25961256
downvote count: 0
has body: we need to re-initialize then variable, wouldn't it be nice if we had any language feature doing it automatically instead? No I think it's very beneficial for productivity, isn't it? No Resetting a variable to its start value is in many cases a sign that the scope of the variable is to large. So with clean code you hardly ever need such feature. And of course every feature comes at the cost of complicating the language even more.
score: 4
has comment: http://stackoverflow.com/comment/40648789

http://stackoverflow.com/q/25918784
has comment: http://stackoverflow.com/comment/40572104
type: Question
tagged with: appcfg
has title: google app engine remote api for local dev server redirecting to login page
answer count: 1
has comment: http://stackoverflow.com/comment/40572199
has answer: http://stackoverflow.com/a/25918998
type: UnansweredQuestion
tagged with: google-app-engine
has body: I get a 302 redirection error when trying to use appcfg.py to upload data to my local dev server. If I use a browser to access the relevant page (_ah/remote_api) I get a login page, the pre-filled in test@example.com works, but I get no prompt for that from the cmd line. Im using the Java variant of GAE, and I've used the upload_data command of appcfg.py before, I think the difference here is that I'm using a newer version than I have before (new machine). Any thoughts on how to fix this? I have checked around the net, and I cant find anyone else with the issue of being redirected to a login page. The command I am using is: ./gae/appcfg.py upload_data --url=http://127.0.0.1:8080/_ah/remote_api --filename=file Thanks
tagged with: python
has comment: http://stackoverflow.com/comment/40572943
score: 0
tagged with: java

http://stackoverflow.com/comment/40549750
score: 1
comment on: http://stackoverflow.com/a/25898911
has text: As far as I know there is no requirement for the lambda implementation methods to be `static`. E.g. lambdas capturing this could be implemented using an instance method, however, current compilers don’t use this opportunity.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25976813
has comment: http://stackoverflow.com/comment/40675529
type: Answer
has body: From the official CDI Plugin documentation: Use the right @Inject Struts 2 and it's core component XWork use it's own internal dependency injection container. Interestingly, you could name it JSR-330's grandma, since it is an early pre-release version of Google Guice once developed by Crazybob Lee - the same Bob Lee that, together with SpringSource's Rod Johnson, lead the JSR-330 specification. That said, you will find the @Inject annotation both as com.opensymphony.xwork2.inject.Inject and javax.inject.Inject. Don't mix up those two - javax.inject.Inject is the one you want to use with your Struts 2 CDI plugin and CDI integration in general! While you could use Struts' internal annotation as well, the effect may be strange to undefined - so check your imports! Then instead of com.opensymphony.xwork2.inject.Inject use the correct one: javax.inject.Inject
upvote count: 2
has comment: http://stackoverflow.com/comment/40677953
accepted answer of: http://stackoverflow.com/q/25975679
has comment: http://stackoverflow.com/comment/40678436
answers question: http://stackoverflow.com/q/25975679
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26013314
has comment: http://stackoverflow.com/comment/40743444
answers question: http://stackoverflow.com/q/26011148
score: 0
has comment: http://stackoverflow.com/comment/40743252
type: Answer
has body: I had the same problem too. I've solved it by coping the security libraries into lib directory (using maven-antrun-plugin for that, but you can figure out your own way to do this). You'll probably need to copy the sunpkcs11.jar file from your jre installation.
has comment: http://stackoverflow.com/comment/40743116

http://stackoverflow.com/comment/40742233
score: 0
comment on: http://stackoverflow.com/q/26012348
has text: Still not working... What I mean is that putString needs the location of the activity to pass it to the button, not to show it. And also needs the location of the string, just to display it
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25883555
has body: I have a java swing program which displays the content of an xml page in a jtable. I need to display the frame to be refreshed after every 1 minute. I need to dispose the old frame and get the new frame displayed after being refreshed import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.table.AbstractTableModel; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; public class XMLTableExample { JFrame frame = new JFrame("Frame"); public static void main(String[] args) { new XMLTableExample(); } public XMLTableExample() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager .getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JTable table = new JTable(); table.setOpaque(false); Color lav = new Color(220, 220, 250); try { table.setModel(new XMLTableModel(new File("Htmll.xml"))); Thread.sleep(6000); //frame.dispose(); }…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25883806
score: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/40507692
type: Question
has comment: http://stackoverflow.com/comment/40507781
tagged with: java
has comment: http://stackoverflow.com/comment/40508560
linked to: http://stackoverflow.com/q/9554636
accepted answer: http://stackoverflow.com/a/25883806
answer count: 2
possible better answer: http://stackoverflow.com/a/25883892
has title: Refreshing jframe and disposing the older frame
has answer: http://stackoverflow.com/a/25883892

http://stackoverflow.com/a/25903909
has comment: http://stackoverflow.com/comment/40544783
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25903878
answers question: http://stackoverflow.com/q/25903878
type: Answer
has comment: http://stackoverflow.com/comment/40544702
score: 1
upvote count: 1
has body: You just need a StringBuilder and two for loop StringBuilder builder = new StringBuilder(); for(int i = 0; i &lt; s.length(); i++) for(int j = 0; j &lt; n; j++) builder.append(s.charAt(i)); return builder.toString(); Slower, not recommended: String result = ""; for(int i = 0; i &lt; s.length(); i++) for(int j = 0; j &lt; n; j++) result += s.charAt(i); return result;
has comment: http://stackoverflow.com/comment/40544730

http://stackoverflow.com/comment/49936714
comment on: http://stackoverflow.com/a/26147788
type: Comment
score: 0
type: AnswerComment
has text: See also discussion in https://github.com/spring-projects/spring-boot/issues/677 and https://github.com/spring-projects/spring-boot/issues/1640

http://stackoverflow.com/comment/40752827
type: QuestionComment
has text: Show us where you are using the `loginService` bean.
score: 0
comment on: http://stackoverflow.com/q/26019323
type: Comment

http://stackoverflow.com/comment/40746913
score: 0
type: QuestionComment
type: Comment
has text: @CL. - When I count the number of records in the table, it has increased by one. Also, the record that I write in is very specific, so that I can inspect the data after and verify that the record has been altered. When I do inspect the data after the update, I see the record that I was altering, in its original state, and also the same record, with the change that I had made. Then, when I check the position of the cursor, its incremented. I know that this should not happen, which is why Im stumped. There shouldnt be any triggers as the db is very simple, with just a few tables.
comment on: http://stackoverflow.com/q/26004410

http://stackoverflow.com/a/25903366
downvote count: 0
has comment: http://stackoverflow.com/comment/40544265
accepted answer of: http://stackoverflow.com/q/25903320
has comment: http://stackoverflow.com/comment/40543680
answers question: http://stackoverflow.com/q/25903320
has comment: http://stackoverflow.com/comment/89214149
type: Answer
has body: The strategy here is that instead of leaking this decision into the language, Java lets the JVM/Hotspot/JIT/runtime decide where and how it wants to allocate memory. There is research going on to use "escape analysis" to figure out what objects don't actually need to go onto the heap and stack-allocate them instead. I am not sure if this has made it into a mainstrem JVM already. But if it does, it will be controlled by the runtime (thing -XX:something), not the developer. The upside of this is that even old code can benefit from these future enhancements without itself being updated. If you like to manually manage this (but still have the compiler check that it stays "safe"), take a look at Rust.
has comment: http://stackoverflow.com/comment/40544731
upvote count: 20
has comment: http://stackoverflow.com/comment/40543720
score: 20
type: AcceptedAnswer

http://stackoverflow.com/a/25880695
answers question: http://stackoverflow.com/q/25880618
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40502923
score: 2
upvote count: 2
has body: You need to implement the toString() on the Student object. public class Student { ... Your existing code ... @Override public String toString() { return studentID + ", " + studentName + ", " + //The remaining fields } } then in your main method, call for (Student student : studentList) { System.out.println(student.toString()); }

http://stackoverflow.com/q/25910712
tagged with: swing
type: Question
type: AnsweredQuestion
score: 3
has title: Block change action on swing controls
tagged with: java
has comment: http://stackoverflow.com/comment/40706501
has comment: http://stackoverflow.com/comment/40559866
has answer: http://stackoverflow.com/a/25973505
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/22003802
has body: I have a form asking some details to a user. In top of that form, there are 2 controls : a JSpinner and a JToggleButton. If the user use the JSpinner, he can select from form number 1 to 4, if he clic on the JToggleButton, the spinner is disabled an the form number 0 is displayed (if this button is toggled back, the spinner is enabled back and the form load with the number in the spinner). So far no problems. But I would like now, to display a popup when a form is edited, not saved and that the user use one of the 2 controls discrebed. No problem for the popup, but I don't know how to undo modification on the control that fired the display of the popup. Because I am using ChangeListener for the spinner and ActionListener for the button, I am displaying the popup AFTER the modification of the control. In fact I am searching a way to be notified of an action on the controls but with the possibility to stop the modification (something like a notification listener where we need to return true or false to validate the modification). How would you do that ? Thanks. Here is a sample : package test; import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.JTextField; import javax.swing.JToggleButton; import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class SwingTest extends JFrame { private static final long serialVersionUID = 1L; private JToggleButton btnRecueilPermanent; private JSpinner spinner; private JTextField tf; private boolean formChanged = false; public SwingTest() { super(); setLayout(new GridBagLayout()); initComponents(); loadForm(1); } private void ini…
favorite count: 0
accepted answer: http://stackoverflow.com/a/25973505
upvote count: 3

trace
tag name: trace
type: Tag
tags question: http://stackoverflow.com/q/26016714
tags question: http://stackoverflow.com/q/25998302

http://stackoverflow.com/comment/40529709
type: QuestionComment
has text: @T.J.Crowder Is this a relevantly new addition to Java? It's not working on the IDEONE site.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25895514

http://stackoverflow.com/comment/40580274
has text: that's true, but OP is using `do-while` and complains that it always executes once. It will even after the change you suggested
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25923259

http://stackoverflow.com/q/25996444
has title: java data structure can hold different type of element
favorite count: 0
possible better answer: http://stackoverflow.com/a/25996709
has answer: http://stackoverflow.com/a/25996709
has comment: http://stackoverflow.com/comment/40710823
has body: Is there a data structure in java can hold different type of objects? For example, if you need use Stack, the element in stack should be in the same type. What if I want a container has different objects inside it?
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/25996536
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40710842
type: Question
accepted answer: http://stackoverflow.com/a/25996536
answer count: 2
has comment: http://stackoverflow.com/comment/40710856
downvote count: 0

http://stackoverflow.com/q/25944044
score: 0
tagged with: methods
has body: I'm hopelessly trying to call a function with (int = amountCoefficients) amount of arguments, and declaring a function with that amount of arguments too. What makes it harder is that for example amountCoefficients = 5, then it means that there's an array of 5 blocks that each have a value (double). So the first argument would have to be equal to the value of the first block of that array, the second argument would have to be equal to the value of the second block of that array etc. And beforehand we don't know how many arguments we need, as that depends on the amount of doubles that are filled in by the user, so amountCoefficients could be equal to 2, 4, or any other positive integer. I'm pretty new to Java and I really don't have no idea what to do. As you can see below I tried to do something with a for loop, but I don't think that works. public class Interpol { public static void main(String []args) { Scanner scanner = new Scanner(System.in); //acquire user input (polynomial coefficients and interval values x1 and x2) ArrayList&lt;Double&gt; polynomialCoefficients = new ArrayList&lt;Double&gt;(); int amountCoefficients = 0; while (scanner.hasNextDouble()) { polynomialCoefficients.add(scanner.nextDouble()); amountCoefficients++; } String in = scanner.next(); double x1 = scanner.nextDouble(); double x2 = scanner.nextDouble(); //call method f to determine the polynomial function int i = 0; for (i = 0; i &lt; amountCoefficients; i++) { f } //call method findaroot to determine the root //print result } } public static double f(double x) { //function of which a root is to be found }
type: Question
accepted answer: http://stackoverflow.com/a/25944057
tagged with: java
possible better answer: http://stackoverflow.com/a/25944083
has answer: http://stackoverflow.com/a/25944083
answer count: 2
has title: How to call and declare a method with a variable amount of arguments?
tagged with: arrays
tagged with: variables
has answer: http://stackoverflow.com/a/25944057
type: AnsweredQuestion

http://stackoverflow.com/comment/40618947
has text: That means your web server is not running on port 8000. can you access the same url from browser?
comment on: http://stackoverflow.com/q/25944389
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26435459
score: 12
has comment: http://stackoverflow.com/comment/41524209
has comment: http://stackoverflow.com/comment/44455873
type: Answer
has comment: http://stackoverflow.com/comment/42002098
upvote count: 12
answers question: http://stackoverflow.com/q/25913710
downvote count: 0
has body: Edit this file: /Applications/PyCharm\ CE.app/Contents/Info.plist vi /Applications/PyCharm\ CE.app/Contents/Info.plist CHANGE: JVMVersion 1.6* TO: JVMVersion 1.8* Is this it

http://stackoverflow.com/q/25903469
answer count: 1
score: -2
favorite count: 0
has title: Can't print array read from txt file
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/40544067
downvote count: 2
has answer: http://stackoverflow.com/a/25903697
has comment: http://stackoverflow.com/comment/40544244
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40543899
has comment: http://stackoverflow.com/comment/40543879
type: Question
accepted answer: http://stackoverflow.com/a/25903697
upvote count: 0
tagged with: arrays
has body: trying to read from a text file, create an array from the data then print the array. The text file looks like this GameSave 4 7583 2946 2946 0586 The code should in theory look for the text "GameSave" then read the next line for the array size then the following lines are the array data. It compiles and there are no errors when i run the code but it prints nothing to the screen. Any help would be great. import java.util.*; import java.io.*; public class LoadArray { public static void main ( String[] args ) throws IOException { String fileName = "saveGame.txt"; Scanner kb = new Scanner(new File(fileName)); String gameSave = "GameSave"; BufferedReader input = new BufferedReader(new FileReader(fileName)); String in = input.readLine().trim(); String length = input.readLine().trim(); int[][] array = new int[Integer.parseInt(length)][Integer.parseInt(length)]; if (in == gameSave) { in = input.readLine(); String[] temp = in.split(""); for (int i = 0; i &lt; array.length; i++) { for (int p = 0; p &lt; array.length; p++) { array[i][p] = Integer.parseInt(temp[i]); System.out.print(array[i][p]); } System.out.println(); in = input.readLine(); temp = in.split(""); } } }}
tagged with: file-io
has comment: http://stackoverflow.com/comment/40543863

http://stackoverflow.com/comment/55273357
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26131364
score: 0
has text: I was searching the answer for the same question and find your solution. However I really did not get the answer, why we should set body to BeanInvocation in the first place if we use it to get parameters ? what is the advantage of this ? instead we could just set for instance: MessageContentsList mclOut=new MessageContentsList(); mclOut.set(0,"aaa"); e.getIn().setBody( mclOut);

http://stackoverflow.com/comment/40603961
comment on: http://stackoverflow.com/q/25936617
type: QuestionComment
has text: Although unlikely, what if the user put ins something like "0000235"? String length would determine this to be incorrect, but it technically should be accepted.
score: 0
type: Comment

http://stackoverflow.com/a/25876262
score: 0
has comment: http://stackoverflow.com/comment/40495488
has comment: http://stackoverflow.com/comment/40494608
answers question: http://stackoverflow.com/q/25875928
has comment: http://stackoverflow.com/comment/40494978
type: Answer
has comment: http://stackoverflow.com/comment/40494811
has comment: http://stackoverflow.com/comment/40496362
has comment: http://stackoverflow.com/comment/40494687
has body: You are looking for a "naked objects"-like approach. While this approach is very good at getting some sort of initial GUI, the manner in which the GUI is generated tends to make even the most trivial GUI changes require changes to your object driving the GUI generation. This tends to run counter to many approaches designed to minimize the need to rewrite your core logic when you need a new GUI feature. Now that you've been warned, if you still want to step on this landmine, I'll show you the way, in pseduocode public Component generateComponent(Object object) { Class c = object.getClass(); Method[] m = c.getDeclaredMethods(); for (int i = 0; i &lt; m.length; i++) { if (m.getName().startsWith("get")) { Class returnClass = m.getReturnClass(); if (returnClass.equals(String.class)) { add(new TextBox(...); } } } } Quickly you'll have to make decisions about what methods to include / exclude, and the mechanisms you use to make that decision. Then you have to make decisions about how to present the information, and you have to make the new JComponents list to changes to call back the relevant "set..." methods. In short, it sounds like a great idea, until you do it. Then it becomes one of those issues where you got what you asked for instead of what you wanted.
has comment: http://stackoverflow.com/comment/40495224
has comment: http://stackoverflow.com/comment/40496179
has comment: http://stackoverflow.com/comment/40494874
has comment: http://stackoverflow.com/comment/40495119
has comment: http://stackoverflow.com/comment/40494490

http://stackoverflow.com/q/26014358
tagged with: java
tagged with: jaxb
has title: JAXB - Map schema to different fields of same object
tagged with: marshalling
type: Question
has comment: http://stackoverflow.com/comment/40759790
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40751527
has comment: http://stackoverflow.com/comment/40754130
tagged with: http://stackoverflow.com/tag/xml
has body: I'm trying to use JAXB in my project and I found an issue that with Jibx was easy to handle (we stopped using it with jboss 7) but with JAXB we are having difficulties to solve. So I have a class A as follows: public class A { @XmlElement(name ="xpto") public B fieldXPTO; @XmlElement(name ="foo") public B fieldFOO; } And my class B : public class B { public String name; public String address; } Now building our schema for class A we wanted to specify different names for the class B fields for each class A field. Something that when marshalling an A object would turn out like &lt;A&gt; &lt;xpto&gt; &lt;name_xpto&gt;Peter&lt;/name_xpto&gt; &lt;address_xpto&gt;Moon Street&lt;/address_xpto&gt; &lt;/xpto&gt; &lt;foo&gt; &lt;name_foo&gt;Ryan&lt;/name_foo&gt; &lt;address_foo&gt;Mars Street&lt;/address_foo&gt; &lt;/foo&gt; &lt;/A&gt; Is it possible to do this just by working with the schema ? Thank you all, Pedro
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: schema
score: 1

http://stackoverflow.com/a/58214229
downvote count: 3
has comment: http://stackoverflow.com/comment/102805859
score: -3
type: Answer
answers question: http://stackoverflow.com/q/25965645
has body: You can make a Tab Switcher from this Library https://github.com/michael-rapp/ChromeLikeTabSwitcher This library provides a very easy method to do almost everything a chrome browser does.
upvote count: 0
has comment: http://stackoverflow.com/comment/108270789

http://stackoverflow.com/q/25965529
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/25967937
score: 1
tagged with: java
tagged with: hibernate
type: Question
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40655340
has body: I am using spring framework for my web application where I have to persist the information of object, say, - Account. The scenario as below: User can select an account from dropdown list of his all accounts and he can view + Add + Modified the data of that selected account throughout the application. If user change the account - A to account - B, he can view all the information of only B account where he can perform same operations. Once user logged out and logged in again, he can see the information of latest selected account. Is there any way I can get the selected account object reference over the Controller/DAO level apart from storing information in session?
has comment: http://stackoverflow.com/comment/40655695
has title: Persist an Object throughout the application using Spring framwork
favorite count: 0
downvote count: 0

http://stackoverflow.com/q/25982306
has comment: http://stackoverflow.com/comment/40695257
tagged with: java
has comment: http://stackoverflow.com/comment/40717767
has comment: http://stackoverflow.com/comment/40715386
has comment: http://stackoverflow.com/comment/40691514
score: 0
has title: Why getRolloverTab is not working as expected in Java
type: UnansweredQuestion
answer count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/40716101
has body: I have created my own custom jTabbedPane Class exteding BasicTabbedPaneUI. Everything is working great as expected except for one thing and that is I cannot get my getRolloverTab() method of BasicTabbedPaneUI work as expected. Here is my code import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; import javax.swing.plaf.basic.BasicTabbedPaneUI; public class HAAMS { //My Custom class for jTabbedPane public static class CustomMainMenuTabs extends BasicTabbedPaneUI { protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Graphics2D g2 = (Graphics2D) g; Color color; if (isSelected) { color = new Color(74, 175, 211); } else if (getRolloverTab() == tabIndex) { color = new Color(45, 145, 180); } else {color = new Color(68, 67, 67);} g2.setPaint(color); g2.fill(new RoundRectangle2D.Double(x, y, w, h, 30, 30)); g2.fill(new Rectangle2D.Double(x + 100,y,w,h)); } } public static void main(String[] args) { JFrame MainScreen = new JFrame("Custom JTabbedPane"); MainScreen.setExtendedState(MainScreen.getExtendedState() | JFrame.MAXIMIZED_BOTH); //Setting UI for my jTabbedPane implementing my custom class CustomMainMenuTabs JTabbedPane jtpane = new JTabbedPane(2); jtpane.setUI(new CustomMainMenuTabs()); jtpane.add("1st Tabe", new JPanel()); jtpane.add("2nd Tabe", new JPanel()); jtpane.add("3rd Tabe", new JPanel()); MainScreen.getContentPane().add(jtpane); MainScreen.setVisible(true); } } What is that which I am going wrong and this does not change background color of tab when mouse hovers the tab? Any help would be greatly appreciated. You can see that in my IF condition, getRolloverTab() condition is given which should change the color of the tab when mouse hovers over the tab but the problem is that it doesn't change color when mouse hovers over the tab. While if(isSelected) condition and else condition are working …
type: Question
has comment: http://stackoverflow.com/comment/40715691

http://stackoverflow.com/q/26032042
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40777565
has title: upload file is not store
linked to: http://stackoverflow.com/q/1367322
has comment: http://stackoverflow.com/comment/40896899
score: 0
has comment: http://stackoverflow.com/comment/40813023
has comment: http://stackoverflow.com/comment/40817538
tagged with: oracle-database
has body: The file which i am trying to store in the back end is not a valid directory.. I think the code has a Unix directory config which i need to change to make this work in your windows. how i can identify the directory where the file is trying to be stored. i am getting the following error. [com.keenan.oacommon.forms.services.FormServiceImpl] [checkFileDtlPathCreateIfNotExists] - strFileMstPath is not valid [INFO ] [java.lang.Class] [processListFiles] - strFinalUploadPath [] [INFO ] [com.keenan.oacommon.forms.services.FormServiceImpl] [verifyFilePath] - Validating path [] [ERROR] [com.keenan.oacommon.forms.services.FormServiceImpl] [verifyFilePath] - strFilePath is NULL [ERROR] [java.lang.Class] [processListFiles] - File upload path is not valid here is my java code.. @Override public boolean verifyFilePath(String inFilePath) { boolean isFilePathValid = false; String strFilePath = inFilePath; logger.info("Validating path [" + strFilePath + "]"); if (strFilePath == null || strFilePath.equalsIgnoreCase("")) { logger.error("strFilePath is NULL"); isFilePathValid = false; } else { try { File fileUploadDir = new File(strFilePath); if (fileUploadDir.exists() &amp;&amp; fileUploadDir.isDirectory()) { logger.error("File Path [" + strFilePath + "] is good"); isFilePathValid = true; } else { logger.warn("File Path [" + strFilePath + "] is not valid"); isFilePathValid = false; } } catch (Exception e) { isFilePathValid = false; logger.error("Exception while validating File Path [" + strFilePath + "] - " + e.getMessage(), e); } } return isFilePathValid; } @Override public String checkFileDtlPathCreateIfNotExists(String inFilePath, String inAppSeqNo, String inUploadSeqNo) { boolean isFilePathValid = false; /* Main directory (all file uploads) */ String strFileMstPath = null; File fileUploadMstDir = null; /* Sub directory (file uploads per application) */ String strFileDtlAppPath = null; File fileUploadDtlAppDir = null; /* Sub-sub directory (file uploads per upload request) */ String …
answer count: 0

http://stackoverflow.com/q/25960968
accepted answer: http://stackoverflow.com/a/25961464
tagged with: opengl
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25961464
tagged with: 3d
answer count: 1
score: 0
tagged with: shapes
tagged with: jogl
has body: i followed those steps in order to setup and create my first project: setup tutorial Here is the problematic code: main class: /** * */ package name.wadewalker.tutorial; import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; /** * @author PTOSH * */ public class openGL{ /** * @param args */ GLU glu; public static void main(String[] args) { // TODO Auto-generated method stub GLProfile glp = GLProfile.getDefault(); GLProfile.initSingleton(); GLCapabilities CAPS = new GLCapabilities(glp); GLCanvas CANVAS = new GLCanvas(CAPS); CANVAS.addGLEventListener(new newLstn()); Frame FRAME = new Frame("AWT WINDOW TEST"); FRAME.setSize(1300, 700); FRAME.add(CANVAS); FRAME.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent E){ System.exit(0); } }); FRAME.setVisible(true); } } GLEventListener : package name.wadewalker.tutorial; import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; public class newLstn implements GLEventListener { private GL2 gl; private GLU glu; @Override public void display(GLAutoDrawable arg0) { // TODO Auto-generated method stub gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); gl.glClearColor(0f,0f,0f,0f); gl.glBegin(GL.GL_TRIANGLES); // Font-face triangle gl.glColor3f(1.0f, 0.0f, 0.0f); // Red gl.glVertex3f(0.0f, 0.5f, 0.0f); // gl.glColor3f(0.0f, 1.0f, 0.0f); // Green gl.glVertex3f(-0.5f, -0.5f, 0.5f); // gl.glColor3f(0.0f, 0.0f, 1.0f); // Blue gl.glVertex3f(0.5f, -0.5f, 0.5f); // Right-face triangle // gl.glColor3f(1.0f, 0.0f, 0.0f); // Red gl.glVertex3f(0.0f, 0.5f, 0.0f); // gl.gl…
has title: Jogl 2.2.1 working tutorial for windows?
type: AnsweredQuestion

http://stackoverflow.com/q/25911469
type: UnansweredQuestion
has title: request.getScheme() is returning http instead of returning https in java
score: 13
has answer: http://stackoverflow.com/a/54083483
favorite count: 0
has answer: http://stackoverflow.com/a/26107029
has comment: http://stackoverflow.com/comment/40558282
has comment: http://stackoverflow.com/comment/40558174
type: Question
has answer: http://stackoverflow.com/a/51056992
upvote count: 13
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/19598690
has body: function demo(request,response){ request.getScheme() is returning http instead of returning https. System.out.println(""+request.getScheme()); } output:http --above function demo is being called from main method but it prints http instead it should print https while working on internet server.
tagged with: jakarta-ee
downvote count: 0
has comment: http://stackoverflow.com/comment/40557951

http://stackoverflow.com/a/26000951
answers question: http://stackoverflow.com/q/26000919
downvote count: 0
has body: There is a semantic error here : if (dragon = true) public void run(){ /* etc */ You don't mean to say what you think here: you are assigning true to dragon var , and it's always true after. You must use if (dragon == true)
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/25933331
type: Question
accepted answer: http://stackoverflow.com/a/25933727
has title: Why my GUI won't update even tho repaint() is being called?
has comment: http://stackoverflow.com/comment/40597990
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/40598194
answer count: 1
tagged with: swingworker
tagged with: java
has answer: http://stackoverflow.com/a/25933727
tagged with: concurrency
linked to: http://stackoverflow.com/q/6273581
type: AnsweredQuestion
downvote count: 0
tagged with: sorting
score: 1
favorite count: 0
has body: I am having some difficulties using swing workers, timers, and I am actually a little confused. As far as my understanding goes, I have to put on a timer to set-up recurring tasks that have to be called by the EDT. I'm trying to make a program that shows graphically a sorting alghoritm (like this : https://www.youtube.com/watch?v=kPRA0W1kECg ) I just don't understand why the GUI won't refresh. I am quite sure the repaint method is being called since I put a sysout showing me the ordered values and it seems to work , but the GUI just... doesn't change. Here's my code: public class MainWindow { private JFrame frame; JPanel panel; public final static int JFRAME_WIDTH = 800; public final static int JFRAME_HEIGHT = 600; public final static int NELEM = 40; ArrayList&lt;Double&gt; numbers; ArrayList&lt;myRectangle&gt; drawables = new ArrayList&lt;myRectangle&gt;(); Lock lock = new ReentrantLock(); Condition waitme = lock.newCondition(); public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainWindow window = new MainWindow(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public MainWindow() { initialize(); } private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, JFRAME_WIDTH + 20, JFRAME_HEIGHT + 40); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new myPanel(); frame.getContentPane().add(panel, BorderLayout.CENTER); Timer timer = new Timer(500, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { lock.lock(); try{ //Updating the gui panel.repaint(); panel.revalidate(); //Giving the OK to the sorting alghoritm to proceed. waitme.signal(); }catch(Exception e){ e.printStackTrace(); }finally{ lock.unlock(); } } }); timer.start(); SwingWorker&lt;Integer, String&gt; sw = new SwingWorker&lt;Integer, String&gt;(){ @Override protected Integer doInBackground() throws Exception { mapAndCreate(); bubbleSort(); return null; } }; …

http://stackoverflow.com/comment/40588245
score: 0
has text: @user3852672 I am running this validation on my form and it's working perfectly even if the keyboard pops up .so please post the screen shot or code if you can..
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25927701

http://stackoverflow.com/comment/40559905
has text: i want to change the whole image to another and back to orignal image i am using an imagebutton e.g if image button is a mouse image when is clicked mice image comes and again mouse image comes back.
comment on: http://stackoverflow.com/q/25911710
score: 0
type: QuestionComment
type: Comment

enums
tags question: http://stackoverflow.com/q/25939370
tags question: http://stackoverflow.com/q/25901714
tags question: http://stackoverflow.com/q/26009077
tags question: http://stackoverflow.com/q/25977149
tags question: http://stackoverflow.com/q/26013755
tags question: http://stackoverflow.com/q/26029635
tags question: http://stackoverflow.com/q/26004603
tags question: http://stackoverflow.com/q/25951915
tags question: http://stackoverflow.com/q/26008735
tags question: http://stackoverflow.com/q/25898214
tag name: enums
tags question: http://stackoverflow.com/q/25937977
tags question: http://stackoverflow.com/q/25938544
tags question: http://stackoverflow.com/q/25939710
type: Tag
tags question: http://stackoverflow.com/q/25915947
tags question: http://stackoverflow.com/q/25874764

http://stackoverflow.com/comment/40687906
score: 0
has text: Is this really Vaadin centric?
type: QuestionComment
comment on: http://stackoverflow.com/q/25979359
type: Comment

http://stackoverflow.com/a/25897477
has comment: http://stackoverflow.com/comment/40536762
has body: I don't think a tree is the best structure to go with. Consider following diagram: Here chair is made from 2 wooden sticks and 4 wooden planks. You can also create support for making 4 wooden sticks from 1 raw wood by saying that 1 stick costs 0.25 raw wood. However, this is not a tree. You could enforce it to be a tree, by making 2 raw wood nodes, but on bigger diagrams that would cause huge memory inefficiency. What you do have, is an Oriented graph with no oriented cycles (oriented cycles would be bad, like you need hammer to make iron, but you need iron to make hammer). Now, how to make efficient lookup of basic elements? Let's assume that the database will not be changed during the time the program runs, that will allow us some optimalizations. If you are looking for time efficiency, I would recommend each node having a Map&lt;String, Double&gt; map of raw materials needed to create this node's element. To initialize this map, just sum together all the maps of this node's children, multiplied by the coefficient of how much of that element you need to create this element. If the children's map is not initialized yet, initialize it recursively. The question is how often too look into the database? For better convenience, I would keep an additional Map&lt;String, Node&gt; map from names to existing nodes, like if you see that chair needs wooden sticks, you can look if you have already used wooden sticks for something else and thus you don't need to recompute their raw materials. So you look in the database only the stuff you need and never the same thing twice. Or for smaller database, you could initialize the whole graph at start, but you are risking that if some items will not be requested, you have wasted your time and memory. EDIT: The problem complicates if we wanted to allow the database to change, let's consider more nodes: If the red line changed it's value (for example more efficient way to create pre-proccessed wood is found) then we need to invalidate a…
type: Answer
has comment: http://stackoverflow.com/comment/40538197
score: 2
has comment: http://stackoverflow.com/comment/40536542
downvote count: 0
has comment: http://stackoverflow.com/comment/40536886
upvote count: 2
has comment: http://stackoverflow.com/comment/40535783
answers question: http://stackoverflow.com/q/25896434
has comment: http://stackoverflow.com/comment/40537034

http://stackoverflow.com/q/26029298
score: 0
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26029336
has comment: http://stackoverflow.com/comment/40771326
tagged with: java
has answer: http://stackoverflow.com/a/26029482
has answer: http://stackoverflow.com/a/26029327
type: Question
has body: import java.util.Scanner; public class CoffeeShop { public static void main(String[] args) { //Welcome message String username; System.out.println("Please enter your name"); Scanner keyboard = new Scanner(System.in); username = keyboard.next(); System.out.println("Welcome to the Java Byte Code Coffee Shop," + username + "!"); //Menu System.out.println("Here is our menu."); System.out.println("1. Coffee $1.50"); System.out.println("2. Latte $3.50"); System.out.println("3. Cappuccino $3.25"); System.out.println("4. Expresso $2.00"); //Item selection int item_Number; System.out.println("Please enter an item number."); Scanner item = new Scanner(System.in); item_Number = item.nextInt(); if(item_Number == 1) { item = 1.50; } if(item_Number == 2) { item = 3.50; } if(item_Number == 3) { item = 3.25; } if(item_Number == 4) { item = 2.00; } //Item Quantity int quantity; System.out.println("Please enter the quantity."); Scanner amount = new Scanner(System.in); quantity = amount.nextInt(); double total = quantity * item; System.out.println("Total before discount and tax is " + total); //Discount and tax double nuTotal; if(total &gt;= 10) { nuTotal = total - (total * .1); } else { nuTotal = total; } System.out.println("Your total with discount is " + nuTotal); double totalTax = nuTotal * .07; System.out.println("Your total with tax is " + totalTax); System.out.println("Thank you " + username + "! Please stop by again!"); } } Your assignment is to write a program called CoffeeShop (in the file CoffeeShop.java) that simulates a virtual coffee shop, allowing the user to select an item to purchase, along with the quantity of that item. After obtaining the item selection and desired quantity from the user, your program should calculate the cost, tax, discount, and final cost, then display these to the user.
has title: I keep getting multiple errors each time I try to compile the program. Not sure where I went wrong
has comment: http://stackoverflow.com/comment/40771340

http://stackoverflow.com/comment/40659922
comment on: http://stackoverflow.com/a/25957965
has text: this piece of code should work for both
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25932051
answers question: http://stackoverflow.com/q/25931316
type: Answer
has body: if your import takes longer than 60 seconds your issue is documented at [1]. The Google App Engine request timer (Java/Python/Go) ensures that requests have a finite lifespan and do not get caught in an infinite loop. Currently, the deadline for requests to frontend instances is 60 seconds. (Backend instances have no corresponding limit.) Every request, including warmup (request to /_ah/warmup) and loading requests ("loading_request=1" log header), is subject to this restriction. If a request fails to return within 60 seconds and a DeadlineExceededError is thrown and not caught, the request is aborted and a 500 internal server error is returned. If the DeadlineExceededError is caught but a response is not produced quickly enough (you have less than a second), the request is aborted and a 500 internal server error is returned. Hope this helps. Ciao Paolo Links: [1] - https://developers.google.com/appengine/articles/deadlineexceedederrors
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40604106
has comment: http://stackoverflow.com/comment/40599242
downvote count: 0

http://stackoverflow.com/a/25893958
type: AcceptedAnswer
type: Answer
has body: You cannot use the NDK to build libraries for use on a normal Linux, for a number of reasons, including that the C libraries and their associated dynamic linker are different and the library naming conventions differ. Typically you would also have a different processor (though the NDK now supports most that might be in your development machine), and perhaps a subtly different ABI even when the processor matches. You can still accomplish your goal of testing your jni code on the desktop, you will just need to build it with a toolchain targeting your desktop Linux environment (with appropriate settings for jni usage there), then re-build it with the NDK for your android target.
accepted answer of: http://stackoverflow.com/q/25892496
score: 0
answers question: http://stackoverflow.com/q/25892496

http://stackoverflow.com/q/25918306
tagged with: web-services
has title: deploy webservice at different contextroot from webapp
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/31851207
tagged with: wildfly-8
has body: I have two webapps in the same wildfly 8 server. Both are deployed at contextroot /, and use different host-configuration. However, i have one webservice included in both webapps, but wildfly deploys both of them at the same contextroot, and hence when i deploy the applications, one inherently fails because its webservice name already collides with the other webservice for the other webapp that was deployed first. I want to deploy the webservice on every webapp at different contextroots, while maintaining each webapps contextroot at /. I have looked at the JBossWS guide, and this does not help. @Webservice(name = "service", serviceName = "web") public class MyWebservice{ }
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: java-ee-7

http://stackoverflow.com/comment/40491718
comment on: http://stackoverflow.com/a/25874346
score: 0
type: AnswerComment
has text: I know right. I was also considering looking into foreign keys, and have the query also check into the foreign key aspect of the selected row, look at the number, and then modify it there from the code.
type: Comment

http://stackoverflow.com/comment/40623350
score: 0
comment on: http://stackoverflow.com/q/25943689
type: QuestionComment
type: Comment
has text: yes, I have included library. I do not think I am using proguard, not sure though, can you please let me know where to check?

http://stackoverflow.com/a/51989377
has comment: http://stackoverflow.com/comment/110850588
upvote count: 1
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/90935284
has body: I had a similar issue and the reason was, there were more hidden elements along with the actual element that i tried to find. So click was actually trying to interact with hidden element and throwed the exception. Solution- I fine-tuned the element's xpath to make it unique which resulted the interaction to the actual element.
type: Answer
answers question: http://stackoverflow.com/q/25917132

http://stackoverflow.com/q/25889630
has body: I have this String : 10841-F-13930426-omme-salame--hamsare-geramiye-rasoule-khoda_split_005.png How i can just get Last int. I need to get 005.png and then get 5 (In java). Notice : The length of Strings is different .
has title: Split a string in java?
has answer: http://stackoverflow.com/a/25889735
has answer: http://stackoverflow.com/a/25889907
has answer: http://stackoverflow.com/a/25889720
accepted answer: http://stackoverflow.com/a/25889907
has comment: http://stackoverflow.com/comment/40518102
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25889951
tagged with: java
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/25889735
has comment: http://stackoverflow.com/comment/40518068
score: -1
upvote count: 0
has answer: http://stackoverflow.com/a/25889759
favorite count: 0
answer count: 5

http://stackoverflow.com/comment/40631873
comment on: http://stackoverflow.com/q/25952991
type: Comment
type: QuestionComment
has text: @HovercraftFullOfEels appreciate your willingness to teach and provide helpful feedback rather than blowing up at new people on SO
score: 0

http://stackoverflow.com/comment/40734352
type: Comment
has text: Never mind, figured it out. Thanks Man! really helped me a discovered some other ways in the process :)
comment on: http://stackoverflow.com/a/26008998
type: AnswerComment
score: 0

machine-learning
tags question: http://stackoverflow.com/q/25905435
tags question: http://stackoverflow.com/q/25908536
tag name: machine-learning
type: Tag

http://stackoverflow.com/q/26008199
has answer: http://stackoverflow.com/a/26009942
downvote count: 0
has body: I know the rationale behind nested loops, but this one just make me confused about the reason it wants to reveal: public static LinkedList LinkedSort(LinkedList list) { for(int k = 1; k &lt; list.size(); k++) for(int i = 0; i &lt; list.size() - k; i++) { if(((Birth)list.get(i)).compareTo(((Birth)list.get(i + 1)))&gt;0) { Birth birth = (Birth)list.get(i); list.set( i, (Birth)list.get( i + 1)); list.set(i + 1, birth); } } return list; } Why if i is bigger then i + 1, then swap i and i + 1? I know for this coding, i + 1 equals to k, but then from my view, it is impossible for i greater then k, am i right? And what the run result will be looking like? I'm quite confused what this coding wants to tell me， hope you guys can help me clarify my doubts, thank you.
favorite count: 0
accepted answer: http://stackoverflow.com/a/26010027
has title: Get confused with nested loops
upvote count: 2
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/44858516
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26010027
tagged with: nested-loops
possible better answer: http://stackoverflow.com/a/26009942

http://stackoverflow.com/q/26032806
tagged with: user-interface
tagged with: scope
type: Question
has title: Application using vaadin4spring not starting due to not having a registered "ui" scope
tagged with: vaadin4spring
has comment: http://stackoverflow.com/comment/40819529
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40789910
tagged with: vaadin
type: UnansweredQuestion
has body: I'm trying to integrate the vaadin4spring library into an application (0.0.3-SNAPSHOT) and following the instructions on the readme.md file of the project I end up with an exception that states: HTTP Status 500 - com.vaadin.server.ServiceException: java.lang.IllegalStageException: No Scope registered for scope 'ui' I'm annotating the UI with @VaadinUI and the views with @UIScope and @VaadinView coming from the library packages. I tried also with having the SpringVaadinServlet initialized on my web.xml: JbStatus org.vaadin.spring.servlet.SpringAwareVaadinServlet beanName jbStatusUI JbStatus /ui/* JbStatus /VAADIN/* As I still want to be able to serve REST endpoints. I also tried having nothing in the web.xml (except from the welcome-file list) and having this mappings specified in the application.properties under /src/main/resources as: vaadin.servlet.urlMapping=/ui/* vaadin.servlet.params.productionMode=${productionMode} vaadin.static.servlet.urlMapping=/VAADIN/* server.sessionTimeout=400 Thanks a lot in advance for any ideas/suggestions
has answer: http://stackoverflow.com/a/26056386

http://stackoverflow.com/q/25984189
has answer: http://stackoverflow.com/a/25984692
tagged with: java
has comment: http://stackoverflow.com/comment/40689449
type: Question
has comment: http://stackoverflow.com/comment/40689406
answer count: 2
accepted answer: http://stackoverflow.com/a/25984289
tagged with: string
has comment: http://stackoverflow.com/comment/40689400
score: 0
has title: Saving the values of a string to another class and retrieving it
has body: I am currently trying to save the values of a string to another class file in JAVA called Memory.JAVA. The reason why I am doing this is because variables are not saved outside the Try - Catch Blocks. Therefore I initiate the class in the try catch block by using this code: Memory mem = new Memory(); And then when I want to save a string, I use the following: mem.brother1ID = "Whatever"; The reason why I am not creating it as a new String is because in the Memory class, I have already initiated this string. To test that this has been saved, I have used System.out.println to print out the result which in this case was "Whatever" but when I try to get the same result printed out in the same class, I get the result "null". Does anyone have any suggestions regarding my issue? Please feel free to comment below. Thanks! UPDATE: Some code posted below: private void searchFieldKeyReleased(java.awt.event.KeyEvent evt) { try { Memory mem = new Memory(); String sql = "select * from userInfo where firstName= ? OR lastname = ?"; pst=conn.prepareStatement(sql); pst.setString(1, searchField.getText()); pst.setString(2, searchField.getText()); rs=pst.executeQuery(); if(rs.next()) { String firstName = rs.getString("firstName"); String lastName = rs.getString("lastName"); String placeOfResidence = rs.getString("placeOfResidence"); String employmentStatus = rs.getString("employmentStatus"); String currentEmployer = rs.getString("currentEmployer"); String taxStatus = rs.getString("taxStatus"); String dateOfBirth = rs.getString("dateOfBirth"); String mother = rs.getString("mother"); String father = rs.getString("father"); String brother1 = rs.getString("brother1"); String brother2 = rs.getString("brother2"); String brother3 = rs.getString("brother3"); String brother4 = rs.getString("brother4"); String brother5 = rs.getString("brother5"); String sister1 = rs.getString("sister1"); String sister2 = rs.getString("sister2"); String sister3 = rs.getString("sister3"); String sister4 = rs.getSt…
has comment: http://stackoverflow.com/comment/40689615
has comment: http://stackoverflow.com/comment/40689640
has comment: http://stackoverflow.com/comment/40689557
has answer: http://stackoverflow.com/a/25984289
has comment: http://stackoverflow.com/comment/40689395
possible better answer: http://stackoverflow.com/a/25984692
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40689639

http://stackoverflow.com/comment/40622919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25947680
has text: You've left out the `flip()`, but it seems pretty pointless. Throw it all away and use `DataOutputStream.writeInt()` and friends.
score: 0

http://stackoverflow.com/comment/40585910
type: AnswerComment
comment on: http://stackoverflow.com/a/25926029
type: Comment
has text: @KickButtowski Got a chat room?
score: 0

http://stackoverflow.com/comment/40684696
comment on: http://stackoverflow.com/q/25981717
score: 2
has text: Have you tried anything yet? It sounds like this is homework. You should attempt to solve the problem as efficiently as you can first. Then look at your solution and try to improve upon it. Once you have some code you can ask for more help on how to improve upon it.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25958044
has body: I serialized a file with multiple objects. So I wrote a code like below - FileOutputStream outputStream=new FileOutputStream(new File("Output.ser")); ObjectOutputStream objectOutputStream=new ObjectOutputStream(outputStream); objectOutputStream.writeObject(employee); objectOutputStream.writeObject(employee2); objectOutputStream.writeObject(employee3); objectOutputStream.writeObject(employee4); objectOutputStream.close(); Now I want to de-serialize it, so to do that I took the help of WHILE loop to loop through all the objects ! The Code looks like below - FileInputStream fileInputStream=new FileInputStream(new File(fileName)); ObjectInputStream stream=new ObjectInputStream(fileInputStream); Employee emp; while((emp=(Employee) stream.readObject())!=null) { String uName=emp.getUserId(); String uPass=emp.getPassword(); map.put(uName, uPass); } This code making an EOFException reaching the end of file. I guess readObject() should return a null when it reaches the end of the file but in this case it ended up throwing an exception! Please do suggest me way(s) by which I can successfully read my serialized file without getting any exception!
downvote count: 0
score: 1
tagged with: java
has title: Deserialization In Java
type: Question
has comment: http://stackoverflow.com/comment/40641126
has comment: http://stackoverflow.com/comment/40641028
has comment: http://stackoverflow.com/comment/40641099
has comment: http://stackoverflow.com/comment/40640985
answer count: 3
upvote count: 1
accepted answer: http://stackoverflow.com/a/25958191
has answer: http://stackoverflow.com/a/25958367
tagged with: deserialization
favorite count: 0
has answer: http://stackoverflow.com/a/25958382
tagged with: serialization
has comment: http://stackoverflow.com/comment/40640896
has comment: http://stackoverflow.com/comment/40641070
possible better answer: http://stackoverflow.com/a/25958367
has answer: http://stackoverflow.com/a/25958191
type: AnsweredQuestion

http://stackoverflow.com/comment/40647225
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25961157
score: 0
has text: Sorry, i removed that line for some reason when i copied the code to the question. Readded it. I also tried explicit bean naming, which didn't help.

glassfish
tags question: http://stackoverflow.com/q/25928969
tags question: http://stackoverflow.com/q/26004517
tags question: http://stackoverflow.com/q/25935866
tags question: http://stackoverflow.com/q/25974302
tags question: http://stackoverflow.com/q/26024290
tags question: http://stackoverflow.com/q/25950393
tags question: http://stackoverflow.com/q/25922809
tags question: http://stackoverflow.com/q/26011864
tags question: http://stackoverflow.com/q/26031832
tags question: http://stackoverflow.com/q/25879898
tags question: http://stackoverflow.com/q/25948702
tags question: http://stackoverflow.com/q/25940975
tags question: http://stackoverflow.com/q/25935889
tags question: http://stackoverflow.com/q/25939024
tags question: http://stackoverflow.com/q/26000671
tags question: http://stackoverflow.com/q/25894625
tags question: http://stackoverflow.com/q/25970170
tags question: http://stackoverflow.com/q/25994321
tags question: http://stackoverflow.com/q/25881023
tags question: http://stackoverflow.com/q/25927430
tags question: http://stackoverflow.com/q/25908124
tags question: http://stackoverflow.com/q/25986094
tags question: http://stackoverflow.com/q/25964497
tags question: http://stackoverflow.com/q/25895074
tags question: http://stackoverflow.com/q/25901379
tag name: glassfish
tags question: http://stackoverflow.com/q/25972994
tags question: http://stackoverflow.com/q/25957964
tags question: http://stackoverflow.com/q/25947403
tags question: http://stackoverflow.com/q/25980933
tags question: http://stackoverflow.com/q/25901430
tags question: http://stackoverflow.com/q/25966839
tags question: http://stackoverflow.com/q/26033360
tags question: http://stackoverflow.com/q/25999642
type: Tag

http://stackoverflow.com/comment/40553047
type: QuestionComment
comment on: http://stackoverflow.com/q/25906975
has text: Still outside ES, as an auxiliary step.
score: 0
type: Comment

http://stackoverflow.com/comment/40624130
score: 0
comment on: http://stackoverflow.com/q/25948365
type: QuestionComment
has text: ClassLoader actually doesn't use "previos" version of class, it uses first version of class, when it was loaded first time. If class was loaded it will not be replaced with new one. You have to do a little magic to load new version. And such questions were already asked, use search.
type: Comment

http://stackoverflow.com/a/26000730
answers question: http://stackoverflow.com/q/26000648
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26000648
has comment: http://stackoverflow.com/comment/40727576
has comment: http://stackoverflow.com/comment/40725814
type: Answer
has comment: http://stackoverflow.com/comment/40719995
has comment: http://stackoverflow.com/comment/40719439
downvote count: 0
has comment: http://stackoverflow.com/comment/40719948
score: 3
has body: If you want a variable which can just hold any reference value, that's easy to do: Object dogObj = new Dog(); However, if you then try to call: dogObj.bark(); ... you shouldn't be surprised that the compiler doesn't know what you're talking about. The compiler uses the declared type of the variable to know how it can be used... it's as simple as that.

http://stackoverflow.com/q/25922205
has answer: http://stackoverflow.com/a/25922296
type: UnansweredQuestion
type: Question
linked to: http://stackoverflow.com/q/761194
upvote count: 5
tagged with: java
answer count: 2
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/40579044
tagged with: inheritance
favorite count: 0
has comment: http://stackoverflow.com/comment/40578616
has body: I don't know how to describe my problem, so I will give you a quick explanation. I want to make a program where the user can choose a language and then the text afterwards is printed in that given language. Currently I am thinking of something like this: // Super | class Language; // Sub | --- class German; // Sub | --- class English; if(UserChoseEnglish()) language = new English(); else language = new German(); English and German have the same public static final fields, so that I am able to use language.anyMethod(); that is given by the user's choice. AFAIK you cannot override fields, so I was thinking about packing all fields in abstract methods (in the superclass) that only return the value and overriding those. public abstract class Language { public abstract String thanks(); } public class English extends Language { @Override public String thanks() { return "Thanks!"; } } public class German extends Language { @Override public String thanks() { return "Danke!"; } } Is this considered bad practice? Should I just override the getter-methods or did I just miss something I don't know about? Would be nice if you want to help out. (I am currently just playing around in Java and thought having a language selectable would be quite fun. If you have experiences to share (libraries, properties, ... ? ), feel free to do so) :)
has title: Use abstract methods instead of fields
has answer: http://stackoverflow.com/a/25922329

http://stackoverflow.com/q/25949393
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40625609
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25949564
has title: String as parameter in java
has answer: http://stackoverflow.com/a/25949455
has answer: http://stackoverflow.com/a/25949462
score: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/25949480
tagged with: string
accepted answer: http://stackoverflow.com/a/25949564
possible better answer: http://stackoverflow.com/a/25949529
answer count: 5
has answer: http://stackoverflow.com/a/25949529
tagged with: parameters
has body: first of all I'm a beginner in java language , i wanted to test myself in a problem which is to encrypt a message given by the user , the class was as shown , unfortunately when i tried to use the class in Main class it gave me an Exception "in thread "main" java.lang.NullPointerException", public class engToEnc { public String Message; public char []c = new char [Message.length()]; public String readMessage(String pMessage) { this.Message = pMessage; for(int i = 0 ; i &lt; Message.length() ; i++) { c[i] = Message.charAt(i); c[i] += (char)27; } Message = String.copyValueOf(c); return Message; } } i tried to simplify the function to see the reason for the exception like that public String readMessage(String pMessage) { this.Message = pMessage; return Message; } but it also gave me the same exception so i did know that i have an issue with passing the string parameter, please help !

http://stackoverflow.com/q/26009277
tagged with: java
has comment: http://stackoverflow.com/comment/40734614
tagged with: eclipse
answer count: 1
has answer: http://stackoverflow.com/a/26010479
has title: file read inside class of project A and calling this class in project B
tagged with: filepath
score: 0
type: UnansweredQuestion
tagged with: file
type: Question
has body: I have 2 projects. Project A and Project B. Inside Project A i have a class MyClass that has a method say: readMyFile() which reads a file from some xyz path. Now I am trying to call readMyFile() from a class in Project B. And I get the error stating the file being attempted to be read does not exist. How can I make sure that the file that is being read by readFile() in MyClass in Project A, is also visible in Project B ?
has comment: http://stackoverflow.com/comment/40735686

http://stackoverflow.com/q/25951404
tagged with: http://stackoverflow.com/tag/json
has body: I'm trying to display items from a database, that database is located on the internet. I'm getting the error Value null of type org.json.JSONObject$1 cannot be converted to JSONArray and I'm not entirely sure how to fix this. I've provided my LogCat information and the associated class. Any help would be greatly appreciated. APIConnector Class package com.example.mywebsite.com; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class APIConnector { public JSONArray GetAllCustomers(){ String url = "http://mywebsite.com/getState.php"; HttpEntity httpEntity = null; try{ DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); httpEntity = httpResponse.getEntity(); } catch(ClientProtocolException e){ e.printStackTrace(); } catch(IOException e){ e.printStackTrace(); } JSONArray jsonArray = null; if(httpEntity !=null){ try{ String entityResponse = EntityUtils.toString(httpEntity); Log.e("Entity Response : ", entityResponse); jsonArray = new JSONArray(entityResponse); } catch(JSONException e){ e.printStackTrace(); } catch(IOException e){ e.printStackTrace(); } } return jsonArray; } public JSONArray GetCityDetails(String StateID) { @SuppressWarnings("deprecation") String url = "http://mywebsite.com/getCity.php?StateID="+URLEncoder.encode(StateID); HttpEntity httpEntity = null; try{ DefaultHttpClient httpClient = new DefaultHttpClient(); …
answer count: 1
has comment: http://stackoverflow.com/comment/40628730
score: 0
has title: Data from Webservice Value null of type cannot be converted to JSONArray
tagged with: android
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/25951536
type: UnansweredQuestion
tagged with: multithreading
type: Question
tagged with: java

http://stackoverflow.com/q/26018704
tagged with: selenium
type: Question
has answer: http://stackoverflow.com/a/26019212
score: 0
answer count: 1
has title: Getting "Element is not currently visible and so may not be interacted with" error when trying to upload a file using a hidden input
type: UnansweredQuestion
has body: I have a problem trying to interact with a hidden file input. I get the exception "Element is not currently visible and so may not be interacted with". The code of the element I'm trying to access is the following: &lt;div style="display: block; position: absolute; overflow: hidden; margin: 0px; padding: 0px; opacity: 0; direction: ltr; z-index: 21474; left: 615px; top: 271px; width: 105px; height: 32px; visibility: hidden;"&gt; &lt;input style="position: absolute; right: 0px; margin: 0px; padding: 0px; font-size: 480px; font-family: sans-serif; cursor: pointer; z-index: 21480;" accept="image/*" multiple="" name="imgfile" type="file"&gt; &lt;/div&gt; I am able to find the element using the following: findElement(By.xpath("//*[@name='imgfile']")); but I run the following and still does not work: JavascriptExecutor jse = (JavascriptExecutor)driver; WebElement elem = driver.findElement(By.xpath("//*[@name='imgfile']")); String js = "arguments[0].style.visibility = 'visible';"; jse.executeScript(js, elem); elem.sendKeys("C:\\data.txt"); I have tried changing many style properties like display = 'block' for instance, but it does not make a difference. Any ideas? Thanks in advance for your help.
tagged with: java

http://stackoverflow.com/comment/40741818
comment on: http://stackoverflow.com/a/26013030
type: Comment
has text: I wouldn't like to affect the indication of dirty state, rather just to disable save button/action when `pageChangeEnabled` is set to `false`. I updated the question and added a possible solution.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40532881
type: Comment
type: QuestionComment
has text: Thanks ! We are also exploring org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender and there if we kill one of the many hosts and bring it back, things don't fail and reconnect in the application as desired.
score: 1
comment on: http://stackoverflow.com/q/25894180

http://stackoverflow.com/comment/40619090
comment on: http://stackoverflow.com/a/25939807
score: 0
type: AnswerComment
type: Comment
has text: i jsut edited my programme,and that i can do for make it run in eclipse and now you can copy past it to run programme,it should run now

http://stackoverflow.com/a/26020476
answers question: http://stackoverflow.com/q/26020345
score: 0
has body: it was not possible before servlet 3.0.Now web.xml is not required. But if you are using version before servlet 3.0 then its required. Then Web.xml was the deployment descriptor and it tells to the server about the servlets present. In short it was the heart of your web application.Without this your application cannot run.
type: Answer

http://stackoverflow.com/comment/40533425
type: Comment
has text: Thanks for sorting that out @Durandal! :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/25892425
score: 0

http://stackoverflow.com/q/25978032
possible better answer: http://stackoverflow.com/a/26017582
has title: Mixing java and scala in a single project - tests in scala, core in java
has answer: http://stackoverflow.com/a/26017582
tagged with: scala
has comment: http://stackoverflow.com/comment/40677600
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/25985543
accepted answer: http://stackoverflow.com/a/25985543
tagged with: unit-testing
tagged with: testing
tagged with: java
has answer: http://stackoverflow.com/a/25978442
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40677583
downvote count: 0
score: 1
favorite count: 0
has body: Suppose that one prefers the functional style testing framework (e.g. specs) and doesn't like the ones which are industry standard for Java (e.g. JUnit). Is it a good practice to have a Java project with the unit/integration tests written only in scala (and the rest of the projects written in java)? Are there any drawbacks of this approach?
type: Question

http://stackoverflow.com/a/25993249
answers question: http://stackoverflow.com/q/25993057
has body: You could just post the source of the page back to a server-side script. In jQuery you could have a function such as: function postGeneratedSource() { var data = $('body')[0].outerHTML; $.post('/path/to/script', data); } If you didn't want the JS then you could either change body for a relevant container or otherwise strip the script tags on the server side.
score: 0
type: Answer

http://stackoverflow.com/q/25984847
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40923245
tagged with: spring
tagged with: git
has body: I'm following this tutorial: http://spring.io/guides/tutorials/rest/ to get familiar with spring/REST. However, the git repo (git clone https://github.com/spring-guides/tut-rest.git) has many individual java projects each with their own gradle build. I'd like to edit the code in Eclipse, as that's the whole point, but this hasn't proved trivial. So far, I've created a general project for the git repo, and then separate java projects for each of the folders from the repo, linking the source in my java projects to the source/test folders in the repo. This has worked great except that I don't have the spring jars in my dependencies for the java projects, I get a ton of errors as well as lose the nice autocomplete of function names, etc. What is the correct way to fix this? It seems like there isn't a good way to install the jars for spring in each java project without using maven or some other build tool, which seems redundant and inefficient since I can build the source from the repo project. If this is the case, should I make a build for each separate project even though the idea for the tutorial is that they each come with gradle? Thanks for your help, and please excuse the slight open endedness of it--I'm not sure I'm on the right track.
score: 1
tagged with: java
tagged with: eclipse
type: Question
has title: How to configure git repo with multiple java projects in eclipse
upvote count: 1
has comment: http://stackoverflow.com/comment/40732181
favorite count: 0
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/40764194
comment on: http://stackoverflow.com/q/26025275
has text: I see nowhere where you set the size. Is there any concept of "reading off the end"?
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/40585204
has text: How would you extract a `double` from a `double[]`? Now, how would you extract a `double[]` from a `double[][]`?
comment on: http://stackoverflow.com/q/25926105
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/26012434
linked to: http://stackoverflow.com/q/473282
has title: Get Week Number of LocalDate (Java 8)
tagged with: week-number
answer count: 2
downvote count: 0
favorite count: 0
score: 51
upvote count: 51
possible better answer: http://stackoverflow.com/a/26014690
has answer: http://stackoverflow.com/a/26014690
has answer: http://stackoverflow.com/a/26013129
duplicate of: http://stackoverflow.com/q/25912455
type: AnsweredQuestion
has body: I'm trying to get the Week Number of a full LocalDate with the format: dd.MM.yyy I haven't found a function in the Java 8 Date API wich returns the Week Number and i have tried to create a algorithm, but it did'nt work.
accepted answer: http://stackoverflow.com/a/26013129
tagged with: java-8
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/25912455

http://stackoverflow.com/a/25909277
accepted answer of: http://stackoverflow.com/q/25908914
upvote count: 2
type: AcceptedAnswer
has body: With this setup, Mockito will create a plain Java object for PostWebService and in then wire all the other mocks into it. That means when(pws.insertPost(post, request)).thenReturn("true"); will actually try to execute insertPost() since pws itself isn't a mock. when() can only be used safely for fields annotated with @Mock. A good example is this line: User user = (User) request.getSession().getAttribute("user"); the test will fail here with an NPE since you request is a mock and you didn't tell Mockito what to return for getSession(). Use this setup code instead: when(request.getSession()).thenReturn(session); when(session.getAttribute("user")).thenReturn(user); assertEquals("true", pws.insertPost(post, request));
type: Answer
answers question: http://stackoverflow.com/q/25908914
score: 2
downvote count: 0

http://stackoverflow.com/q/26009136
has body: I am looking for Bubble Chart tutorials/example of JasperReports. I did get my expected resource yet, sample program and jrxml template. I already looking for online and Jasper Ultimate Guide. Why I ask this question is to keep the answer of this question here. Not other(eg: JavaFX Chart), I have to use JasperReports. Any body help me provide simple program as below data(not theme). Data Chart
has answer: http://stackoverflow.com/a/26052022
favorite count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/26052022
tagged with: jasper-reports
type: AnsweredQuestion
tagged with: charts
score: 1
tagged with: java
type: Question
has title: Is there any resource for Bubble Chart using JasperReports?
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26006543
has body: I'm making a program with Java that needs to involve some error checking. I can stop users from entering bad numerical inputs like this (assume the input scanner has already been created): while (n == 0){ System.out.println("Can't use 0 as a denominator! Please enter a real, nonzero number"); n = input.nextInt(); } But how do I stop users from entering an invalid string? I can't use !=, because strings can only be compared with the string.equals() method, right? So, is there a while not loop? ie: while !(string.equals("y") || string.equals("n")){ //here have code } Or something of that nature?
tagged with: loops
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/26006754
has answer: http://stackoverflow.com/a/26006560
type: AnsweredQuestion
score: 1
favorite count: 0
has title: While not (or equivalent) java
possible better answer: http://stackoverflow.com/a/26006564
tagged with: while-loop
type: Question
has answer: http://stackoverflow.com/a/26006564
accepted answer: http://stackoverflow.com/a/26006560
answer count: 4
upvote count: 2
has answer: http://stackoverflow.com/a/26006556

http://stackoverflow.com/comment/40709691
comment on: http://stackoverflow.com/a/25912449
type: AnswerComment
has text: @MrAssistance take a look at my answer there
score: 0
type: Comment

http://stackoverflow.com/q/25993837
has comment: http://stackoverflow.com/comment/40709309
tagged with: java
has title: KnockoutJS read viewmodel from local file?
tagged with: knockout.js
type: Question
has body: I'm writing a client-server framework in Java, and I want the server to display some metrics on a HTML page. To do this, I would love to be able to use KnockoutJS (very little experience) so that the server can update the metrics values and the HTML page can reflect the changes instantly and without needing to refresh the page. Is it possible to have a local viewmodel (that is updated by the Java program) read by Knockout? Or is there a better solution for the problem?
answer count: 1
tagged with: javascript
score: 0
has answer: http://stackoverflow.com/a/25994392
type: UnansweredQuestion

http://stackoverflow.com/q/25912396
has body: I've tried to create a new project on android and ran it without any problem in my emulator. I added the google-play-service library in my eclipse workbench and linked it to my project. Then I tried to run it again and my eclipse started loading... Then the progress bar stopped to move, then I saw eclipse took 80% of my CPU capacity! So I shut it down and tried again, same thing happened. For your info I imported the google-play-service library from sdk\extras\google\google_play_services\libproject\google-play-services_lib and I still have not touched the example code in the MainActivity.java
favorite count: 0
accepted answer: http://stackoverflow.com/a/25912633
has comment: http://stackoverflow.com/comment/40559665
tagged with: android
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/25912633
has title: Eclipse freezes on android project build
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40560097
linked to: http://stackoverflow.com/q/2610194
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26025303
accepted answer: http://stackoverflow.com/a/26025942
has body: In Java, I have the user select an image file. I then decode it, covert to PNG, and pass through to JNI. I suspect that I do not need to copy and allocate so much memory constantly. How can I pare this down? Is there a way I can detect if the image type is JPEG or PNG and not decode &amp; re-encode the bitmap and just pass the original JPEG/PNG data? Or do the conversion with fewer allocations? Right now it is eating up a LOT of memory. Java: Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); yourSelectedImage.compress(Bitmap.CompressFormat.PNG, 100, outStream); byte[] byteData = outStream.toByteArray(); JNILib.PickedImage(byteData); In C, I have the following code for PickedImage: jbyte *b = (jbyte*)env-&gt;GetByteArrayElements(data, NULL); jsize dataSize = env-&gt;GetArrayLength(data); byte* imageData = (byte*)malloc(dataSize); memcpy(imageData, b, dataSize); env-&gt;ReleaseByteArrayElements(data, b, 0); imageSelectCallback(imageData, dataSize);
score: 1
favorite count: 0
tagged with: c++
upvote count: 1
has comment: http://stackoverflow.com/comment/40764530
type: AnsweredQuestion
tagged with: java-native-interface
tagged with: java
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/9643228
has answer: http://stackoverflow.com/a/26025942
has title: Use less memory to pass Bitmap to JNI
tagged with: android
answer count: 1

http://stackoverflow.com/a/25905951
answers question: http://stackoverflow.com/q/25905901
has body: No you do not need to null or manually delete objects. The java garbage collector will do this for you for any objects that have no pointers referencing them (when an object goes out of scope for example).
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/25962804
tagged with: java.util.scanner
score: 1
tagged with: java
upvote count: 1
has title: Reading from a file using scanner? What is wrong with this code?
has answer: http://stackoverflow.com/a/25962842
accepted answer: http://stackoverflow.com/a/25962842
type: Question
has comment: http://stackoverflow.com/comment/40649943
has comment: http://stackoverflow.com/comment/40649897
has body: My code keeps giving me this error message when I try to run it. Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at readingFile.readFile(readingFile.java:18) at apples.main(apples.java:6) What do you think is the problem? I am watching buckys tutorials while doing this. It worked for him but not me. import java.io.*; import java.util.Scanner; public class readingFile { private Scanner x; public void openFile() { try { x = new Scanner(new File("C:\\Users\\Ike\\Desktop\\chinese.txt")); } catch(Exception e) { System.out.println("could not find file"); } } public void readFile() { while(x.hasNext()) { String a = x.next(); String b = x.next(); String c = x.next(); System.out.printf("%s %s %\n", a,b,c); } } public void closeFile() { x.close(); } }
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40649958
favorite count: 0
has comment: http://stackoverflow.com/comment/40649895
type: AnsweredQuestion

http://stackoverflow.com/a/25923118
answers question: http://stackoverflow.com/q/25923060
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25923060
has body: Consider setting the Action command key in the AbstractAction itself: class MyAction extends AbstractAction { public MyAction(String text) { super(text); putValue(ACTION_COMMAND_KEY, "one"), } //... for example: import java.awt.event.ActionEvent; import javax.swing.*; public class Foo2 extends JPanel { private static final String[] NUMBER_TEXTS = { "one", "two", "three", "four", "five" }; public Foo2() { for (int i = 0; i &lt; NUMBER_TEXTS.length; i++) { String numberString = String.valueOf(i + 1); Action numberBtnAction = new NumberBtnAction(numberString, NUMBER_TEXTS[i]); JButton btn = new JButton(numberBtnAction); InputMap inMap = btn.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = btn.getActionMap(); KeyStroke keyStroke = KeyStroke.getKeyStroke(numberString.charAt(0)); inMap.put(keyStroke, NUMBER_TEXTS[i]); actionMap.put(NUMBER_TEXTS[i], numberBtnAction); add(btn); } } private class NumberBtnAction extends AbstractAction { public NumberBtnAction(String numberString, String numberText) { super(numberString); putValue(ACTION_COMMAND_KEY, numberText); } @Override public void actionPerformed(ActionEvent e) { System.out.println(e.getActionCommand()); } } private static void createAndShowGui() { JFrame frame = new JFrame("Foo2"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new Foo2()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } } Edit Or alternatively, you could have a separate key binding action that simply presses the button: import java.awt.event.ActionEvent; import javax.swing.*; public class Foo2 extends JPanel { private static final String[] NUMBER_TEXTS = { "one", "two", "three", "four", "five" }; public Foo2() { for (int i = 0; i &lt; NUMBER_TEXTS.length; i++) { String numberString = String.valueOf(i + 1); Action numberBtnAction = new Numbe…
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40580568
has comment: http://stackoverflow.com/comment/40580538

http://stackoverflow.com/comment/40634861
score: 2
has text: @ParthaBenjapi - IMHO, you should avoid such questions. You will only learn a trick to format the output. If you want to learn recursion, then there are plenty of other problems for that. There are also many problem sites and simple coding challenges online. Use those for practice instead. Good luck.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25954584

http://stackoverflow.com/q/25990790
tagged with: android
has answer: http://stackoverflow.com/a/25995198
score: 0
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/25995198
tagged with: http
has title: How can i get data in Servlet, which is Sending from Android app?
has body: I am new in android, i have searched for solution, but i could not get the suitable one, that s why i am posting this Qn, I can't get any value in servlet,And no Errors in LogCat, Some Toast are in my code to check execution flow, The all Toast will work only in the first attempt, If i click my button second time, Only the first Toast will work, Please help me to find a solution, This is my android code public void onClick(View v) { final String u=txt_name.getText().toString(); final String p=txt_pswd.getText().toString(); Toast.makeText(getApplicationContext(), u+p,Toast.LENGTH_LONG).show(); new AsyncTask&lt;String , Void, Void&gt;() { @Override protected Void doInBackground(String... params) { try{ //Log.d("Asynctask", ""+params); //Looper.prepare(); URL url=new URL("http://10.0.2.2:8080/LoginExample/LoginServlet"); HttpURLConnection urlConnection=(HttpURLConnection)url.openConnection(); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); urlConnection.setRequestMethod("GET"); //Toast.makeText(getApplicationContext(), "connecting..",Toast.LENGTH_LONG).show(); urlConnection.connect(); //Toast.makeText(getApplicationContext(), "connected",Toast.LENGTH_LONG).show(); urlConnection.getOutputStream().write(("key1="+u+"&amp;key2="+p).getBytes()); //Toast.makeText(getApplicationContext(), "sending....",Toast.LENGTH_LONG).show(); }catch(Exception e) { System.out.println("ERROR IN URL CONNECTION---"+e); } //Looper.loop(); return null; } }.execute(); }); And this is my servlet, import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class LoginServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { try { System.out.println("-----servlet--------------"); // UserBean user = new UserBean(); String uname=request.…
has answer: http://stackoverflow.com/a/25991151
tagged with: servlets
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25991151
type: Question

http://stackoverflow.com/q/25918889
type: Question
has body: Got this sql (selection between ranks): //Variables come from outside or other classes etc... "SELECT * from users where dept_name= ? AND birth_date &gt;=? AND birth_date &lt;=? AND money &gt;=? AND money &lt;=?; //Long preparedStatement code... Using the next code to pass dept_name to the sql: System.out.println("Insert department name: "); Scanner alpha = new Scanner(System.in); String dept_name= alpha.nextLine(); What happens if I don't insert anything on the scanner and I simply press enter? Like if I want to skip the search by dept_name and I only want to search between birth_date and money ranks? How can I handle: pstmt.setString(1, users.getDeptname()); //prepared statement If it previously received a "enter" as character on the dept_id ? How can Oracle ignore dept_name =? if no valor is passed in the "?" with prepared statement and use the next fields in the SQL to continue the query?
answer count: 1
score: 0
tagged with: sql
accepted answer: http://stackoverflow.com/a/25919014
has title: Oracle SQL query without all parameters
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25919014

http://stackoverflow.com/a/26027381
type: Answer
upvote count: 1
score: 1
has body: The number of collisions is decisive for a slow down. Assume an array of some size, the hash code modulo the size then points to an index where the object is put. Two objects with the same index collide. Having a large capacity (array size) with respect to number of elements helps. With HashMap there are overloaded constructors with extra settings. public HashMap(int initialCapacity, float loadFactor) Constructs an empty HashMap with the specified initial capacity and load factor. You might experiment with that. For a specific key class used with a HashMap, having a good hashCode can help too. Hash codes are a separate mathematical field. Of course using less memory helps on the processor / physical memory level, but I doubt an influence in this case.
downvote count: 0
answers question: http://stackoverflow.com/q/26026424

jta
tags question: http://stackoverflow.com/q/25908983
tag name: jta
tags question: http://stackoverflow.com/q/25998284
tags question: http://stackoverflow.com/q/25912759
tags question: http://stackoverflow.com/q/25974191
tags question: http://stackoverflow.com/q/25932934
type: Tag

http://stackoverflow.com/comment/40665481
type: Comment
type: QuestionComment
has text: Same is my doubt ... That what is the use of having public method in private inner class and how to use it outside
comment on: http://stackoverflow.com/q/25971406
score: 0

http://stackoverflow.com/q/26017835
has body: I'm trying to make a soundboard program that loads a sound into a button, and then plays the sound when the button is pressed. This is what I have so far - package soundboard; import javax.swing.*; import java.io.*; import javax.sound.sampled.*; public class Soundboard { JButton loadButton; JFileChooser loadBox; JButton clearButton; JButton button1; JButton button2; JButton button3; JButton button4; JPanel mainsPanel; int load; Clip clip; File one; File two; File three; File four; public void windowCreate() { JFrame frame = new JFrame(); mainsPanel = new JPanel(); loadBox = new JFileChooser();//174 loadBox.setSize(500,500); loadBox.setLocation(174,4); loadButton = new JButton("Load..."); loadButton.setSize(80, 30); loadButton.setLocation(4, 4); loadButton.addActionListener(e -&gt; { load = 1; }); clearButton = new JButton("Clear"); clearButton.setSize(80, 30); clearButton.setLocation(92, 4); clearButton.addActionListener(e -&gt; { System.out.println("Cleared"); }); button1 = new JButton("1"); button1.setSize(80, 80); button1.setLocation(4, 45); button1.addActionListener(e -&gt; { if (load == 1){ one = loadBox.getSelectedFile(); load = 0; } else { System.out.println("Debugging; " + one); try { AudioInputStream audio = AudioSystem.getAudioInputStream(one); AudioFormat format = audio.getFormat(); DataLine.Info info = new DataLine.Info(Clip.class, format); clip = (Clip) AudioSystem.getLine(info); } catch (LineUnavailableException ex) { System.out.println("Err_Line"); } catch (IOException ex) { System.out.println("Err_IOException"); } catch (UnsupportedAudioFileException ex) { System.out.println("Err_FileNotSupported"); } clip.setFramePosition(0); clip.start(); } }); button2 = new JButton("2"); button2.setSize(80, 80); button2.setLocation(92, 45); button2.addActionListener(e -&gt; { if (load == 1){ two = loadBox.getSelectedFile(); load = 0; } else { System.out.println(two); } }); button3 = new JButton("3"); button3.setSize(80, 80); button3.setLocation(4, 133); button3.ad…
tagged with: javasound
tagged with: swing
answer count: 1
tagged with: audio
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40751150
has comment: http://stackoverflow.com/comment/40750121
has comment: http://stackoverflow.com/comment/40751357
has comment: http://stackoverflow.com/comment/40750838
has title: Playing audio in Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40750137
linked to: http://stackoverflow.com/q/4708254
type: Question
has answer: http://stackoverflow.com/a/26019593
has comment: http://stackoverflow.com/comment/40750443
tagged with: directory
duplicate of: http://stackoverflow.com/q/4708254
has comment: http://stackoverflow.com/comment/40750618
has comment: http://stackoverflow.com/comment/40752744
has comment: http://stackoverflow.com/comment/40750088

http://stackoverflow.com/a/25882523
has body: First, the constructor needs to create the array A. private int[] A; private int top = 0; // &lt;-- start at 0 public ArrayStack() { this(10); // &lt;-- delegate to the second constructor. // A = new int[10]; // &lt;-- OR } public ArrayStack(int maxsize) { A = new int[maxsize]; } Next, I'll show you how to do one of your other tests. Let's look at isFull(), we have top that starts at 0 and grows up (see push()) - we also have an array A. So, public boolean isFull() { return (top &gt;= A.length); }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25882191
score: 3
upvote count: 3

http://stackoverflow.com/a/25945058
type: Answer
score: 15
has body: You can register the JsonSerializer for the primitive type double. module.addSerializer(double.class, new DoubleSerializer());
upvote count: 15
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25945044
answers question: http://stackoverflow.com/q/25945044

http://stackoverflow.com/a/25932059
has body: You have a space at the start of your regex string, so it will only match if there's (at least) one space before the &lt;span... So instead of regex = ' &lt;span class="noWrap"&gt;(.+?)&lt;/span&gt;' try regex = '&lt;span class="noWrap"&gt;(.+?)&lt;/span&gt;' or even better regex = r'&lt;span class="noWrap"&gt;\s*(.+?)\s*&lt;/span&gt;' Raw strings like r'stuff' are preferred for regex use, so you don't have to escape too much stuff inside the regex string. The \s patterns will consume spaces so your won't need to use strip() on the data you capture with findall(). I should also mention that pattern.findall(text) is a bit nicer syntax than re.findall(pattern, text).
answers question: http://stackoverflow.com/q/25927804
score: 0
type: Answer

http://stackoverflow.com/q/26011549
tagged with: playframework-2.0
has answer: http://stackoverflow.com/a/26023459
tagged with: java
type: Question
tagged with: mongodb
answer count: 2
has body: I have play framework application v2.2 that use Mongo Database (using play-jongo). I have some testing unit class in /test folder. However if I run the unit class using test command or run directly from eclipse, there is no data found at all from Mongo DB, but if I run the application normally, I can see the data. I have used Helpers.faceApplication() method but still no data at all. Here is the unit test code: @Test public void test1() { Helpers.running(Helpers.fakeApplication(), new Runnable() { @Override public void run() { //MyUser is the mongo entity MyUser myUser = MyUser.findById("123"); if (myUser != null) { Logger.info("User ID: " + myUser.id); } else { Logger.info("User is NULL"); //it always get here } } }); } The myUser is always returned null if I run the test unit. I have feeling that the Helpers.fakeApplication doesn't read the /conf/applicaton.conf so it doesn't connect to mongo db. Anyone know how to connect the play to mongo db when running in test unit?
has answer: http://stackoverflow.com/a/26017208
downvote count: 0
accepted answer: http://stackoverflow.com/a/26023459
possible better answer: http://stackoverflow.com/a/26017208
score: 1
favorite count: 0
has title: No data in Mongo DB in Play framework when running in Test mode
tagged with: jongo
upvote count: 1
tagged with: unit-testing
type: AnsweredQuestion

http://stackoverflow.com/q/25957943
tagged with: java
has comment: http://stackoverflow.com/comment/40662419
type: Question
has comment: http://stackoverflow.com/comment/40649666
has comment: http://stackoverflow.com/comment/40662168
has title: Dictionary example for uimaFIT code based
score: 0
has comment: http://stackoverflow.com/comment/40644072
has body: I'm having a look at uimaFIT and I just had quite some difficulties to add a Dictionary Annotator to a analyse engine. This is my best shut so far: public class LocationAnnotator extends JCasAnnotator_ImplBase { public static final String RES_DICTIONARY = "dictionary"; @ExternalResource(key = RES_DICTIONARY) private DataResource resource; private Dictionary dictionary; @Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); try { DictionaryBuilder dictBuilder = new HashMapDictionaryBuilder(); // create dictionary file parser DictionaryFileParserImpl fileParser = new DictionaryFileParserImpl(); fileParser.parseDictionaryFile(resource.getUri().getPath(), resource.getInputStream(), dictBuilder); dictionary = dictBuilder.getDictionary(); } catch (IOException e) { throw new ResourceInitializationException(); } } @Override public void process(JCas cas) throws AnalysisEngineProcessException { String docText = cas.getDocumentText(); for (String line : docText.split("\n")) { for (String word : line.split(" ")) { if (dictionary.contains(word)) { int pos = docText.indexOf(word); Location annotation = new Location(cas, pos, pos + word.length()); annotation.addToIndexes(); } } } } } I'm executing the engine like this: CollectionReaderDescription reader = CollectionReaderFactory.createReaderDescription(CvReader.class, CvReader.PARAM_INPUT_FILE, "docs/simple-doc.txt"); AnalysisEngineDescription tokenizer = AnalysisEngineFactory.createEngineDescription(LocationAnnotator.class); ExternalResourceFactory.bindResource(tokenizer, LocationAnnotator.RES_DICTIONARY, "META-INF/dictionaries/location.dict.xml"); for (JCas cas : SimplePipeline.iteratePipeline(reader, tokenizer)) { for (Location location : JCasUtil.select(cas, Location.class)) { System.out.println("Found location: " + location.getCoveredText()); } } Is there no more elegant way? Don't like the initialization. Would expect to init the dictionary with an annotation…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40658411
tagged with: uima
answer count: 0

http://stackoverflow.com/q/25910472
tagged with: deserialization
has answer: http://stackoverflow.com/a/25944577
favorite count: 0
tagged with: serialization
type: Question
has body: { "type": "object", "properties": { "name": { "type": "string" }, "id": { "type": "string" }, "i": { "type": "integer" }, "p": { "type": "object", "properties": { "name": { "type": "string" }, "id": { "type": "string" }, "i": { "type": "integer" }, "p1": { "type": "object", "properties": { "name": { "type": "string" }, "id": { "type": "string" }, "i": { "type": "integer" } } } } } }, "classname": "com.tibco.tea.agent.Person" } I've the above generated schema, to which I want to do some modification. As you can see, I've nested Object's in this schema. I want to insert a "classname" attribute for each object. Can anybody suggest me how can I use jackson 2.3.0 to traverse through this schema and manipulate it as mentioned above.
upvote count: 3
accepted answer: http://stackoverflow.com/a/25944577
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40591826
has answer: http://stackoverflow.com/a/26020923
answer count: 2
has title: How to traverse generated json schema using jackson and put custom attribute in json schema
possible better answer: http://stackoverflow.com/a/26020923
downvote count: 0
tagged with: jackson
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/40772271
type: Comment
has text: Mind reading is impossible. Question answered in 6 minutes, not enough time to copy and paste project. If you could not solve the problem with the information provided, fine don't answer. eightx2 was able to.
type: QuestionComment
comment on: http://stackoverflow.com/q/25942363
score: 0

http://stackoverflow.com/comment/40507531
type: Comment
has text: **contains only two digit numbers** - I think thats what the OP wants.
comment on: http://stackoverflow.com/a/25883361
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40538119
score: 0
type: Comment
type: QuestionComment
has text: I edited the original post to show the single cut-down java class that demonstrates the problem.
comment on: http://stackoverflow.com/q/25894957

http://stackoverflow.com/q/25946044
has body: I'm new at spring security. I want to have two different login forms for two different type of users. I have a package called /admin which is contained my main project for system users and /portal for other users./portal users will work on their tenant and won't know anything about /admin and vice versa.Each user group has its own database too. In spring-security.xml I defined two authentication managers,but when I login from both login forms it goes to 'AuthenticatingManager' but as I mentioned in xml file, for /portal users it should goes to PortalAuthenticatingManager. what shall I do? or what did I miss? &lt;security:http use-expressions="true" pattern="/portal/**" authentication-manager-ref="portalAuthMgr" access-denied-page="/unauthorized.jsp"&gt; &lt;form-login login-page="/plLogin.jsp" default-target-url="/portal/portal" /&gt; &lt;security:intercept-url pattern="/plLogin.jsp" access="permitAll"/&gt; &lt;security:intercept-url pattern="/portal/**" access="hasRole('ROLE_PORTAL')" /&gt; &lt;/security:http&gt; &lt;security:http authentication-manager-ref="adminAuthMgr" access-denied-page="/unauthorized.jsp"&gt; &lt;intercept-url pattern="/admin/**" access="ROLE_ADMIN" /&gt; &lt;security:form-login login-page="/login.jsp" authentication-failure-handler-ref="authenticationFailureHandler"/&gt; &lt;/security:http&gt; &lt;security:authentication-manager id="adminAuthMgr"&gt; &lt;security:authentication-provider ref="produxAuthenticationProvider"/&gt; &lt;/security:authentication-manager&gt; &lt;security:authentication-manager alias="portalAuthMgr"&gt; &lt;security:authentication-provider ref="portalAuthenticationProvider"/&gt; &lt;/security:authentication-manager&gt; &lt;beans:bean id="produxAuthenticationProvider" class="com.spring.AuthenticatingManager"&gt; &lt;/beans:bean&gt; &lt;beans:bean id="portalAuthenticationProvider" class="com.spring.PortalAuthenticatingManager"&gt; &lt;/beans:bean&gt;
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/51329645
score: 1
tagged with: java
has title: multiple authentication manager in spring security
tagged with: authentication
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25950062
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0

http://stackoverflow.com/comment/40633723
has text: thank you. I think the transfer method is too complicated to begin with. Can you show me a simplier method, like deposit or withdraw? I don't understand your explanation above, what do you mean by "those accounts get added to a customer"?.
type: Comment
comment on: http://stackoverflow.com/a/25954044
score: 0
type: AnswerComment

http://stackoverflow.com/q/26031429
has comment: http://stackoverflow.com/comment/40775856
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26031606
has answer: http://stackoverflow.com/a/26032504
tagged with: java
has answer: http://stackoverflow.com/a/26031586
type: Question
tagged with: dependency-injection
tagged with: jsp
score: 0
has body: I am new to Spring and currently reading Spring concept - Dependency Injection. It injects one object in another object by different methods. My question is - Can &lt;jsp:include&gt; tag ( for ex. &lt;jsp:include page="data.jsp" /&gt; ) be an example of Dependency Injection ? As it also includes one JSP contents in other. Please help me to confirm.
answer count: 3
has title: Dependency Injection - using <jsp:include>

http://stackoverflow.com/a/26877756
type: Answer
has body: "Could Not Find Com Port" is the default error for when your Arduino can't interface with Arduino IDE. In this case though, the error isn't saying that the Arduino IDE can't see your Arduino - its saying that the RXTX library can't see the Arduino. Your PC's driver may be an older version, and not yet support the com required by RXTX... Here's my advice: Plugin your Arduino Board Go to Control Panel ---> System and Security ---> System ---> On the left pane Device Manger Expand Other Devices. Under Other Devices you will notice a icon with a small yellow error graphic. (Unplug all your other devices attached to any Serial Port) Right Click on that device ---> Update Driver Software Select Browse my computer for Driver Software Click on Browse ---> Browse for the folder of Arduino Environment which you have downloaded from Arduino website. If not downloaded then http://arduino.cc/en/Main/Software After Browsing mark include subfolder. Click next ---> Your driver will be installed. Collapse Other Devices ---> Expand Port ( its in device manager only under other devices ) You will see Arduino Written ---> Look for its COM PORT (close device manager) Go to Arduino Environment ---> Tools ---> Serial Port ---> Select the COM PORT as mentioned in PORT in device manager. (If you are using any other Arduino Board instead of UNO then select the same in boards ) Some Reference Material: http://www.devfactor.net/2014/10/26/arduino-basics-serial-communication/
answers question: http://stackoverflow.com/q/25932964
has comment: http://stackoverflow.com/comment/42313264
score: 0

http://stackoverflow.com/comment/40520693
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25890477
has text: See http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it
type: Comment

http://stackoverflow.com/a/25894849
answers question: http://stackoverflow.com/q/25892318
has body: The limit for write-requests is 30 per minute, see: https://developers.google.com/fusiontables/docs/v1/using#quota When you request more quota via the console (and get it) this will affect the number of API requests per day, but not the number of allowed write-requests per minute(I can't tell you if it's possible increase this limit)
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25892318
score: 1

http://stackoverflow.com/comment/40550610
score: 0
comment on: http://stackoverflow.com/q/25907249
type: Comment
has text: Try adding the Gmail content provider.apk as a sub project.
type: QuestionComment

http://stackoverflow.com/comment/40641610
has text: Sorry , your answer doesn't help me
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25953206

http://stackoverflow.com/q/26032461
tagged with: while-loop
has comment: http://stackoverflow.com/comment/40779169
answer count: 4
has body: The input file that I am trying to read contains the amount of lines for a block of entries on the first line, and records on the subsequent lines. The file may contains many blocks like this. For example: 3 a b c a b a c b //Three in the first line tells that there are 3 subsequent lines. 2 a b a b c 0 //the input ends here I am trying to use a while loop to read one block at a time, process it, and then read in another block. However the code works only when there is one block. When there are multiple blocks, it freezes.. Can someone help to figure out what is wrong? Thank you! public static void main(String[] args) { Scanner s = new Scanner (System.in); while (s.hasNextLine()){ String number = s.nextLine(); if (line.equals("0")){ break; }else { int n = Integer.parseInt(number); for (int i=0; i&lt;n; i++){ String letters= s.nextLine(); ... //do something to store the lines of letters } } } }
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40776919
has answer: http://stackoverflow.com/a/26032720
has comment: http://stackoverflow.com/comment/40776860
has answer: http://stackoverflow.com/a/26032664
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/40776857
tagged with: exit
has answer: http://stackoverflow.com/a/26032569
has title: java while loop
score: 0
has comment: http://stackoverflow.com/comment/40777003
has comment: http://stackoverflow.com/comment/40777697
has answer: http://stackoverflow.com/a/26032567

http://stackoverflow.com/a/25937762
has body: return reverse[N]; is the problem. It should be return reverse[N-1]; If you want to return the whole reversed array, you should use return reesrve;
score: 0
has comment: http://stackoverflow.com/comment/40606018
type: Answer
answers question: http://stackoverflow.com/q/25937705

http://stackoverflow.com/comment/40628611
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25951327
has text: abstract methods can only be defined in abstract classes.

http://stackoverflow.com/comment/40622799
comment on: http://stackoverflow.com/a/25947577
has text: @nmore That's also true, but perhaps there's additional code that requires the array later.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40767158
type: QuestionComment
has text: @Tim, yes. I really mean that.
comment on: http://stackoverflow.com/q/26025286
score: 0
type: Comment

http://stackoverflow.com/q/26008735
tagged with: java
has comment: http://stackoverflow.com/comment/40733774
answer count: 1
has comment: http://stackoverflow.com/comment/40783155
favorite count: 0
has body: package enum_movies; public enum Show_Day { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY; }
downvote count: 3
has title: In Enum, why I have to declare enum constants at first place, why not any method or variables?
linked to: http://stackoverflow.com/q/18392885
upvote count: 0
has comment: http://stackoverflow.com/comment/41329943
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/40733978
type: Question
has answer: http://stackoverflow.com/a/26008795
tagged with: enums

http://stackoverflow.com/comment/40586404
type: Comment
has text: if your number is 123456789.. Imaging number of increments inside for loop
type: AnswerComment
comment on: http://stackoverflow.com/a/25926675
score: 0

http://stackoverflow.com/q/25930152
accepted answer: http://stackoverflow.com/a/25930223
tagged with: checkstyle
has body: I wrote the following class. package com.stackoverflow.examples; import java.util.ArrayList; /** RandomX. */ public final class Names { /** List of names. */ private ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;(); /** Constructor. */ public Names() { this.names.add("Test"); } } In the line with the declaration of names Checkstyle gives the warning: Declaring variables, return values or parameters of type 'ArrayList' is not allowed. How can I solve the problem, and what is the rationale behind this warning?
has answer: http://stackoverflow.com/a/25930468
has title: What does the checkstyle warning "Declaring variables, return values or parameters of type 'ArrayList' is not allowed." mean?
upvote count: 2
has answer: http://stackoverflow.com/a/25930481
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: warnings
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/25930468
downvote count: 0
has answer: http://stackoverflow.com/a/25930178
favorite count: 0
tagged with: arraylist
answer count: 4
has answer: http://stackoverflow.com/a/25930223

http://stackoverflow.com/comment/40505383
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25882136
score: 0
has text: possible duplicate of [Convert a number to 2 decimal places in Java](http://stackoverflow.com/questions/8779659/convert-a-number-to-2-decimal-places-in-java)

http://stackoverflow.com/q/25938594
tagged with: postgresql
has title: Passing Integer parameter to Jasper Report query gives SQL error operator does not exit : integer = boolean
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26026519
score: 1
tagged with: java
type: Question
tagged with: jasper-reports
has body: I.m creationg a Jasper report using netbeans IDE, i'm not really good in Jasper reports can some one please help me with this matter. also I'm using PostgreSQL I have an interger parameter named hotelid my report query is select email as hotelEmail from hotel where id=$P{hotelid} i get SQL error as operator does not exist: integer =boolean i don't understand why is this, please some one help..
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/25923781
accepted answer of: http://stackoverflow.com/q/25923700
answers question: http://stackoverflow.com/q/25923700
has comment: http://stackoverflow.com/comment/40581723
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40581173
type: Answer
has body: When dealing with multi-threading, you should use a thread pool to avoid this kind of problem. Check out ThreadPoolExecutor.execute(Runnable). It will allow you to better handle your multi-threading.
score: 1
upvote count: 1

http://stackoverflow.com/a/25922951
has comment: http://stackoverflow.com/comment/40899798
type: Answer
accepted answer of: http://stackoverflow.com/q/25905435
has body: libSVM format specifies that attributes must be listed in ascending order. I guess it fails to compute the kernel because the input data is not formatted correctly.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40588117
has comment: http://stackoverflow.com/comment/40973701
has comment: http://stackoverflow.com/comment/40629769
has comment: http://stackoverflow.com/comment/40896358
has comment: http://stackoverflow.com/comment/41004027
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25905435

http://stackoverflow.com/comment/40754058
score: 0
comment on: http://stackoverflow.com/a/26003961
type: Comment
has text: Thanks, Windows 7 vs. 2008r2 shouldn't affect the checksum. How are you overriding datatypes? Just allowing liquibase to convert them as it normally does, or using changelog parameters?
type: AnswerComment

http://stackoverflow.com/q/25968660
has comment: http://stackoverflow.com/comment/40661405
tagged with: java
tagged with: hibernate
tagged with: orm
has comment: http://stackoverflow.com/comment/40700902
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/26004532
answer count: 1
downvote count: 0
has body: I have a one-to-many relationship between two classes like this: class Parent { List&lt;Child&gt; children; } class Child { String name; } I'm using an .hbm.xml file to define my mapping from Java classes to tables. Something like this: &lt;class name="Parent" table="parent"&gt; &lt;list name="children"&gt; &lt;key column="parent_id" /&gt; &lt;list-index column="idx" /&gt; &lt;one-to-many class="Child" /&gt; &lt;/list&gt; &lt;/class&gt; &lt;class name="Child" table="child"&gt; &lt;property name="name" type="string" /&gt; &lt;/class&gt; That works fine. Now I want to create a column index (not a list index) on the Child.parent_id column. It seems that the &lt;one-to-many&gt; tag doesn't allow any nested &lt;column&gt; tags, so I tried adding a bidirectional association to the Child mapping like this: &lt;many-to-one name="parent" insert="false" update="false"&gt; &lt;column name="parent_id" index="true"&gt; &lt;/many-to-one&gt; But I get an exception: org.hibernate.PropertyNotFoundException: Could not find a getter for parent in class Child So, how can I create an index on the Child.parent_id column without adding a parent field to the Child class? I'm using Hibernate 3.5.6 and PostgreSQL 9.3.
favorite count: 0
tagged with: postgresql
has answer: http://stackoverflow.com/a/26004532
type: AnsweredQuestion
has title: Create index on column in one-to-many relationship
upvote count: 3

http://stackoverflow.com/comment/40595952
has text: @BackSlash: Thanks its much helpful and solved my problem :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25931927

http://stackoverflow.com/comment/40623439
type: AnswerComment
has text: i have edited my ans. is it fine now? please point out if i am doind something wrong
comment on: http://stackoverflow.com/a/25947906
type: Comment
score: 0

http://stackoverflow.com/q/26000242
has answer: http://stackoverflow.com/a/26022421
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40719381
has answer: http://stackoverflow.com/a/26006778
score: 2
has comment: http://stackoverflow.com/comment/40739428
favorite count: 0
has comment: http://stackoverflow.com/comment/40720794
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40718666
answer count: 2
tagged with: java-8
has title: java.lang.ClassCastException when using java 8 but things are fine with java 7
has comment: http://stackoverflow.com/comment/40719175
tagged with: seaglass
has comment: http://stackoverflow.com/comment/40734238
has comment: http://stackoverflow.com/comment/40721448
has comment: http://stackoverflow.com/comment/40730395
tagged with: java
tagged with: look-and-feel
tagged with: swing
has body: I've been developing a java desktop application for a while now, using Swing. The application is pretty big which makes isolating the issue difficult. I've tried to make my application run with Java 8 but I am having the following error: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JProgressBar cannot be cast to javax.swing.JMenuItem at javax.swing.plaf.synth.SynthGraphicsUtils.paint(SynthGraphicsUtils.java:490) at javax.swing.plaf.synth.SynthMenuUI.paint(SynthMenuUI.java:280) at javax.swing.plaf.synth.SynthMenuUI.update(SynthMenuUI.java:245) at javax.swing.JComponent.paintComponent(JComponent.java:777) at javax.swing.JComponent.paint(JComponent.java:1053) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paint(JComponent.java:1062) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paint(JComponent.java:1062) at javax.swing.JLayeredPane.paint(JLayeredPane.java:586) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paintToOffscreen(JComponent.java:5230) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1572) at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1495) at javax.swing.RepaintManager.paint(RepaintManager.java:1265) at javax.swing.JComponent.paint(JComponent.java:1039) at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39) at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:79) at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:116) at java.awt.Container.paint(Container.java:1973) at java.awt.Window.paint(Window.java:3901) at javax.swing.RepaintManager$4.run(RepaintManager.java:835) at javax.swing.RepaintManager$4.run(RepaintManager.java:807) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at javax.swing.Repai…
has comment: http://stackoverflow.com/comment/40721474
has comment: http://stackoverflow.com/comment/40718835
has comment: http://stackoverflow.com/comment/40718438

http://stackoverflow.com/q/26010778
has answer: http://stackoverflow.com/a/26010819
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/26010981
favorite count: 0
answer count: 3
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26011136
has title: Variables jsp and java in same program
has body: I'm programming with jsp and java. I need to pass a value between jsp and a method java but in the same program. I read documentation about this but I don't find a solution.Could I do this?. My code is: if (form1.txtFamiliasSel.value=="&lt;%=literales.getObject(TiposLiterales.TODOS)%&gt;") { if (marca == "0") { marca = "0"; } if (marca == "1") { marca = "D"; } if (marca == "2") { marca = "C"; } &lt;%Familias lFamiliasSQL = new Familias(conn); int lCodFilial = 0; if (request.getParameter("cmbFilial") != null) lCodFilial = Integer.parseInt(request.getParameter("cmbFilial")); ResultSet datosFam = lFamiliasSQL.doSelectLiteralesFamiliasFilial (lCodFilial,marca);%&gt; }

http://stackoverflow.com/comment/93528395
has text: Is there a thing along those lines that would allow passing initial arguments for the bean?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/35501476
type: Comment

http://stackoverflow.com/comment/40611980
type: Comment
score: 0
has text: Unless decorating the call is the responsibility of the parent and child Classes, this breaks the SRP... In other words it works but I would not recommend it.
type: AnswerComment
comment on: http://stackoverflow.com/a/25939982

http://stackoverflow.com/comment/40561442
type: Comment
type: QuestionComment
has text: Do you really need to read all of the records into memory? Can you use a database of some kind instead?
comment on: http://stackoverflow.com/q/25913327
score: 0

http://stackoverflow.com/comment/40498571
type: Comment
score: 0
type: AnswerComment
has text: The code in the question doesn't contain any abstract methods.
comment on: http://stackoverflow.com/a/25878002

http://stackoverflow.com/a/25913632
type: Answer
has body: It's not possible for generic interface to have different methods depending on passed to it class in Java. This means that Builder interface can have either: withName and withAge methods withCountry, withNumber and withCode methods all of them There is no design pattern that can overcome Java language limitations. What I would advise is to have generic builder interface like: public interface Builder&lt;T&gt; { T build(); } and then create separate subclasses for each entity type: public class UserBuilder implements Builder&lt;User&gt; { public void withName(String name) { // ... } public void withAge(int age) { // ... } public User build() { User user = new User(); user.setName(...); user.setAge(...); return user; } } public class AccountBuilder implements Builder&lt;Account&gt; { public void setCountry(String country) { // ... } public void setNumber(String number) { // ... } public void setCode(String code) { // ... } public Account build() { Account account = new Account(); account.setCountry(...); account.setNumber(...); account.setCode(...); return account; } } and then use it like UserBuilder userBuilder = new UserBuilder(); userBuilder.setName("John"); userBuilder.setAge(20); User user = userBuilder.build(); AccountBuilder accountBuilder = new AccountBuilder(); accountBuilder.setCountry("UA"); accountBuilder.setNumber("333-22-1"); accountBuilder.setCode("123"); And that's it. This can be slightly improved by using Fluent Interface pattern but anyway in Java it's impossible to implement it to work exactly like in your question. Hope this helps...
upvote count: 3
has comment: http://stackoverflow.com/comment/40566128
score: 3
has comment: http://stackoverflow.com/comment/40574269
accepted answer of: http://stackoverflow.com/q/25912679
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25912679

http://stackoverflow.com/comment/86517824
has text: So you just changed https to http?
type: Comment
comment on: http://stackoverflow.com/a/25912472
score: 0
type: AnswerComment

http://stackoverflow.com/a/25875542
has comment: http://stackoverflow.com/comment/40493499
type: Answer
has comment: http://stackoverflow.com/comment/40493294
has comment: http://stackoverflow.com/comment/40630657
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25875359
has body: I think these two should do it for you: Bold: (^|\s)\*{2}([\w\d ]+)\*{2}($|\s) Blue: (^|\s)\*b([\w\d ]+)\*{2}($|\s) And I finally decided that the easiest thing to do for testing the combos of blue and bold was to add a new regexp: Blue &amp; Bold: (^|\s)(\*{3}b|\*b\*{2})([\w\d ]+)\*{4}($|\s) This won't be very scalable if you are going to add italic and underline and more colours but I think it will work the best if these two are your only options. Let me know if there is a case where these doesn't match or if they match when they're not supposed to.
upvote count: 1
has comment: http://stackoverflow.com/comment/40502892

http://stackoverflow.com/q/25938605
has answer: http://stackoverflow.com/a/25938630
accepted answer: http://stackoverflow.com/a/25938630
has comment: http://stackoverflow.com/comment/40607722
has comment: http://stackoverflow.com/comment/40607673
type: Question
downvote count: 6
has comment: http://stackoverflow.com/comment/40607693
type: AnsweredQuestion
has body: I cant run my Class project. And I have no cure for this, can someone please help? https://i.sstatic.net/0yr8J.png import java.util.Random; public class HelloWorld { public static String[] intensities = { "00", "33", "66", "99", "CC", "FF" }; public static String randomColor() { Random a = new Random(); return "#" + intensities[a.nextInt(6)] + intensities[a.nextInt(6)] + intensities[a.nextInt(6)]; } public static void main(String[] args) { int nRows = Integer.parseInt(args[0]); int nCols = Integer.parseInt(args[1]); String[] colArray = new String[10]; for (int c = 0; c &lt; 10; c++) { colArray[c] = randomColor(); } System.out.println("&lt;table border='1'&gt;\n"); for (int i = 1; i &lt;= nRows; i++) { System.out.println("&lt;tr&gt;"); for (int j = 1; j &lt;= nCols; j++) { int result = i * j; int colorNum = result * 10 / (nRows * nCols +1); System.out.println("&lt;td bgcolor='" + colArray[colorNum] + "'&gt;" + result + "&lt;/td&gt;"); } System.out.println("&lt;/tr&gt;\n"); } System.out.println("&lt;/table&gt;"); } } I cant run my Class project. And I have no cure for this, can someone please help? https://i.sstatic.net/0yr8J.png
tagged with: java
tagged with: eclipse
has title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at HelloWorld.main(HelloWorld.java:15)
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40607696
score: -6

http://stackoverflow.com/q/25875689
has title: Writing to a text file at a specific position Java
tagged with: java
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/25876105
tagged with: io
has body: Suppose I have a file called "Bill.txt". The format: ItemType ItemName Price Now I want to add a new Description field. This description must be written next to the price. The problem is, how to determine the position where to write it.
has comment: http://stackoverflow.com/comment/40493256
has comment: http://stackoverflow.com/comment/40493490
accepted answer: http://stackoverflow.com/a/25876105
tagged with: file
has comment: http://stackoverflow.com/comment/40493296
type: AnsweredQuestion

http://stackoverflow.com/a/25965822
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40657010
has comment: http://stackoverflow.com/comment/40656942
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40656394
accepted answer of: http://stackoverflow.com/q/25964019
has comment: http://stackoverflow.com/comment/40656031
answers question: http://stackoverflow.com/q/25964019
type: AcceptedAnswer
has body: Parse makes this very easy. They have built in function called: withinKilometers:, withinMiles:, and withinRadians:. The following query parameter will return all the rows where "location" is within 100 kilometers of the user's current location. Since you've already calculated the user's latitude and longitude, you can create a PFGeoPoint using those values. Swift Syntax let userLocation = PFGeoPoint(latitude: userLatitude, longitude: userLongitude) query.whereKey("location", nearGeoPoint:userLocation, withinKilometers: 100)

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

http://stackoverflow.com/comment/40720374
has text: I will give a shot for json and will be back here for any problem or question. thanks though.
type: Comment
comment on: http://stackoverflow.com/a/26001211
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40778399
has text: @talex From the error message: "*`... in the type JdbcTemplate`*".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26020607
score: 0

http://stackoverflow.com/comment/40785952
type: QuestionComment
type: Comment
has text: And in these hours you didn't manage to write a single line of the toStringRec method? Do you know what recursive means?
score: 0
comment on: http://stackoverflow.com/q/26026446

http://stackoverflow.com/comment/40569118
type: AnswerComment
comment on: http://stackoverflow.com/a/25881360
type: Comment
score: 1
has text: sorry. when i came back to this thread that answer wasn't there. i left my answer for posterity, not to accept my own answer necessarily. i'm not THAT big of a megalomaniac! thanks for the feedback.

http://stackoverflow.com/q/25970420
tagged with: android
accepted answer: http://stackoverflow.com/a/25970755
upvote count: 1
type: AnsweredQuestion
tagged with: serversocket
score: 1
tagged with: tcp
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/10014515
linked to: http://stackoverflow.com/q/10367727
has answer: http://stackoverflow.com/a/25970755
downvote count: 0
answer count: 1
favorite count: 0
has title: Android TCP Listener is not working on 3G/4G?
tagged with: sockets
has body: I am working on an app,I have made a TCP Listner which is working fine on wifi network but when i am connected to 3G/4G or mobile network it does not work.Can some body help me here? my code is here public class ListenerService extends Service { Socket socket; private ServerSocket serverSocket; BufferedReader in = null; static String message=null; int portNo=1619; boolean flag=true; final static String MY_ACTION = "MY_ACTION"; @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); new Task().execute(); } private class Task extends AsyncTask &lt;Void, String, String&gt; { @Override protected String doInBackground(Void... params) { try { serverSocket = new ServerSocket(portNo); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } while (flag) { try { socket = serverSocket.accept(); in = new BufferedReader(new InputStreamReader( socket.getInputStream())); //try { StringBuilder total = new StringBuilder(); String line; while ((line = in.readLine()) != null) { total.append(line); } message = total.toString(); Log.d("NETWORK-RECEIVE", "Message!:" + message); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { serverSocket.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return message; } } @Override public int onStartCommand(Intent intent, int flags, int startId) { // TODO Auto-generated method stub Log.d("Server Startd","Listener Serverice is running"); //Toast.makeText(getApplicationContext(),"Service Started", Toast.LENGTH_LONG).show(); return super.onStartCommand(intent, flags, startId); } @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } } can some tell me what m i missing here?

http://stackoverflow.com/comment/40692413
has text: @Kerppag that will not work. array.length gives the length of the allocated space, not the number of items actually present
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25985791

http://stackoverflow.com/q/25931229
tagged with: java
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/25931296
has comment: http://stackoverflow.com/comment/40594377
score: 0
accepted answer: http://stackoverflow.com/a/25931296
has comment: http://stackoverflow.com/comment/40594364
answer count: 1
has comment: http://stackoverflow.com/comment/40594303
has title: If statements not running
has comment: http://stackoverflow.com/comment/40594444
has comment: http://stackoverflow.com/comment/40594373
has body: The strings were parsed to integers, so the condition of the if statements are properly right set. Why are the if statements not running? Why there doesn't appear a MessageDialog with a response? class process{ public static void whoIs(){ JFrame frame=new JFrame("The Oldest"); String a=JOptionPane.showInputDialog(frame, "Enter, please, the first name and age:", "QUIZ: Who is the Oldest", JOptionPane.QUESTION_MESSAGE); String b=JOptionPane.showInputDialog(frame, "Enter, please, the second name and age:", "QUIZ: Who is the Oldest", JOptionPane.QUESTION_MESSAGE); String age1=a.replaceAll("[^\\d]",""); String age2=a.replaceAll("[^\\d]",""); String name1=a.replaceAll("\\d",""); String name2=b.replaceAll("\\d",""); int age1int=Integer.parseInt(age1); int age2int=Integer.parseInt(age2); if (age1int&gt;age2int){ JOptionPane.showMessageDialog(frame, name1+ " is the oldest!", "QUIZ: Who is the Oldest?", JOptionPane.INFORMATION_MESSAGE); } if (age2int&gt;age1int) { JOptionPane.showMessageDialog(frame, name2+ " is the oldest!", "QUIZ: Who is the Oldest?", JOptionPane.INFORMATION_MESSAGE); } } }
type: AnsweredQuestion
tagged with: joptionpane

http://stackoverflow.com/a/37445689
has comment: http://stackoverflow.com/comment/96836715
downvote count: 0
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25909611
has body: if you are using maven just add code to pom.xml mentioned by and Project> properties> Maven> Update Project It works
type: Answer

http://stackoverflow.com/a/26011994
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: /WEB-INF/ directory is not supposed to be accessible from client. Move your static resources like css and img to the webapp root.
score: 3
accepted answer of: http://stackoverflow.com/q/26011851
upvote count: 3
answers question: http://stackoverflow.com/q/26011851

http://stackoverflow.com/q/25888953
score: 0
has title: Storing a graph in a database
answer count: 1
tagged with: hsqldb
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26006491
has body: Im working on a project in my student job in which im using yfiles as the library for building custom graphs and icons, all in java using eclipse as IDE. the plan is to use an embedded db to save the user files created, here is where i have doubts about how would be the best way to accomplish that. They have an example on how to create graphs from data stored in a db, the library has support for several db engines including mysql, hsqldb, db1, oracle, derby and even CSV-JDBC. Now in their files there's no example or anything pointing that storing info from a graph to a database is possible and i would like to ask if someone who have use this library before knows how to take information from a graph (including icons and shapes) to be stored in any of these database engines. the files created by this library are named graphml, and its basically an xml file. My idea was to store the xml in the database as a blob and retrieve it when needed, but since they've got demos of creating graphs from information in a db i thought about asking here for anyone who knows this library about doing the reverse process of saving the elements in a db without using blob fields for storing a whole xml file into it. I will appreciate any help for this case, i apologize if it was not pretty clear, feel free to ask anything.
tagged with: java
tagged with: eclipse
type: Question
tagged with: graph

http://stackoverflow.com/a/25884299
has body: I believe all you need to do is mark the fields you want with @JsonProperty. For example: public class User { @JsonProperty private String username; ... @JsonProperty private String ip; ... }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25882250

http://stackoverflow.com/comment/87711622
type: Comment
comment on: http://stackoverflow.com/a/26026394
has text: @VladMihalcea Could you please explain why we can't reuse the session if there is an exception? Is it because hibernate roll-back the transaction and close the session when an exception is thrown? or some other reason?
score: 0
type: AnswerComment

http://stackoverflow.com/a/25947900
has body: Just remove in.close(); and it will work.
score: 0
answers question: http://stackoverflow.com/q/25947796
type: Answer

http://stackoverflow.com/a/25994564
score: 0
has body: You should use StringBuilder instead of String here since there can be lot of String concatenation which may create more object in the heap. Using StringBuilder you can do this easy way too. Eg: public static String BackwardsString(String str) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(str); return stringBuilder.reverse().toString(); } public static void main(String[] args) { System.out.println("Enter a string : "); Scanner firststr = new Scanner(System.in); String str = firststr.next(); System.out.println(BackwardsString(str)); }
has comment: http://stackoverflow.com/comment/40707201
answers question: http://stackoverflow.com/q/25994475
type: Answer
has comment: http://stackoverflow.com/comment/40707242

http://stackoverflow.com/comment/40592483
type: AnswerComment
comment on: http://stackoverflow.com/a/25929437
score: 0
type: Comment
has text: actually its against a registration form which on submission his first name last name, mailid, mobile no sits in signup table. Signup has a primary key CustId (which is a foreign key for both login ang forgotpassword tables). Username and password sits in login table. Login table has a primary key LoginId which is a foreign key for Forgotpassword table. and secret question and answer will sit in forgotpassword table. so in order to pass these foreign keys CustId and LoginId some values am struggling. Please help me so that i can fetch these id's and put it in where clause as u ve shown

http://stackoverflow.com/a/26001681
answers question: http://stackoverflow.com/q/26001580
upvote count: 2
has body: I can imagine quite a bit, the two most obvious (to me) are: If you modify them but still need to refer to the original values If you use main as a "normal" method, e.g., not just called from the command line In general, though, it's not super-useful in this case.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/40522565
has text: Can you paste the part of your code which is accessing the database ?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25891304
type: Comment

file-io
tags question: http://stackoverflow.com/q/25960752
tags question: http://stackoverflow.com/q/26004430
tags question: http://stackoverflow.com/q/25887780
tags question: http://stackoverflow.com/q/26007274
type: Tag
tags question: http://stackoverflow.com/q/25941694
tags question: http://stackoverflow.com/q/26001096
tags question: http://stackoverflow.com/q/26008650
tags question: http://stackoverflow.com/q/25919741
tags question: http://stackoverflow.com/q/25995969
tags question: http://stackoverflow.com/q/26002419
tags question: http://stackoverflow.com/q/25950310
tags question: http://stackoverflow.com/q/25903374
tags question: http://stackoverflow.com/q/25903469
tags question: http://stackoverflow.com/q/25874358
tags question: http://stackoverflow.com/q/25905864
tags question: http://stackoverflow.com/q/25943701
tag name: file-io

http://stackoverflow.com/q/25898168
type: AnsweredQuestion
score: 3
has title: Deploying CXF SOAP Web Services to Apache Tomcat
tagged with: cxf
upvote count: 3
tagged with: java
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25906458
tagged with: tomcat
favorite count: 0
tagged with: soap
accepted answer: http://stackoverflow.com/a/25906458
has body: I've recently re-written a web services application to use CXF instead of Axis. The switch was easy enough, but I'm having issues deploying the webapp. Previously, with Axis, you could navigate to a page, served by Tomcat, that would list all Axis services; something similar to http://localhost:8080/axis2/services/listServices. And to view a service's WSDL, I'd navigate to http://localhost:8080/axis2/services/Service?wsdl. After rewriting the services in CXF, I've found I don't really know how to deploy and configure the application. I've followed a basic CXF setup, where my application's web.xml file imports a Spring config file, beans.xml. I can war all this up just fine and deploy it in Tomcat, where it explodes just fine and no error logging occurs, but I cannot figure out how to even browse on the host to see a listing of the deployed web services. Can I get some help and explanation for this? I'd like to understand how to configure CXF so that I know what URLs to use in order to list services and see their corresponding WSDLs. Feel free to explain this portion as if I were five years old; I'm a solid programmer, but deployment and configuration aren't my strongest areas of knowledge. One thing I've noticed in trying to understand this is that the beans.xml file references an import of classpath:META-INF/cxf/cxf.xml. I have no idea what this file is or where it is, but my assumption would be that it's probably needed and that I should probably understand its role. Would someone mind explaining that as well? Does Tomcat's web.xml have anything to do with this configuration? If I can provide any more information or configuration in order to assist with this post, let me know! Here's my application's web.xml: <?xml version="1.0" encoding="ISO-8859-1"?> contextConfigLocation WEB-INF/beans.xml org.springframework.web.context.ContextLoaderListener CXF Servlet CXFServlet org.apache.cxf.transport.servlet.CXFServlet 1 CXFServlet /services/* inc text/plain And here's my …
tagged with: web-services

http://stackoverflow.com/a/25891514
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25888365
score: 0
type: Answer
has body: Solved with this fantastic extension https://github.com/codecentric/jbehave-junit-runner
answers question: http://stackoverflow.com/q/25888365

http://stackoverflow.com/comment/40527052
comment on: http://stackoverflow.com/a/25894132
type: AnswerComment
score: 0
type: Comment
has text: Good thing to know but no luck for me =(

http://stackoverflow.com/q/26014744
answer count: 1
downvote count: 0
has title: Reading special Charanters in XML org.w3c.dom
favorite count: 0
has body: I´m reading a XML with characters like "ñ". When i use ... Node c = nodeList.item( j); c.getFirstChild().getNodeValue(); ... for to read this 1Ññ I get: 1Ã‘Ã± Any idea? The xml file starts with the following line <?xml version="1.0" encoding="ISO-8859-1"?>
has answer: http://stackoverflow.com/a/26015232
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
type: Question
tagged with: w3c
tagged with: java
tagged with: dom
tagged with: xml-parsing
accepted answer: http://stackoverflow.com/a/26015232
upvote count: 1

http://stackoverflow.com/a/26002733
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/40723429
has body: Are you just looking for a convenient way to register your resources or do you really want to configure the resources in the YAML configuration? If it's the former this is what I'd do: for (ClassInfo classInfo: ClassPath.from(getClass().getClassLoader()).getTopLevelClasses("com.abc")) { environment.jersey().register(i.getInstance(classInfo.load())); } If it's the latter you'd have to parse those strings yourself. I don't think that the YAML configuration will do that for you. Would something like this work: class Config { List&lt;Class&lt;?&gt;&gt; resourceClasses = new ArrayList&lt;Class&lt;?&gt;&gt;(); @JsonProperty("resourceClasses") public void setResourceClasses(Collection&lt;String&gt; classNames) throws ClassNotFoundException { for (String className : classNames) { resourceClasses.add(Class.forName(className)); } } }
answers question: http://stackoverflow.com/q/26001175
accepted answer of: http://stackoverflow.com/q/26001175
has comment: http://stackoverflow.com/comment/40722889
score: 0

http://stackoverflow.com/comment/40716423
has text: Oh. So there's another one problem.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25999185

http://stackoverflow.com/comment/40630071
type: QuestionComment
comment on: http://stackoverflow.com/q/25942002
score: 0
has text: Edited to include full stack trace.
type: Comment

http://stackoverflow.com/comment/40495748
type: Comment
type: QuestionComment
has text: You'd have to iterate through the set, checking values, either using the equals() function as suggested above, or individually checking the Strings. Have you considered using a Map instead or is the Set a requirement? You've described something that has a key (in this case a pair of values) that makes them equivalent.
comment on: http://stackoverflow.com/q/25876859
score: 0

http://stackoverflow.com/comment/40515848
type: Comment
type: QuestionComment
has text: Sorry for bothering you
comment on: http://stackoverflow.com/q/25888012
score: 0

http://stackoverflow.com/q/25938529
accepted answer: http://stackoverflow.com/a/25943743
has answer: http://stackoverflow.com/a/41794998
tagged with: jetty
has body: The thread pool in Jetty by default is implemented with an unbounded queue once the thread pool fills up. I'd like to put a limit on the size of the queue. There is a constructor for BlockingArrayQueue that takes a maxCapacity value but I can see no way to call it using jetty.xml. As of Jetty 9, there is no setter for the threadpool in org.eclipse.jetty.server.Server, I can only get a reference to the thread pool that has already been instantiated and mutate it (see this answer). And the setter for the queue field in QueuedThreadPool throws an UnsupportedOperationException, saying to use constructor injection. But this is impossible if I can only mutate the thread pool, not set a new one on the server instance. Attempting to define the thread pool as a constructor arg yields the following warning: 2014-09-22 13:15:13.688:WARN:oejx.XmlConfiguration:main: Ignored arg: | 200501000| 6000| false| This is with the Jetty Maven Plugin v9.2.2.v20140723. Here is the configuration in my pom.xml: ${basedir}/jetty.xml x 7999 true ${basedir}/target/app /app ${basedir}/src/main/webapp/WEB-INF/ manual
upvote count: 1
type: Question
type: AnsweredQuestion
has title: Set Queue Limit via jetty.xml in Jetty 9 Maven Plugin
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/18534025
answer count: 2
has answer: http://stackoverflow.com/a/25943743
downvote count: 0
favorite count: 0
tagged with: maven-jetty-plugin
possible better answer: http://stackoverflow.com/a/41794998

http://stackoverflow.com/q/25977594
has comment: http://stackoverflow.com/comment/40677794
tagged with: java
has comment: http://stackoverflow.com/comment/40688560
type: Question
upvote count: 2
tagged with: xpath-2.0
answer count: 1
tagged with: vtd-xml
accepted answer: http://stackoverflow.com/a/26092071
favorite count: 0
tagged with: out-of-memory
tagged with: memory-mapped-files
has answer: http://stackoverflow.com/a/26092071
has comment: http://stackoverflow.com/comment/40801770
has body: I have to split an xml which is of minimum size of 3GB. We can provide only 1.5GB heap space in 64 bit JVM on Windows OS. I have got example codes all over the Internet using VTDNav only, not with VTDNavHuge. The agenda is to read the above mentioned huge XML and extract a paticular node from it using Xpath and create a new xml with the above extracted content. I am always getting OutOfMemomry exception, though it was mentioned that we can process upto 256GB file also using VTD extended. That is using VTDNavHuge. Please help me with sample code to complete the above mention task under provided development environment. >3GB size file and 1.5GB heap space. I am trying to use memory mapped mode while parsing the file with VTD XML extended.
linked to: http://stackoverflow.com/q/1134189
has title: How to spit the large XML(more than 3GB) using VTD-XML extended
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/26008975
tagged with: java
has comment: http://stackoverflow.com/comment/40734198
type: Question
has title: Check whether a specified XML element have certain name using JAVA
has comment: http://stackoverflow.com/comment/40734300
has answer: http://stackoverflow.com/a/26009083
accepted answer: http://stackoverflow.com/a/26009083
score: 0
answer count: 1
has body: Im working with JAVA and XML. Following is the XML file im working with: &lt;TestCase&gt; &lt;SelectedDataTableNames name="SearchData"&gt; &lt;/SelectedDataTableNames&gt; &lt;Open page="hsbc" ms="5000" /&gt; &lt;Click object="hsbc.Personal_Link" /&gt; &lt;Click object="hsbc.CreditCard_tab" /&gt; &lt;Call businessComponent="Global.Verify_Search"&gt; &lt;Param name="HotelName_Param" value="@SearchData_link" /&gt; &lt;/Call&gt; &lt;CheckElementPresent object="hsbc.Img_Hotel_logo" Identifire="Hotel_Name_PARAM:@SearchData_ResultHotelName" fail="true" customErrorMessage="Searched hotel name is not present in the page." /&gt; &lt;/TestCase&gt; And what my java code do so far is it gets all the elements under a specified parent(here "TestCase") and have to do different function according to different element name. What i found it difficult is how to check whether specified element contains the name. I couldnt check IF using "getElementsByTagName" as it will print true for all occurrence as there is that element. Here is the code and i have commented the place whether the check should occur. File fXmlFile = new File("SearchPromotions.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); Element docEle = doc.getDocumentElement(); NodeList nl = docEle.getChildNodes(); if (nl != null &amp;&amp; nl.getLength() &gt; 0) { for (int i = 0; i &lt; nl.getLength(); i++) { if (nl.item(i).getNodeType() == Node.ELEMENT_NODE) { Element ele = (Element) nl.item(i); if(//to check whther the current element is "Click"){ System.out.println(ele); } } } }
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/comment/40584581
type: Comment
has text: You still have to synchronize on something because ++ is not atomic. BTW an AtomicInteger would be a good choice too.
comment on: http://stackoverflow.com/a/25925459
type: AnswerComment
score: 0

http://stackoverflow.com/q/25910727
downvote count: 1
has title: operators as variables name in java same like #define in c
favorite count: 0
tagged with: operators
has comment: http://stackoverflow.com/comment/40558254
has answer: http://stackoverflow.com/a/25910894
has body: #define AND=&amp;&amp;; public static final String AND = &amp;&amp;; //GIVES ERROR i want to define the operators as normal variables names in my code same like we do in C language using #define, how do i do that in java ?
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/c
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25910774
score: 0

http://stackoverflow.com/q/26011149
downvote count: 2
possible better answer: http://stackoverflow.com/a/26011267
has comment: http://stackoverflow.com/comment/40738013
has answer: http://stackoverflow.com/a/26011267
duplicate of: http://stackoverflow.com/q/3504986
type: AnsweredQuestion
tagged with: java
tagged with: date
type: Question
linked to: http://stackoverflow.com/q/17132106
has comment: http://stackoverflow.com/comment/40738041
has answer: http://stackoverflow.com/a/26011203
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/26011179
favorite count: 0
tagged with: android
tagged with: datetime
has body: I have a String object that contains expired date and time like strDateTimeBoj="Oct 11 2014 5:30PM"; I need it to be extracted to separate date and time , because it needs to be checked with current date and time , whether this date is expired or not ... I know the following code , but didn't achieved the goal DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss"); DateTime dt = formatter.parseDateTime(string); How to achieve this .....Any help would be great...
answer count: 4
accepted answer: http://stackoverflow.com/a/26011203
has answer: http://stackoverflow.com/a/26011237
has title: extract date and time from String object android
tagged with: time
linked to: http://stackoverflow.com/q/3504986

http://stackoverflow.com/q/25916864
has answer: http://stackoverflow.com/a/25934191
tagged with: indexing
has body: I googled and read the official doc of mongodb (http://docs.mongodb.org/manual/core/index-intersection/), but didn't find any tutorial or indications on syntax of query using index intersection. Does mongodb apply automatically index intersection when the query involves 2 fields which are separately indexed by a single index? I don't think so. Here is what cursor.explain() show when i run a query between 2 dates and a given "name" ("name" is a field, both date and name are indexed.) { "cursor": "BtreeCursor Name_1", "isMultiKey": false, "n": 99330, "nscannedObjects": 337500, "nscanned": 337500, "nscannedObjectsAllPlans": 337601, "nscannedAllPlans": 337705, "scanAndOrder": false, "indexOnly": false, "nYields": 18451, "nChunkSkips": "millis": 15430, "indexBounds": { "Name": [ [ "blabla", "blabla" ] ] }, "allPlans": [ { "cursor": "BtreeCursor Name_1", "isMultiKey": false, "n": 99330, "nscannedObjects": 337500, "nscanned": 337500, "scanAndOrder": false, "indexOnly": false, "nChunkSkips": 0, "indexBounds": { "Name": [ [ "blabla", "blabla" ] ] } }, { "cursor": "BtreeCursor Date_1", "isMultiKey": false, "n": 0, "nscannedObjects": 101, "nscanned": 102, "scanAndOrder": false, "indexOnly": false, "nChunkSkips": 0, "indexBounds": { "Date": [ [ "2014-08-23 10:28:50.221", "2014-08-23 13:28:50.221" ] ] } }, { "cursor": "Complex Plan", "n": 0, "nscannedObjects": 0, "nscanned": 103, "nChunkSkips": 0 } The complex plan shows nothing. And the elapsed time is 16s. If I query only by name without date, it takes only 0.9s I want to learn how to write query using index intersection in mongojava driver, something like hint() in mongo shell. Any example or tutorial link is welcome. I know about writing basic queries with Mongodb java driver. You can just post the essential code example if it saves ur time. Thanks in advance.
tagged with: mongodb
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/25934191
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25918537
has title: How to write query with index intersection with Mongo java driver
has answer: http://stackoverflow.com/a/25918537
tagged with: java
answer count: 2
linked to: http://stackoverflow.com/q/24504792
upvote count: 1

http://stackoverflow.com/comment/40684151
score: 0
type: Comment
type: QuestionComment
has text: Errors like this are best debugged with Fiddler, http://www.telerik.com/fiddler. Without knowing the contents of the request it would only be getting as to what is wrong with the request as sent.
comment on: http://stackoverflow.com/q/25929514

android-studio
tags question: http://stackoverflow.com/q/25959542
tags question: http://stackoverflow.com/q/26028171
tags question: http://stackoverflow.com/q/25891454
tags question: http://stackoverflow.com/q/26014181
tags question: http://stackoverflow.com/q/25908457
type: Tag
tags question: http://stackoverflow.com/q/25898612
tags question: http://stackoverflow.com/q/25954576
tags question: http://stackoverflow.com/q/25902518
tags question: http://stackoverflow.com/q/25960762
tags question: http://stackoverflow.com/q/26026609
tag name: android-studio

http://stackoverflow.com/a/25966625
score: 0
answers question: http://stackoverflow.com/q/25966564
type: Answer
has body: declare it globally, declare it outside the switch block, where you declare your all variable. Declare it here, int userOption = 0; String stringInput = new String(); StringTokenizer st; //add here so your case 4 will be case 4: st = new StringTokenizer(stringInput); System.out.println(stringInput); break;

http://stackoverflow.com/comment/40519647
score: 3
comment on: http://stackoverflow.com/q/25890543
type: Comment
has text: `"What is wrong with this code?"` -- You tell us -- what error messages or misbehaviors are you getting if any? Note, please avoid posting code that is indented so much as to be hard to read. I tried to fix it.
type: QuestionComment

http://stackoverflow.com/a/25985413
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25979986
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/25979986
upvote count: 1
has body: CircleMapObject is intended to be used with the Maps api. It holds a Circle, and a few additional properties as defined by its parent class MapObject. CircleShape is for use with Box2D. Circle is the most light weight and general, so if you don't need it for a Map or Box2D, that's the one you want.

http://stackoverflow.com/comment/40716404
comment on: http://stackoverflow.com/a/25999258
type: Comment
has text: The problem withe the web-service is that I don't have a hosting for java that I can put the code there I don't want to rewrite the code either because I want to develop a dektop app too. I see a lot of problems here..
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40571260
comment on: http://stackoverflow.com/a/25912449
score: 0
type: AnswerComment
type: Comment
has text: @ madhawa priyashantha it works, it builds properly and i see the application as expected. However when i try to run it as a standalone application it doesnt work. I thought the reason may be because of these warnings? is that not right?

http://stackoverflow.com/comment/40744894
has text: Log cat : url =(2283): http://192.168.1.11:3030/api/db/8 url =(2283): http%3A%2F%2F192.168.1.11%3A3030%2Fapi%2Fdb%2F8+ (((( Log.d("url = ", url); Log.d("url = ", URLEncoder.encode(url, "UTF-8")); )))
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26014812

http://stackoverflow.com/a/25965375
has comment: http://stackoverflow.com/comment/40654940
type: Answer
has body: Here is what I have done, along with some tests : public static void main( String[] args ) { System.out.println(nGroup(0,2,new int[]{1,2,2,2,3,2})); //0 System.out.println(nGroup(1,2,new int[]{1,2,2,2,3,2})); //4 System.out.println(nGroup(2,2,new int[]{1,2,2,2,3,2})); //2 System.out.println(nGroup(3,2,new int[]{1,2,2,2,3,2})); //1 System.out.println(nGroup(4,2,new int[]{1,2,2,2,3,2})); //0 System.out.println(nGroup(2,2,new int[]{1,2,2,2,2,3,2})); //3 } public static int nGroup(int nOccs, int val, int[] arr) { int count = 0; if (nOccs == 0 || arr == null) return count; for (int i=0; i&lt;arr.length; i++) { int occs; for (occs = 0 ; i&lt;arr.length &amp;&amp; arr[i] == val ; i++, occs++); if (occs &gt;= nOccs) count += occs - nOccs + 1; } return count; }
score: 0
has comment: http://stackoverflow.com/comment/40654844
answers question: http://stackoverflow.com/q/25965281

http://stackoverflow.com/a/28646210
downvote count: 1
type: Answer
has body: You should html-escape special characters. For example: € = &amp;euro; That way you always have plain ascii in your html and don't have to worry about encodings.
answers question: http://stackoverflow.com/q/25897932
upvote count: 1
score: 0

http://stackoverflow.com/a/25965544
has body: You have not called the constructor which adds the elements. Try calling new before size: new InfosVols(); System.out.println(listeVol.size()); It is not very clear what you are trying to achieve but this kind of design is dangerous. With every new call to the constructor you add further elements to the static (global) variable listeVol. You probably do not want the listeVol to be static.
score: 1
has comment: http://stackoverflow.com/comment/40655223
answers question: http://stackoverflow.com/q/25965506
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/36106037
type: Answer
answers question: http://stackoverflow.com/q/25944389
score: 0
has body: Well, put http://localhost:8000/users/1 in your web browser and what do you get? A simple Connection Refused error. It's not you, it's the website. Also, Url returns websites using Protocol Identifiers(http://, https://), Ending Domains(.com, .edu, .gov) that's also another reason why you get an error.

http://stackoverflow.com/a/25994183
score: 0
type: Answer
has body: i also do this but my coding also working do this solution @RequestMapping(value="/saveUserTask", method=RequestMethod.POST) @ResponseBody public Map&lt;String,String&gt; saveUserTask( @RequestParam( value = "title" , required = false) String title, @RequestParam( value = "projectid" , required = false) int projectid, @RequestParam( value = "mileid" , required = false,defaultValue ="-1") int mileid, @RequestParam( value = "responsible" , required = false) int responsible[], @RequestParam( value = "startDate" , required = false) Date startDate, @RequestParam( value = "endDate" , required = false) Date endDate, @RequestParam( value = "description" , required = false) String description, @RequestParam( value = "priority" , required = false, defaultValue="1") int priority, @RequestParam( value = "workHours" , required = false) int workHours, @RequestParam(value = "attachment" , required = false) MultipartFile myFile, HttpServletRequest request,Principal principal,RedirectAttributes redirectAttributes,Locale locale) throws ParseException, IOException{ String fileAttachPath; if(myFile!=null) fileAttachPath=request.getSession().getServletContext().getRealPath("/WEB-INF/attechments/"+ new Date().getTime() + "_" + myFile.getOriginalFilename()); else fileAttachPath=""; }
answers question: http://stackoverflow.com/q/25994125

http://stackoverflow.com/comment/40579975
has text: I'm sorry, I pasted the code wrong here. Edited it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25923060
score: 0

http://stackoverflow.com/q/25970176
has comment: http://stackoverflow.com/comment/40663454
has comment: http://stackoverflow.com/comment/40664546
has comment: http://stackoverflow.com/comment/40664374
tagged with: java
has comment: http://stackoverflow.com/comment/40663373
type: Question
has body: I have as input a group of elements, let's assume they are strings: String[] elements = {"A","B","C","D"}; I would like to generate all permutations of size 1, 2 and 3 ( until n-1) elements, without duplicating any element. So the output will look exactly like this: A B C D AB AC AD BC BD CD ABC ABD ACD BCD The current code I have generate all permutations, but with duplicates :( public static String[] getAllLists(String[] elements, int lengthOfList) { //initialize our returned list with the number of elements calculated above String[] allLists = new String[(int)Math.pow(elements.length, lengthOfList)]; //lists of length 1 are just the original elements if(lengthOfList == 1) return elements; else { //the recursion--get all lists of length 3, length 2, all the way up to 1 String[] allSublists = getAllLists(elements, lengthOfList - 1); //append the sublists to each element int arrayIndex = 0; for(int i = 0; i &lt; elements.length; i++) { for(int j = 0; j &lt; allSublists.length; j++) { //add the newly appended combination to the list allLists[arrayIndex] = elements[i] + allSublists[j]; arrayIndex++; } } return allLists; } } public static void main() { String[] elements = {"A","B","C","D"}; for(int i=1; i&lt;=elements.length; i++) { String[] result = getAllLists(elements, i); for(int j=0; j&lt;result.length; j++) { System.out.println(result[j]); } } }
answer count: 2
has comment: http://stackoverflow.com/comment/40666670
has title: How to generating permutations of elements of different sizes
has comment: http://stackoverflow.com/comment/40663429
has answer: http://stackoverflow.com/a/25972147
score: 0
tagged with: permutation
has answer: http://stackoverflow.com/a/25973561
type: UnansweredQuestion

http://stackoverflow.com/comment/40735234
comment on: http://stackoverflow.com/q/26009492
has text: I did put a receiver tag in the manifest file as the edited portion. Is that the service you mentioned above?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25875106
tagged with: java
downvote count: 3
has body: Helllo can somebody tell my why it doesn't tell my that the password is invalid, when I don't write the valid password? import java.util.Scanner; public class Password { private static Scanner in; public static void main(String[] args) { System.out.println("Please enter the password:"); in = new Scanner (System.in); String pass; pass = in.nextLine(); if(pass.length() &lt; 4){ System.out.println("The password is too short"); } else if(pass.length() &gt; 9){ System.out.println("The password is too long"); } if(pass.equalsIgnoreCase("hudhud")){ System.out.println("Welcome BOSS"); while (!pass.equals("hudhud")){ System.out.println("The password is invalid"); } } } }
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/25876294
has comment: http://stackoverflow.com/comment/40492510
has comment: http://stackoverflow.com/comment/40494233
answer count: 1
accepted answer: http://stackoverflow.com/a/25876294
has comment: http://stackoverflow.com/comment/40492973
has comment: http://stackoverflow.com/comment/40492322
favorite count: 0
has title: What's wrong with my password program?
score: -3
tagged with: passwords
type: AnsweredQuestion

http://stackoverflow.com/a/25959034
has comment: http://stackoverflow.com/comment/40644223
answers question: http://stackoverflow.com/q/25949767
type: Answer
has comment: http://stackoverflow.com/comment/40644309
has comment: http://stackoverflow.com/comment/40644956
has comment: http://stackoverflow.com/comment/40645455
score: 0
has comment: http://stackoverflow.com/comment/40644401
has body: @bwegs - It works, thanks a lot! The only problem right now is that I have 18 buttons and need 21 TextViews. As I mentioned above, each button has a textView on top of it, but the last buttons from the bottom, have 3 textViews below the buttons. Due to my implementation, I'm not really sure how will I add those 3 textViews...
has comment: http://stackoverflow.com/comment/40644463
has comment: http://stackoverflow.com/comment/40644756
has comment: http://stackoverflow.com/comment/40644070

arraylist
tags question: http://stackoverflow.com/q/26028798
tags question: http://stackoverflow.com/q/25985282
tags question: http://stackoverflow.com/q/25993068
tags question: http://stackoverflow.com/q/25920318
tags question: http://stackoverflow.com/q/25876085
tags question: http://stackoverflow.com/q/25905107
tags question: http://stackoverflow.com/q/25886233
tags question: http://stackoverflow.com/q/25992805
tags question: http://stackoverflow.com/q/26003480
tags question: http://stackoverflow.com/q/25928499
tags question: http://stackoverflow.com/q/26025975
tags question: http://stackoverflow.com/q/25972612
tags question: http://stackoverflow.com/q/26020685
tags question: http://stackoverflow.com/q/25936269
tags question: http://stackoverflow.com/q/25914142
tags question: http://stackoverflow.com/q/25951915
tags question: http://stackoverflow.com/q/26030602
tags question: http://stackoverflow.com/q/25910797
tags question: http://stackoverflow.com/q/25928999
tags question: http://stackoverflow.com/q/25964779
tags question: http://stackoverflow.com/q/26000144
tags question: http://stackoverflow.com/q/25901407
tags question: http://stackoverflow.com/q/25995806
tags question: http://stackoverflow.com/q/26021030
tags question: http://stackoverflow.com/q/25939514
tags question: http://stackoverflow.com/q/25942456
tags question: http://stackoverflow.com/q/25984367
tags question: http://stackoverflow.com/q/25873621
tags question: http://stackoverflow.com/q/25959662
tags question: http://stackoverflow.com/q/25930152
tags question: http://stackoverflow.com/q/25904181
tags question: http://stackoverflow.com/q/25905218
tags question: http://stackoverflow.com/q/25925183
tags question: http://stackoverflow.com/q/25913966
tags question: http://stackoverflow.com/q/25959518
tags question: http://stackoverflow.com/q/25987265
tags question: http://stackoverflow.com/q/25972385
tags question: http://stackoverflow.com/q/25942251
tags question: http://stackoverflow.com/q/25965599
tags question: http://stackoverflow.com/q/25945289
tags question: http://stackoverflow.com/q/25966400
tags question: http://stackoverflow.com/q/25986624
tags question: http://stackoverflow.com/q/25964233
tags question: http://stackoverflow.com/q/25949438
tags question: http://stackoverflow.com/q/25919843
tags question: http://stackoverflow.com/q/25953120
tags question: http://stackoverflow.com/q/25940053
tags question: http://stackoverflow.com/q/25979509
tags question: http://stackoverflow.com/q/25880426
tags question: http://stackoverflow.com/q/25988086
tags question: http://stackoverflow.com/q/26003767
tags question: http://stackoverflow.com/q/25972707
tags question: http://stackoverflow.com/q/25887034
type: Tag
tags question: http://stackoverflow.com/q/25995084
tags question: http://stackoverflow.com/q/25998286
tags question: http://stackoverflow.com/q/25942550
tag name: arraylist
tags question: http://stackoverflow.com/q/25880618
tags question: http://stackoverflow.com/q/25892978
tags question: http://stackoverflow.com/q/25889479

http://stackoverflow.com/q/25976590
has comment: http://stackoverflow.com/comment/40675666
has comment: http://stackoverflow.com/comment/40675695
has body: i have an error on the logcat which reads FATAL EXCEPTION: main RunTime exception unable to instatiate activity componentInfo(android launcher) java.lang.classNotFoundException: Didn't find class " androidLauncher " on path : DexPathList[[zip file "/android-3.apk"],nativeLibraryDirectories=[android-3, /vendor/lib, /system/lib]] i shortened it down as i couldnt copy and paste it but the basic error is there If you need any more details just ask but hopefully this should be enough My game compiles but doesnt run and a message pops up on my android device "game has stopped" Hopefully someone can help as i have been messing around with this for a few days and still no luck :( thankyou
has comment: http://stackoverflow.com/comment/40675150
tagged with: android
has title: unable to run LibGDX game on android device due to not being able to find the android launcher class
answer count: 1
has comment: http://stackoverflow.com/comment/40675447
accepted answer: http://stackoverflow.com/a/26313091
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40674928
has comment: http://stackoverflow.com/comment/40674898
has comment: http://stackoverflow.com/comment/40674851
tagged with: gradle
has comment: http://stackoverflow.com/comment/40674967
type: Question
has answer: http://stackoverflow.com/a/26313091
linked to: http://stackoverflow.com/q/24031573
tagged with: dex
tagged with: libgdx
downvote count: 0

http://stackoverflow.com/comment/40745690
comment on: http://stackoverflow.com/q/26014481
has text: http://blog.publicobject.com/2008/11/guice-punches-erasure-in-face.html - google provides guice library to avoid that
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25883396
upvote count: 1
type: AnsweredQuestion
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/25883409
type: Question
linked to: http://stackoverflow.com/q/3593420
score: -2
has body: I have loss my important android project and their files also in mac osx pc. I have only .apk file of that project.Can some one tell me how to getting source from apk because i can not create big project again and it's urgent.Please someone help me or guid me.
has title: How to get source code from apk file in Android?
answer count: 1
duplicate of: http://stackoverflow.com/q/3593420
favorite count: 0
has answer: http://stackoverflow.com/a/25883409
tagged with: android

http://stackoverflow.com/a/25904840
downvote count: 1
has body: In either case I would create a separate class, perhaps a Singleton or a static class. Then I would call it when I need it. Now if I wanted to make it a thread then it would need to meet some criteria. Should it run parallel to anything else? Will it hold back any other code trying to execute? Since you are using a TCP socket then there might be a good chance that it could hold back execution of other code in perhaps a server you plan to run.
answers question: http://stackoverflow.com/q/25904803
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40546409
upvote count: 1

http://stackoverflow.com/comment/40673995
type: AnswerComment
has text: This [small piece of code](http://ideone.com/S0jKZX) demonstrate what Holger says: the class can be loaded on-demand.
comment on: http://stackoverflow.com/a/25967516
type: Comment
score: 2

servlets
tags question: http://stackoverflow.com/q/25927652
tags question: http://stackoverflow.com/q/25892562
tags question: http://stackoverflow.com/q/25927079
tags question: http://stackoverflow.com/q/25957790
tags question: http://stackoverflow.com/q/25927827
tags question: http://stackoverflow.com/q/25886806
tags question: http://stackoverflow.com/q/25931640
tags question: http://stackoverflow.com/q/25883588
tags question: http://stackoverflow.com/q/25875902
tags question: http://stackoverflow.com/q/25900105
tags question: http://stackoverflow.com/q/25938226
tags question: http://stackoverflow.com/q/25949598
tags question: http://stackoverflow.com/q/26019246
tags question: http://stackoverflow.com/q/25980712
tags question: http://stackoverflow.com/q/25950877
tags question: http://stackoverflow.com/q/25990790
tags question: http://stackoverflow.com/q/25898812
tags question: http://stackoverflow.com/q/25885330
tags question: http://stackoverflow.com/q/25916300
tags question: http://stackoverflow.com/q/25998879
tags question: http://stackoverflow.com/q/25984807
tags question: http://stackoverflow.com/q/25960383
tags question: http://stackoverflow.com/q/25940525
tags question: http://stackoverflow.com/q/25928486
tags question: http://stackoverflow.com/q/25961528
tags question: http://stackoverflow.com/q/25931750
tags question: http://stackoverflow.com/q/26017767
tags question: http://stackoverflow.com/q/25951167
tags question: http://stackoverflow.com/q/26020345
tags question: http://stackoverflow.com/q/25931316
tags question: http://stackoverflow.com/q/25923346
tags question: http://stackoverflow.com/q/25972883
tags question: http://stackoverflow.com/q/25983786
tags question: http://stackoverflow.com/q/25945493
tags question: http://stackoverflow.com/q/25977706
tags question: http://stackoverflow.com/q/25890271
tags question: http://stackoverflow.com/q/25974351
tags question: http://stackoverflow.com/q/26032311
tags question: http://stackoverflow.com/q/25938462
tags question: http://stackoverflow.com/q/25879125
tags question: http://stackoverflow.com/q/26018988
tags question: http://stackoverflow.com/q/25926593
tags question: http://stackoverflow.com/q/25957856
tags question: http://stackoverflow.com/q/25989815
tags question: http://stackoverflow.com/q/25883171
tags question: http://stackoverflow.com/q/25908994
tags question: http://stackoverflow.com/q/26009229
tags question: http://stackoverflow.com/q/25998588
tags question: http://stackoverflow.com/q/25978398
tags question: http://stackoverflow.com/q/26010650
tags question: http://stackoverflow.com/q/25914052
tags question: http://stackoverflow.com/q/25975426
tags question: http://stackoverflow.com/q/26025727
tags question: http://stackoverflow.com/q/25971168
tags question: http://stackoverflow.com/q/26032634
tags question: http://stackoverflow.com/q/25911346
tags question: http://stackoverflow.com/q/25905920
tags question: http://stackoverflow.com/q/26002526
tags question: http://stackoverflow.com/q/25904827
tags question: http://stackoverflow.com/q/25938874
tags question: http://stackoverflow.com/q/26018705
tag name: servlets
tags question: http://stackoverflow.com/q/25875531
tags question: http://stackoverflow.com/q/25894200
tags question: http://stackoverflow.com/q/25893892
type: Tag
tags question: http://stackoverflow.com/q/25989177
tags question: http://stackoverflow.com/q/25931940
tags question: http://stackoverflow.com/q/25959906

http://stackoverflow.com/a/25993158
has comment: http://stackoverflow.com/comment/40705010
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/40705940
answers question: http://stackoverflow.com/q/25993095
type: Answer
upvote count: 0
has body: In your onPostExecute function, you have this code in the catch block: URL newurl = null; try { newurl = new URL("http://www.texomashomepage.biz/images/movie_no_poster.160x240.png"); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } EDIT: lol didn't add the actual network operation. (just after the above code, you do the actual request) Bitmap mIcon_val = null; try { mIcon_val = BitmapFactory.decodeStream(newurl.openConnection() .getInputStream()); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }

http://stackoverflow.com/q/25920748
score: 0
answer count: 1
has title: Java Maven Build: Thread.sleep doesn't work (in eclipse it does)
has answer: http://stackoverflow.com/a/31046725
has comment: http://stackoverflow.com/comment/40576825
has comment: http://stackoverflow.com/comment/40577121
has comment: http://stackoverflow.com/comment/40576076
type: UnansweredQuestion
tagged with: multithreading
tagged with: maven
tagged with: java
has comment: http://stackoverflow.com/comment/40577739
has comment: http://stackoverflow.com/comment/40576292
tagged with: sleep
type: Question
has body: I've got a strange error. My code is the following: LoginQueue queue = new LoginQueue(server); QueueTimer timer = queue.waitInQueue(this.username, this.password); Thread.currentThread().sleep(6000); while (!timer.isFinished()) { if (timer.getPosition() != 0L) { log("Queue Position" + server.toString() + ":" + String.valueOf(timer.getPosition()), LogLevel.DEBUG); Thread.currentThread().sleep(3000); } My goal is to login to the League of Legends servers using the open source riotapi: https://github.com/loldevs/riotapi/ The problem isn't LoL specific, so no problem there. When I create the QueueTimer, it needs some time to retrieve some data from the server, otherwise timer.getPosition() will throw a NullPointerException. That's why I wait 6 seconds before going on. In Eclipse debugging it all works fine, but after exporting it with m2eclipse (clean package as goals; I'm new to Maven if that matters), the compiled JAR doesn't sleep. It just goes on and then throws my NullPointerException because it didn't wait. Why does my code behave in Eclipse and doesn't work outside? What am I doing wrong? I've tried Thread.sleep() instead of Thread.currentThread().sleep(), doesn't work either. Edit: I changed it to: LoginQueue queue = new LoginQueue(server); String authkey = queue.waitInQueueBlocking(this.username, this.password); So I am using synchronous methods now. Now I get the following stacktrace: Exception in thread "Queue Timer for LeagueAlerter" java.lang.NullPointerException at org.apache.cxf.jaxrs.client.AbstractClient.setupOutInterceptorChain(AbstractClient.java:840) at org.apache.cxf.jaxrs.client.AbstractClient.createMessage(AbstractClient.java:902) at org.apache.cxf.jaxrs.client.WebClient.finalizeMessage(WebClient.java:1068) at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1049) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:854) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:825) at org.apache.cxf.jaxrs…
has comment: http://stackoverflow.com/comment/40575887
has comment: http://stackoverflow.com/comment/40576155

http://stackoverflow.com/q/26011829
score: 0
has body: I have one scenario, @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:integration-test.xml"}) public abstract class IntegrationTestBase each new integration test will extend this class, I would like to let spring unit test runner only load it once, how can do it? actually there are embeded active mq in integration-test.xml, but when there is test fail, the activeMQ will be re-initialized agian.
tagged with: junit
has comment: http://stackoverflow.com/comment/40739735
has comment: http://stackoverflow.com/comment/40739275
answer count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: unit-testing
tagged with: spring-mvc
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40739426
has title: spring junit runner load context configuraiton one time for multi test case

http://stackoverflow.com/q/25935503
has title: Google play game services sign in/out buttons
tagged with: android
accepted answer: http://stackoverflow.com/a/25982284
type: Question
type: AnsweredQuestion
tagged with: android-layout
has comment: http://stackoverflow.com/comment/40601970
tagged with: java
tagged with: adt
has answer: http://stackoverflow.com/a/25982284
answer count: 1
tagged with: google-play-games
score: 0
has body: Im trying to implement google play game services sign in/out buttons as its suggested here: https://developers.google.com/games/services/training/signin But whenever findViewById(R.id.sign_in_button).setVisibility(View.GONE); or findViewById(R.id.sign_out_button).setVisibility(View.VISIBLE); gets called - my application crashes. The problem is - I don't quite understand how to properly add these buttons on my main layout and then use them. So, I dont get it... Am I not properly adding these sign in/out buttons, or is there something wrong with my layout? How do you actually add these buttons to the main layout? I didnt find any source in the internet that provides a complete implementation of these buttons, only pieces of code. May be its got something to do with the view? I dont get it - if Im implementing View.OnClickListener, then how do these buttons know to what view they are assigned to... As I created another view for ads, but its a special view. Im just lost :( Here is my main layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;!-- sign-in button --&gt; &lt;com.google.android.gms.common.SignInButton android:id="@+id/sign_in_button" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;!-- sign-out button --&gt; &lt;Button android:id="@+id/sign_out_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sign Out" android:visibility="gone" /&gt; &lt;/LinearLayout&gt; And thats what I do in my main activity: public class AndroidLauncher extends AndroidApplication implements AdInterface, GameHelperListener, ActionResolver, View.OnClickListener { int launched = 0; Intent intent; private final String AD_UNIT_ID = "------"; private final int SHOW_ADS = 1; private final int HIDE_ADS = 0; protected AdView adView; pr…

http://stackoverflow.com/comment/40584723
type: QuestionComment
has text: @Aswin: Why do you need to lowercase the text in the first place? Typically, you should instead just normalize the Unicode text and then use a locale-aware case insensitive comparison later.
comment on: http://stackoverflow.com/q/25925490
score: 0
type: Comment

http://stackoverflow.com/q/26026631
tagged with: file
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26026633
accepted answer: http://stackoverflow.com/a/26026633
upvote count: 2
possible better answer: http://stackoverflow.com/a/26026632
answer count: 2
has comment: http://stackoverflow.com/comment/40767068
tagged with: io
downvote count: 1
has title: How is the method read() in FileReader moving through a file?
favorite count: 0
has answer: http://stackoverflow.com/a/26026632
has body: So I just wrote a program that reads a specific file and returns the frequency of each character used. This was done by using a singly linked list(not java LinkedList, but very similar). What I want to know is why this: while(txtFile.read() != -1){ Character letter = (char) txtFile.read(); freqBag.add(Character.toLowerCase(letter)); } doesn't work(it doesn't return the correct frequency of the given character), and why this: int c; while((c = txtFile.read()) != -1){ Character letter = (char) c; freqBag.add(Character.toLowerCase(letter)); } works. I wrote the first one, and a friend helped me fix it.

http://stackoverflow.com/a/78851516
has body: In running, occurred wrong, which is "Failed to load native library 'ffsampledsp'. Please check your library path. FFSampledSP will be dysfunctional."
type: Answer
has comment: http://stackoverflow.com/comment/139052021
answers question: http://stackoverflow.com/q/25932983
score: 0

http://stackoverflow.com/comment/40638296
has text: @ZeferiniX I think using parenthesis is up to how much experience you have in programming :)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25956462

http://stackoverflow.com/comment/40762817
score: 0
type: AnswerComment
has text: ya i have realized it already i want to ask more question from the op :)
type: Comment
comment on: http://stackoverflow.com/a/26024579

http://stackoverflow.com/comment/40668387
type: AnswerComment
has text: How did you grab the location and store it in Parse?
type: Comment
comment on: http://stackoverflow.com/a/25966998
score: 1

http://stackoverflow.com/comment/40746566
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26015943
has text: @Sniper sadly it indeed can cause problem :(
score: 0

http://stackoverflow.com/comment/40692651
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25985892
score: 0
has text: After delete the current node, the `cursor` will point to which node? prev node or next node? you have to define this behaviour

http://stackoverflow.com/q/25948225
score: 0
has title: Multiple objects together JAVA Sockets
has comment: http://stackoverflow.com/comment/40624012
answer count: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: java
has comment: http://stackoverflow.com/comment/40638187
tagged with: http
type: Question
has body: I was experimenting with HTTP GET requests via JAVA sockets ( I know there are better libraries but isn't experiencing is the best way to learning) "Issuing multiple GET requests together" is the part I'm stuck with. I can write two lines (one for each) but how would I know if they were actually sent together (most probably they won't be as I've a multithreaded program)?

http://stackoverflow.com/q/25911090
accepted answer: http://stackoverflow.com/a/25911148
has comment: http://stackoverflow.com/comment/40557344
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40557151
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/40558255
has comment: http://stackoverflow.com/comment/40558143
favorite count: 0
has comment: http://stackoverflow.com/comment/40558065
has answer: http://stackoverflow.com/a/25911737
possible better answer: http://stackoverflow.com/a/25911142
has answer: http://stackoverflow.com/a/25911306
answer count: 5
has answer: http://stackoverflow.com/a/25911148
has answer: http://stackoverflow.com/a/25911142
has comment: http://stackoverflow.com/comment/40557415
has comment: http://stackoverflow.com/comment/40557194
tagged with: regex
has comment: http://stackoverflow.com/comment/40557373
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40557957
has body: Is there a regex that can be used for replacing only the two first commas in a String with another character? The reason why I need this is that I am working with RDF triples, where I need to handle the subject, predicate and object separately. So I split them into three separate parts using the String.split() method. This is an example of the Strings that I need to split: [http://dbpedia.org/resource/Tom_Mathisen, http://www.w3.org/2000/01/rdf-schema#comment, "Tom Mathisen (born 14 August 1952) is a Norwegian comedian, actor, screenwriter and musician. He usually handles bass, guitar and vocals. He was in the comedy group Prima Vera from 1976 to 1983 along with Jahn Teigen and Herodes Falsk. Later he continued to work with Herodes Falsk on many TV/scene shows and records."@en] For instance I want this String to look like this instead, so I can split using $: [http://dbpedia.org/resource/Tom_Mathisen$ http://www.w3.org/2000/01/rdf-schema#comment$ "Tom Mathisen (born 14 August 1952) is a Norwegian comedian, actor, screenwriter and musician. He usually handles bass, guitar and vocals. He was in the comedy group Prima Vera from 1976 to 1983 along with Jahn Teigen and Herodes Falsk. Later he continued to work with Herodes Falsk on many TV/scene shows and records."@en] I did it in a less elegant way: StringBuilder stringbuilder = new StringBuilder(str); int commaCounter = 0; for (int i = 0; i &lt; stringbuilder.length(); i++) { if (stringbuilder.charAt(i) == ',') { stringbuilder.setCharAt(i, '$'); commaCounter++; if (commaCounter == 2) { break; } } } str = stringbuilder.toString();
has answer: http://stackoverflow.com/a/25911158
upvote count: 1
has title: Replacing the first two commas of a string
has comment: http://stackoverflow.com/comment/40558138
has comment: http://stackoverflow.com/comment/40558201
type: Question
has comment: http://stackoverflow.com/comment/40557433

http://stackoverflow.com/a/26032669
has body: The file is located in the actual working directory of your application server. Do a System.out.println(new File("").getAbsolutPath()); and you'll find the location. However this is not a good idea to write files in web application like this, because first you never know where it is and second you never know whether you write privilege on it. You need to specify some filesystem root for your application by passing it as init-parameter and use it as parent for everything you need to do on the filesystem. Check this answer to a similar Question. You could then create your file like this: String fsroot = getServletContext().getInitParameter("fsroot") File ud = new File(fsroot, "user_details.txt"); FileWriter outFile = new FileWriter(ud, true);
accepted answer of: http://stackoverflow.com/q/26032311
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26032311
type: AcceptedAnswer

http://stackoverflow.com/comment/40619991
has text: post logcat error, as we don't know what error you get, we can't help you
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25945504

http://stackoverflow.com/comment/82259734
comment on: http://stackoverflow.com/a/25934435
type: AnswerComment
has text: @VladVerdes if it was helpful to you, consider upvoting the answer
score: 0
type: Comment

http://stackoverflow.com/a/25997612
has comment: http://stackoverflow.com/comment/40713658
has comment: http://stackoverflow.com/comment/40713781
score: 0
answers question: http://stackoverflow.com/q/25997365
type: Answer
has body: This question should definitely help you. You can find the element easily by id, then you just have to call the isSelected method.
has comment: http://stackoverflow.com/comment/40714094
has comment: http://stackoverflow.com/comment/40713349

http://stackoverflow.com/comment/40779557
type: QuestionComment
has text: Really? That is why i posted LogCat output. I try to find v.getId() in array id. id[0] and v.getId() are the same in LogCat....
comment on: http://stackoverflow.com/q/26033835
score: 0
type: Comment

http://stackoverflow.com/q/25874399
has answer: http://stackoverflow.com/a/25888319
accepted answer: http://stackoverflow.com/a/25888319
type: Question
has answer: http://stackoverflow.com/a/26000729
answer count: 2
tagged with: jpa
score: 4
linked to: http://stackoverflow.com/q/4288531
possible better answer: http://stackoverflow.com/a/26000729
tagged with: java-ee-6
upvote count: 4
has body: This question is very similar to: JPA (Hibernate, EclipseLink) mapping: why doesn&#39;t this code work (chain of 2 relationships using JPA 2.0, @EmbeddedId composite PK-FK)? Actually my only (from meaningful that I spotted) difference is that I use @IdClass and that I most probably won't be able to switch to a different provider than hibernate. but anyway here is the code (removed parts that where unimportant): PermissionContextType.java: @Entity @IdClass(PermissionContextTypePk.class) public class PermissionContextType{ @Id private String id; @Id @JoinColumn (name = "PROJECT", referencedColumnName = "ID") @ManyToOne () private Project project; public static class PermissionContextTypePk implements Serializable{ public String project; public String id; // ... eq and hashCode here ... } } PermissionContext.java: @Entity @IdClass(PermissionContextPk.class) public class PermissionContext{ @Id private String id; @Id @JoinColumns ({ @JoinColumn (name = "PROJECT", referencedColumnName = "PROJECT"), @JoinColumn (name = "PERMISSIONCONTEXTTYPE", referencedColumnName = "ID") }) @ManyToOne private PermissionContextType permissionContextType; public static class PermissionContextPk implements Serializable{ public String id; public PermissionContextTypePk permissionContextType; // ... eq and hashCode here ... } } Permission.java: @Entity @IdClass(PermissionPk.class) public class Permission{ @Id private String id; @Id @JoinColumns ({ @JoinColumn (name = "PROJECT", referencedColumnName = "PROJECT"), @JoinColumn (name = "PERMISSIONCONTEXTTYPE", referencedColumnName = "PERMISSIONCONTEXTTYPE"), @JoinColumn (name = "PERMISSIONCONTEXT", referencedColumnName = "ID") }) @ManyToOne private PermissionContext permissionContext; public static class PermissionPk implements Serializable{ public String id; public PermissionContextPk permissionContext; // ... eq and hashCode here ... } } and what I get is: org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when …
favorite count: 0
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate
has title: JPA 2 Hibernate mapping with composite key in primary key using @IdClass with 3 tier structure

http://stackoverflow.com/comment/40510523
has text: Nobody cann tell you why you have that parse error as there is nothing in your code that parses. And you did not tell from who you got that error. Do we have to guess?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25885119

http://stackoverflow.com/comment/77167683
type: Comment
has text: Another note: for me it doesn't work with Maven (-> exclude it there). Once Maven compiled the class with the switch, it's necessary to compile that class in Eclipse again to make the test work again in Eclipse. In other words the compiler plays an important role whether or not the test works.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25929937

http://stackoverflow.com/q/25965437
tagged with: java
has comment: http://stackoverflow.com/comment/40688823
downvote count: 1
type: Question
has title: Map JUL levels to AppEngine web console levels
tagged with: java.util.logging
has answer: http://stackoverflow.com/a/25972611
answer count: 2
has answer: http://stackoverflow.com/a/34108323
accepted answer: http://stackoverflow.com/a/25972611
favorite count: 0
possible better answer: http://stackoverflow.com/a/34108323
tagged with: google-app-engine
has body: The AppEngine web console allows filtering of different log levels: DEBUG INFO WARN ERROR CRITICAL AppEngine uses java.utils.logging (JUL) but JUL defines different log-levels to those used in the web console, namely: FINEST (lowest value) FINER FINE CONFIG INFO WARNING SEVERE (highest value) In code this means that logging at INFO or WARING works well. LOG.info("some info message); LOG.warning("some warn message"); NB I have /logging.properties with # Set the default logging level for all loggers .level = ALL But no log shows: from LOG.fine("some fine message); LOG.finer("some finer message); LOG.finest("some finest message); What code do I write to get logs to appear at DEBUG in the web console?
type: AnsweredQuestion
score: 2
upvote count: 3

vaadin
tags question: http://stackoverflow.com/q/25897036
tags question: http://stackoverflow.com/q/25998046
tag name: vaadin
tags question: http://stackoverflow.com/q/25990465
tags question: http://stackoverflow.com/q/25876095
type: Tag
tags question: http://stackoverflow.com/q/26032806
tags question: http://stackoverflow.com/q/26021985
tags question: http://stackoverflow.com/q/25897818
tags question: http://stackoverflow.com/q/25891244
tags question: http://stackoverflow.com/q/25979359
tags question: http://stackoverflow.com/q/25882934
tags question: http://stackoverflow.com/q/25910553

http://stackoverflow.com/q/25900611
has comment: http://stackoverflow.com/comment/40539024
favorite count: 0
accepted answer: http://stackoverflow.com/a/25901476
tagged with: android
has title: setOnInfoWindowClickListener for a Marker
upvote count: 1
has body: I've created a marker called "Pin" and I'm trying to get an activity/Class open when it's window is clicked. From what I have so far, the activity will open but when any marker's window is clicked. I want to get it to open when the marker Pin's window is clicked. The Class I wanted to open is "holyStone". private void holystone() { // TODO Auto-generated method stub LatLng pos = new LatLng(52.972869, -9.427004); Marker Pin = theMap.addMarker(new MarkerOptions() .title("Holy Stone of Clonrichert") .snippet("Holy Stone of Clonrichert has been upgraded to a class two relic by the Vatican.") .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)) .position(pos) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)) ); // below displays the window...remove this!!! //Pin.showInfoWindow(); Pin.isInfoWindowShown(); this.theMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() { @Override public void onInfoWindowClick(Marker Pin) { Intent intent = new Intent(MainActivity.this, holyStone.class); startActivity(intent); } }); Any suggestions would be great, Thanks for looking.
downvote count: 1
has comment: http://stackoverflow.com/comment/40538835
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25901476
tagged with: java
type: Question
score: 0
tagged with: google-maps
tagged with: google-maps-markers
answer count: 1

http://stackoverflow.com/q/25956597
tagged with: swing
tagged with: checkbox
has answer: http://stackoverflow.com/a/25956723
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has body: I have created a JTable with the last (6th) column being a "Select" column which is having checkboxes. The checkboxes are added by overriding the getColumnClass method to return Boolean.class. DefaultTableModel dtm = new DefaultTableModel(data, header){ @Override public Class&lt;?&gt; getColumnClass(int col) { if(col == 5){ return Boolean.class; } return super.getColumnClass(col); } }; Now I have to select some rows using these checkboxes and add some values from those selected rows to the database. This is the code I used. DefaultTableModel model = (DefaultTableModel) tblInvoiceList.getModel(); for(int i=0; i&lt;model.getRowCount();i++) { if ((Boolean)model.getValueAt(i, 5)) paydao.updateInvoiceWithPayment(model.getValueAt(i, 0).toString()); } When I loop through, the checked checkboxes are returning true. The unchecked ones are throwing NullPointerException. The exception occurs in the (Boolean)model.getValueAt(i, 5) part. How to make the unchecked ones return false??
type: Question
linked to: http://stackoverflow.com/q/17157915
has title: Unchecked checkbox in JTable gives NullPointerException
tagged with: jtable
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25956723
linked to: http://stackoverflow.com/q/7920068

http://stackoverflow.com/a/25963737
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40653871
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25963676
answers question: http://stackoverflow.com/q/25963676
has body: First, you need to print the list whenever counter hits a multiple of 20 as well as when it hits max. Then, after you print the contents of s, clear the list: s.clear(); That will remove all elements so it will fill up again. You also need to print the list after the for loop exits, otherwise the last few items will be left unprinted. Note that you are not using an array anywhere in this code. It's not clear that you are following the spirit of the assignment by using a LinkedList. But only you know what the rubric is.
upvote count: 1

http://stackoverflow.com/q/26022047
has comment: http://stackoverflow.com/comment/40758635
has answer: http://stackoverflow.com/a/26022240
has answer: http://stackoverflow.com/a/26028818
downvote count: 0
has answer: http://stackoverflow.com/a/26022596
answer count: 3
has title: Get language from UTF8
tagged with: utf-8
has body: I have several utf8 strings and need to find out the language based on the characters used. It is not important to distuingish between language using the latin alphabet like German, Dutch and English. The language that occur are arabic, korean, chinese, japanese, i.e. language with a definite character set. The strings itself are names in most cases and it can be assumed that the first character is enough for recognition.
has comment: http://stackoverflow.com/comment/40757984
favorite count: 0
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40758669
type: Question

http://stackoverflow.com/q/25904181
score: 0
answer count: 2
tagged with: contains
has answer: http://stackoverflow.com/a/25904233
tagged with: arraylist
has answer: http://stackoverflow.com/a/25904239
tagged with: android
has comment: http://stackoverflow.com/comment/40545195
has body: In my code when i use myarraylist.contains(myobject) it should check only for few proporties of myobject how to do it? one of my object properties changes time to time i dont want to consider that property but it should be that object
has title: How to check only for few properties Arraylsit.Contains(Object) method should return true?
type: AnsweredQuestion
type: Question
tagged with: object
possible better answer: http://stackoverflow.com/a/25904239
accepted answer: http://stackoverflow.com/a/25904233
tagged with: java
has comment: http://stackoverflow.com/comment/40545024
has comment: http://stackoverflow.com/comment/40545038

http://stackoverflow.com/comment/40810482
type: QuestionComment
has text: @DavidGilbert may have some insight; in the interim, please edit your question to include a [complete example](http://stackoverflow.com/help/mcve).
type: Comment
comment on: http://stackoverflow.com/q/26030886
score: 0

http://stackoverflow.com/comment/40644194
has text: @Carmine: try it and see.
comment on: http://stackoverflow.com/q/25959817
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25999612
tagged with: java
has answer: http://stackoverflow.com/a/25999772
type: Question
tagged with: encoding
has comment: http://stackoverflow.com/comment/40717062
tagged with: character-encoding
answer count: 3
downvote count: 0
tagged with: utf-8
has body: my code(Qwe.java) public class Qwe { public static void main(String[] args) { System.out.println("тест привет"); } } where тест привет is russian words Qwe.java in UTF-8 on my machine(ubuntu 14.04) result is тест привет on server(ubuntu 12.04) I have: ???? ?????? $java Qwe > test.txt in test.txt is see ???? ??????
favorite count: 0
has comment: http://stackoverflow.com/comment/40716939
has answer: http://stackoverflow.com/a/26001203
has title: Java program doesn't print cyrillic characters, but only question marks
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25999885
score: 3
upvote count: 3

http://stackoverflow.com/comment/40586453
has text: You should use enhanced for loops because you have 1 indexed loops right now.
comment on: http://stackoverflow.com/q/25926718
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40547456
score: 1
has text: Also check out this: [Why not use Double or Float to represent currency?](https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25905519

http://stackoverflow.com/q/25962599
answer count: 1
accepted answer: http://stackoverflow.com/a/25962727
has title: How to determine the direction of a Linked List
favorite count: 0
has comment: http://stackoverflow.com/comment/40649697
tagged with: singly-linked-list
type: AnsweredQuestion
tagged with: linked-list
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I have to make a linked list that adds to itself to the left so I'm thinking it's something like this where the boxes are nodes and the arrow is the link: tail [] &lt;- [] &lt;- [] &lt;- ... [] head But how do you determine the direction of the linked list when you are adding the second node? How do you know which side it's going to be placed on? 2nd? 1st 2nd? [] [] [] For example this code: head = new IntNode(5,head) would add to the right if the linked list is like this: head tail [] -&gt; [] -&gt; [] -&gt; [] But that's only when adding to an already made list with that format, so which side will it start from when creating a new linked list?
upvote count: 1
has answer: http://stackoverflow.com/a/25962727

cordova-plugins
tags question: http://stackoverflow.com/q/25874590
type: Tag
tag name: cordova-plugins

http://stackoverflow.com/q/25917195
type: Question
answer count: 2
has title: GraphViz, Zest, JUNG2 et cetera for Java
downvote count: 0
has answer: http://stackoverflow.com/a/25934912
favorite count: 0
has body: Firstly, my goal is to use a library ONLY for laying out nodes in a JavaFx application, so that the size of the node (or box, in my case) is taken in account in laying out. I tried JUNG2, but wasn't very impressed by it's layout methods.. I would've needed to write one myself to have the results I wanted, which is precisely what I am trying to avoid (because I'm probably not smart enough to write a good one..). So, now I am looking at GraphViz and Zest. GraphViz looks like a very impressive and complex beast. Zest looks interesting too, but how Eclipse-centric is it? Can I use this in a JavaFx application? Are there others out there? What would you recommend in my case?
score: 2
has answer: http://stackoverflow.com/a/40281200
upvote count: 2
type: UnansweredQuestion
tagged with: zest
tagged with: graph
tagged with: java
tagged with: graphviz

http://stackoverflow.com/a/26009965
score: 5
answers question: http://stackoverflow.com/q/26009879
type: AcceptedAnswer
downvote count: 0
has body: No, they are not the same. List&lt;? extends Element&gt; could be a List&lt;ExtraElement&gt; or it could be a List&lt;Element&gt;, but the compiler cannot know which one it is. If it is a List&lt;ExtraElement&gt;, you cannot add a SomeNonExtraElement into the list, for example (but you can add a SomeNonExtraElement into a List&lt;Element&gt;). To enforce this, the compiler won't let you add anything to a List&lt;? extends Something&gt;.
type: Answer
has comment: http://stackoverflow.com/comment/40817014
upvote count: 5
has comment: http://stackoverflow.com/comment/40770800
accepted answer of: http://stackoverflow.com/q/26009879

http://stackoverflow.com/comment/130704044
has text: My automated test exhibits the 2nd level cache issue with READ_WRITE *and* NONSTRICT_READ_WRITE CacheConcurrencyStrategy. See https://github.com/reda-alaoui/ro-rw-routing/blob/non-strict-read-write-cache/src/test/java/me/redaalaoui/ro_rw_routing/RoRwRoutingApplicationTests.java for NONSTRICT_READ_WRITE test.
comment on: http://stackoverflow.com/a/26026237
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26021372
has title: Communicating between Android and NativeActivity
has answer: http://stackoverflow.com/a/26021836
tagged with: ogre
has body: I am working on an android app where I have a 3D part with most of the app's functionallity written in C++ using ogre. Some features (like the UI for search etc) are implemented using normal android UI. Up until now I used JNI for communicating between those two and directly started the rendering thread from java and managed it from there. However this leeds to some very messy code. Now Ive stumbled across NativeActivity with its own thread and really like it. However - I still need to initiate some procedures in the rendering engine from java and the other way around. For this I would like to be able to send events to the native code that are handled like sensor event in the NativeActivity's thread. To initiate Java procedures from C++ I could simply perform JNI calls and post them on the UI thread (im open for sugestions if anyone has a better idea). So the main question is: Is there a way I can (in Java) pass the NativeActivity some event-like objects that are then handled in my main native loop inside the NativeActivity using C code? Thanks in advance!
type: Question
tagged with: android
score: 0
tagged with: java
tagged with: multithreading
answer count: 1
tagged with: android-ndk
type: UnansweredQuestion

http://stackoverflow.com/comment/40574083
type: Comment
type: QuestionComment
has text: Remove the `{}` from your case statements.
score: 3
comment on: http://stackoverflow.com/q/25919840

http://stackoverflow.com/comment/40550704
comment on: http://stackoverflow.com/q/25906092
score: 0
type: Comment
type: QuestionComment
has text: I looked at JAXB but I don't understand how I should do this. The tutorial talks about schemas but I don't have any schemas I just get a file like the one above. How do I map that file to a bean? The file is about 15kB so it's not a large file, it's just many files.

http://stackoverflow.com/comment/45892646
type: AnswerComment
has text: Discussion in github if anyone wants to read it: https://github.com/aws/aws-sdk-android-v1/issues/20
type: Comment
comment on: http://stackoverflow.com/a/25977343
score: 0

http://stackoverflow.com/comment/40672586
has text: That'll work for the sample input, but will cause trouble if there are spaces in the city names. "New York,NY", for instance, will break it.
type: AnswerComment
score: 4
type: Comment
comment on: http://stackoverflow.com/a/25975384

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

http://stackoverflow.com/q/25967481
accepted answer: http://stackoverflow.com/a/25967850
answer count: 2
upvote count: 1
tagged with: swing
has body: this has been bugging me for a while but i just can't seem to figure out what i'm doing wrong. So i'm setting the background of a pannel with image Icon but when i resize the window it leave the BG at the same size and i get this huge white wall around the exposed edge, i'd like to stretch the bg as the window changes here's my relevant code protected JPanel createRightPane() { final ImageIcon BGiconSM = ScaledImageIcon("parchmentTall.jpg", "BG Plate", initalWidth/2, initalHeight); final ImageIcon iconSM = ScaledImageIcon("titlebar.png", "Title Bar BG", (initalWidth/3), 40); //TODO Parchment image resize final JPanel content = new JPanel(new GridBagLayout()); content.setOpaque(false); final JPanel panel = new JPanel(new BorderLayout()) { protected void paintComponent(Graphics g) { // Dispaly image at full size Image BGicon = BGiconSM.getImage(); g.drawImage(BGicon, 0, 0, null); super.paintComponent(g); } }; panel.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e){ Rectangle r = frame.getBounds(); int h = r.height; int w = r.width; if (h &gt;= initalHeight){h = initalHeight-30;} //System.out.println(h); //System.out.println(w); /* protected paintComponent(Graphics g) { // Dispaly image at full size Image BGicon = BGiconSM.getImage(); g.drawImage(BGicon, 0, 0, null); super.paintComponent(g); } */ } });
has title: Resize ImageIcon on window Resize
linked to: http://stackoverflow.com/q/14115950
tagged with: java
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25967527
linked to: http://stackoverflow.com/q/25786708
tagged with: imageicon
type: Question
has answer: http://stackoverflow.com/a/25967850
tagged with: paintcomponent
possible better answer: http://stackoverflow.com/a/25967527
linked to: http://stackoverflow.com/q/11959758

http://stackoverflow.com/q/26021400
type: Question
tagged with: oracle-database
upvote count: 1
answer count: 1
has title: mySQL Driver class not found in JDeveloper 11g
favorite count: 0
has body: In testing an existing Oracle SOA Composite using Oracle JDeveloper 11g Release 1 (11.1.1.7.0). When I try to test one of the connections to the mySQL database I see this error: "Test failed: Driver class not found. Verify the Driver location". I have added the mySQL Library in JDeveloper and pointed it to the JAR file as pointed out here:JDeveloper MySQL error Driver not found I also ran through the steps to outline adding the JAR here:http://jdev11g.blogspot.com/2009/04/oracle-jdeveloper-11g-with-mysql.html I have tried mapping the library to the JAR as well as moving the JAR under JDeveloper in C:\Oracle\Middleware\jdeveloper\jdev\lib and mapping it there. When I go to the Database Navigator and try to connect I get an Error encountered alert stating "An error was encountered performing the requested operation: Driver class not found. Verify the Driver location Vendor code 0." Thanks, Tom Henricksen
linked to: http://stackoverflow.com/q/15314453
tagged with: jdeveloper
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26041148
accepted answer: http://stackoverflow.com/a/26041148
tagged with: mysql
tagged with: oracle11g

http://stackoverflow.com/q/25969036
tagged with: java
accepted answer: http://stackoverflow.com/a/25969235
type: Question
score: 3
linked to: http://stackoverflow.com/q/863838
tagged with: properties-file
answer count: 2
downvote count: 0
tagged with: jsp
possible better answer: http://stackoverflow.com/a/25969154
favorite count: 0
has answer: http://stackoverflow.com/a/25969154
has body: In my Java/Spring web application i had problem printing special characters of italian language (ò,à,è etc.) that I retrieve from a properties file. I found this article http://docs.oracle.com/cd/E26180_01/Platform.94/ATGProgGuide/html/s1816convertingpropertiesfilestoescap01.html. But something is not clear: after I run the command written in the article, in my console (CMD console of windows) i can read my properties file "translated". After it, what should i do? Should I copy the texts from the windows console and paste them into my properties file? It doens't seem a "professional" work!
tagged with: spring
tagged with: properties
has answer: http://stackoverflow.com/a/25969235
type: AnsweredQuestion
has title: Special characters in properties file
has comment: http://stackoverflow.com/comment/40661572
upvote count: 3

http://stackoverflow.com/comment/40618593
has text: I guess I could just do files[files.length + 1] = filepath; ... ;)
comment on: http://stackoverflow.com/q/25944608
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25978510
tagged with: string
has comment: http://stackoverflow.com/comment/40678661
has comment: http://stackoverflow.com/comment/40678665
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/40678925
answer count: 1
has comment: http://stackoverflow.com/comment/40678697
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
has title: Why does == return true for a String comparison?
type: UnansweredQuestion
has body: I have previously asked a question about comparing 2 strings and was told that I should always use .equals. However, I do not understand why this then works: String y= "Mary"; String x= "Mary"; System.out.print(x==y); This will print true, and I do not understand why.
downvote count: 2
linked to: http://stackoverflow.com/q/2486191
has answer: http://stackoverflow.com/a/25978541
tagged with: java
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/40678927
score: -2

http://stackoverflow.com/q/25960847
accepted answer: http://stackoverflow.com/a/25964806
has comment: http://stackoverflow.com/comment/40652166
favorite count: 0
possible better answer: http://stackoverflow.com/a/25961949
tagged with: postgresql
upvote count: 3
has answer: http://stackoverflow.com/a/25961949
has comment: http://stackoverflow.com/comment/40658986
has title: Hibernate schema generation bug with multiple maps and same value type?
tagged with: jakarta-ee
type: AnsweredQuestion
score: 3
downvote count: 0
has body: Hibernate (Core {4.2.7.SP5-redhat-1}, using dialect PostgreSQL82Dialect) is generating a schema I don't understand, and it is failing when I think it shouldn't. The exception I'm getting is ERROR: ERROR: null value in column "aggregategroupmap_id" violates not-null constraint Detail: Failing row contains (1, 2, BILLPROGRESS, null, null). Which is true since I didn't attempt to insert anything into the other column. I don't think I should have to because the columns refer to two different Maps. This is my main MyClass class. import java.io.Serializable; import java.util.*; import javax.persistence.*; @SuppressWarnings("serial") @Entity public class MyClass implements Serializable { @Id @GeneratedValue private Long id; @OneToMany(cascade={CascadeType.ALL}) private Map&lt;String, GroupInfo&gt; aggregateGroupMap; @OneToMany(cascade={CascadeType.ALL}) private Map&lt;String, GroupInfo&gt; computationGroupMap; public MyClass() { aggregateGroupMap = new TreeMap&lt;String, GroupInfo&gt;(); computationGroupMap = new TreeMap&lt;String, GroupInfo&gt;(); } public Map&lt;String, GroupInfo&gt; getAggregateGroupMap() { return aggregateGroupMap; } public Map&lt;String, GroupInfo&gt; getComputationGroupMap() { return computationGroupMap; } } This is a second class, referenced by the first class. import java.io.Serializable; import java.util.*; import javax.persistence.*; @SuppressWarnings("serial") @Entity public class GroupInfo implements Serializable { @Id @GeneratedValue private Long id; @ElementCollection @OrderColumn private List&lt;String&gt; groupLabels; @ElementCollection @OrderColumn private List&lt;String&gt; groupDescriptions; public GroupInfo() { groupLabels = new ArrayList&lt;String&gt;(); groupDescriptions = new ArrayList&lt;String&gt;(); } public List&lt;String&gt; getGroupLabels() { return groupLabels; } public List&lt;String&gt; getGroupDescriptions() { return groupDescriptions; } } This class attempts to persist Objects: import java.util.*; import javax.persistence.…
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25964806
tagged with: jpa

http://stackoverflow.com/q/25897722
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40537140
tagged with: java
has answer: http://stackoverflow.com/a/44554479
accepted answer: http://stackoverflow.com/a/25905841
has comment: http://stackoverflow.com/comment/40545361
type: Question
tagged with: mongodb
answer count: 2
has title: No converter found capable of converting from type org.bson.types.ObjectId to type int
downvote count: 0
possible better answer: http://stackoverflow.com/a/44554479
favorite count: 0
has answer: http://stackoverflow.com/a/25905841
has body: I am using Spring data and mongodb to get all Products using this function: @Repository public class ProductDao { @Autowired private MongoOperations mongoOperations; public List&lt;Product&gt; getAll() { return mongoOperations.findAll(Product.class); } } My product class: @Document(collection = Product.COLLECTION_NAME) public class Product implements Serializable { public Product() { } public static final String COLLECTION_NAME = "product"; @Id private String _id; private String name; private DateTime date_time; private int fk_properties; private List&lt;Integer&gt; fk_parts; } Error: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type org.bson.types.ObjectId to type int How to fix it? UPDATE: I do have spring-core-4.1.0.RELEASE.jar in lib folder which suppose to include required converter. UPDATE 2: Document { "_id" : ObjectId("5449567cdf97f277c50d1ce2"), "name" : "2014 ISF", "auction_start" : ISODate("2014-12-08T12:00:00.000+0200"), "auction_end" : ISODate("2014-12-08T14:00:00.000+0200"), "listed" : "F", "fk_product_property" : ObjectId("5229567cdf97f277c50d1ce2"), "fk_parts" : [ ObjectId("5339567cdf97f277c50d1ce2"), ObjectId("5349567cdf97f277c50d1ce2") ] }
upvote count: 2
has comment: http://stackoverflow.com/comment/40536606
tagged with: spring-data-mongodb

reflection
tags question: http://stackoverflow.com/q/25873945
tags question: http://stackoverflow.com/q/26013116
tags question: http://stackoverflow.com/q/25999185
tags question: http://stackoverflow.com/q/25906480
tags question: http://stackoverflow.com/q/25995551
tags question: http://stackoverflow.com/q/25994511
tags question: http://stackoverflow.com/q/25898724
tags question: http://stackoverflow.com/q/25878531
type: Tag
tags question: http://stackoverflow.com/q/25911713
tags question: http://stackoverflow.com/q/25922423
tags question: http://stackoverflow.com/q/25967441
tags question: http://stackoverflow.com/q/25905699
tags question: http://stackoverflow.com/q/25981712
tags question: http://stackoverflow.com/q/26005924
tags question: http://stackoverflow.com/q/25953864
tags question: http://stackoverflow.com/q/25944301
tags question: http://stackoverflow.com/q/25947376
tags question: http://stackoverflow.com/q/25937872
tag name: reflection
tags question: http://stackoverflow.com/q/25909701

http://stackoverflow.com/q/25887073
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40513931
has comment: http://stackoverflow.com/comment/43914370
has comment: http://stackoverflow.com/comment/44239460
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I am new to maven, I am getting an error while running a maven project. I am using maven version 3. Exception in thread "pool-1-thread-1" java.lang.NoSuchMethodError: org.apache.http.impl.client.AbstractHttpClient.execute(Lorg/apache/http/HttpHost;Lorg/apache/http/HttpRequest;Lorg/apache/http/protocol/HttpContext;)Lorg/apache/http/client/methods/CloseableHttpResponse; at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:167) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1281) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1198) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:307) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:376) at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:477) at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:466) at com.qburst.saleschannel.core.driver.Driver.loadUrl(Driver.java:86) at com.qburst.saleschannel.core.page.Page.fetchPage(Page.java:63)!! Scraping Gumtree for .NET !! - 2:53:21 PM at com.qburst.saleschannel.core.page.Page.getRootElement(Page.java:138) at com.qburst.saleschannel.core.script.WebPage.addOperation(WebPage.java:30) at com.qburst.saleschannel.core.crawlers.FreelancerCrawler.login(FreelancerCrawler.java:50) at com.qburst.saleschannel.core.crawlers.FreelancerCrawler.crawl(FreelancerCrawler.java:75) at com.qburst.saleschannel.core.crawlers.BaseCrawler.run(BaseCrawler.java:33) at java.lang.Thread.run(Thread.java:745) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Thanks in advance
tagged with: maven
upvote count: 1
has comment: http://stackoverflow.com/comment/40524509
has title: getting error java.lang.NoSuchMethodError: org.apache.http.impl.client.AbstractHttpClient.execute
answer count: 0
has comment: http://stackoverflow.com/comment/40513964
score: 1

http://stackoverflow.com/a/25999465
score: 22
upvote count: 22
answers question: http://stackoverflow.com/q/25999255
type: Answer
has comment: http://stackoverflow.com/comment/40716573
has body: Using scala IO import scalax.file.Path val path = Path.fromString("/tmp/testfile") try { path.deleteRecursively(continueOnFailure = false) } catch { case e: IOException =&gt; // some file could not be deleted } or better, you could use a Try val path: Path = Path ("/tmp/file") Try(path.deleteRecursively(continueOnFailure = false)) which will either result in a Success[Int] containing the number of files deleted, or a Failure[IOException].
downvote count: 0

http://stackoverflow.com/a/26016732
answers question: http://stackoverflow.com/q/26015240
upvote count: 8
type: Answer
score: 8
accepted answer of: http://stackoverflow.com/q/26015240
type: AcceptedAnswer
downvote count: 0
has body: If you look at your schema locations you will notice the line containing http://www.springframework.org/schema/security. This line breaks the expected format, the format should be [namespace] [xsd-location]. This line basically is messing up a proper format. To solve this either add a xsd location or remove the line. To prevent this I generaly follow the format also in the layout of the xsi:schemaLocation attribute (if you format accordingly it is quite apparent that that part is missing).. xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"&gt; As an additional tip it is recommended to use the versionless xsd files so instead of spring-beans-4.0.xsd use spring-beans.xsd. xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;

http://stackoverflow.com/q/25944301
accepted answer: http://stackoverflow.com/a/25944315
tagged with: java
type: Question
has body: If I'm only given a field instance from a class, without further knowledge about the class that declares that field, is it possible to get an instance of the declaring (outer) class? For instance, consider the following class structure. class A { static final Tclass t = Tclass.create(); } Now, in some other function, we are only given t (Tclass instance). Is it possible to use reflection in some way to grab the outer/declaring class (class A) that holds t?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: reflection
has title: Get Class representing the class that declares a field
score: 1
has answer: http://stackoverflow.com/a/25944315
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/26026697
has body: I can't speak to the different sync states you're getting with Exchange 2010 and Exchange 2013, but one workaround would be to use notifications to trigger your sync calls. So if you subscribe to NewMailEvents, for example, the notification will identify the ParentFolderId, and then you can sync just the items in that folder. There's more about notification-based synchronization in these two topics: Notification subscriptions, mailbox events, and EWS in Exchange and Mailbox synchronization and EWS in Exchange.
answers question: http://stackoverflow.com/q/26019603
has comment: http://stackoverflow.com/comment/40767245
score: 0
has comment: http://stackoverflow.com/comment/40774076
has comment: http://stackoverflow.com/comment/40767665
type: Answer

http://stackoverflow.com/a/25873711
has comment: http://stackoverflow.com/comment/109896978
has comment: http://stackoverflow.com/comment/106540453
accepted answer of: http://stackoverflow.com/q/25873636
has body: Your regex would be, (?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d) This will match both "20:30:30" and "2020-05-29 20:30:30 -0600". DEMO If you want to only match Strings that are exclusively 24-hour times, use the following: ^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$ This will match only "20:30:30" and not "2020-05-29 20:30:30 -0600". DEMO Java regex would be, (?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d) And for exclusively 24-hour Strings, ^(?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d)$
has comment: http://stackoverflow.com/comment/106299323
type: Answer
has comment: http://stackoverflow.com/comment/40489676
has comment: http://stackoverflow.com/comment/106509239
score: 20
upvote count: 20
downvote count: 0
answers question: http://stackoverflow.com/q/25873636
has comment: http://stackoverflow.com/comment/40489837
has comment: http://stackoverflow.com/comment/109896506
type: AcceptedAnswer

http://stackoverflow.com/q/26028625
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40777075
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40789085
tagged with: libgdx
has body: So, I'm farely new to programming this is my first game, and I have been working on it for a while, for one of my classes and I'm creating a pong game just changed it up a bit and I'm having trouble moving my paddle from the left to the center everytime I change the the percentage of the width of the screen to move it for some reason it elevates the paddle by all almost the same. Also everything is controlled by the width for some bizarre reason its almost like the field.height has no effect on moving it? I'm stuck right here and I'm so close to finishing it I'm trying to lower the paddle to the bottom center? any help would really be appreciated and hopefully this makes sense. here is the field @Override public void create () { field.set(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); fieldLeft = field.x; fieldRight = field.x + field.width; fieldBottom = field.y; fieldTop = field.y + field.height; and here is the paddle movement private void resetRectangle(){ paddle1.move(field.x + (field.width * .5f, 0); paddle2.move(0,0); } and the class public class Paddle extends GameShare{ private ShapeRenderer paddleRenderer; protected Paddle() { super(100, 32); } public void paddleCreate(){ paddleRenderer = new ShapeRenderer(); } public void paddleRender(float dt){ paddleRenderer.begin(ShapeType.Filled); drawPaddle(dt); paddleRenderer.end(); } private void drawPaddle(float dt) { paddleRenderer.rect(this.getX(), this.getX(), this.getWidth(), this.getHeight()); paddleRenderer.rect(this.getX(), this.getX(), this.getWidth(), this.getHeight()); }
has title: libgdx - moving an object
upvote count: 1
tagged with: android
favorite count: 0

http://stackoverflow.com/comment/75290793
type: AnswerComment
score: 0
has text: Why no to use `WeekFields.SUNDAY_START`?
type: Comment
comment on: http://stackoverflow.com/a/25915611

http://stackoverflow.com/a/25944028
accepted answer of: http://stackoverflow.com/q/25943701
score: 2
has body: That's simple: The joiner joins, and you get a string without terminating '\n'. first \n second \n third (no \n) Then you add an empty String, and it just makes the last line terminated: first \n second \n third \n (nothing) (no \n) You must add another "" to get an empty line. first \n second \n third \n (nothing) \n (nothing) (no \n) You could use a function appending newline instead of the joiner, but this is longer (at least with Java &lt; 8) and slower due to extraneous string creation.
upvote count: 2
has comment: http://stackoverflow.com/comment/40617782
answers question: http://stackoverflow.com/q/25943701
has comment: http://stackoverflow.com/comment/40617683
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40617718
type: Answer

http://stackoverflow.com/comment/40682192
type: AnswerComment
comment on: http://stackoverflow.com/a/25941364
has text: All you need to do now is to fill the fields of your Document class. For example: `Document document = new Document(); document.setField("title", title);`
type: Comment
score: 0

http://stackoverflow.com/comment/40697621
comment on: http://stackoverflow.com/q/25988851
has text: Have a look at this. http://stackoverflow.com/questions/15410096/no-provider-classes-found-when-running-jersey-rest-example-application
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25991822
has title: How to pass values between fragments while using a viewpager in android
possible better answer: http://stackoverflow.com/a/25992194
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25992213
downvote count: 0
tagged with: android-fragments
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25992065
accepted answer: http://stackoverflow.com/a/25992065
type: Question
has answer: http://stackoverflow.com/a/25992194
has body: I am creating a sign up form which has been divided into three fragments.The three fragments are connected by a viewpager.I can traverse throught the fragments with next and previous buttons.I want the data from the first and second fragment to be available in the third fragment.One option is to use sharedpreferences.Is there any other approach. The main class: package pl.looksok.viewpagerdemo; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; public class MainActivity extends FragmentActivity { ViewPager pager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MyPagerAdapter pageAdapter = new MyPagerAdapter(getSupportFragmentManager()); pager = (ViewPager)findViewById(R.id.myViewPager); pager.setAdapter(pageAdapter); } public void selectFragment(int position){ pager.setCurrentItem(position, true); // true is to animate the transaction } } The main xml <pl.looksok.viewpagerdemo.CustomViewPager android:id="@+id/myViewPager" android:layout_width="match_parent" android:layout_height="match_parent" /> The first fragment: package pl.looksok.viewpagerdemo; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.RelativeLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; public class FragmentBlue extends Fragment { Button btnnext1; RelativeLayout frag1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragm…
answer count: 3
upvote count: 1
tagged with: android
favorite count: 0

http://stackoverflow.com/a/25881747
score: 0
has body: Try below Alphanumeric regex "^[a-zA-Z0-9]$" ^ - Start of string [a-zA-Z0-9] - multiple characters to include $ - End of string
type: Answer
answers question: http://stackoverflow.com/q/25881697
has comment: http://stackoverflow.com/comment/40504710

http://stackoverflow.com/a/25991322
type: Answer
accepted answer of: http://stackoverflow.com/q/25989588
answers question: http://stackoverflow.com/q/25989588
has body: According to @Francois-Xavier Laviron's solution, you can solve your problem like this: public double usedFuel(String AccountID, String DeviceID, long time, double fuel){ Double useFuel = 0.0; try{ useFuel = Double.parseDouble(fuelLevelStart(AccountID, DeviceID, time)) - Double.parseDouble(fuelLevelEnd(AccountID, DeviceID, time, fuel)); System.out.printf(" ",useFuel); } catch(Exception e){ } return useFuel; } if you keep String in your methods.
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40875157
type: AnswerComment
comment on: http://stackoverflow.com/a/26015492
type: Comment
score: 1
has text: What would you do in case of a thousands references? You have to go through all of them as you don't know which one gets cleared. You have to do it all the time as you don't know when GC happens. But yes, I can imagine that it can be useful in some scenarios (few costly resources to be cleared ASAP).

http://stackoverflow.com/comment/40720382
has text: This is assuming setMorning is in the Day class.
type: Comment
comment on: http://stackoverflow.com/a/26001419
score: 0
type: AnswerComment

http://stackoverflow.com/comment/134857259
has text: I have no idea, this question is almost 9 years old
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26010220

http://stackoverflow.com/comment/40538913
type: Comment
comment on: http://stackoverflow.com/q/25894957
score: 0
has text: Making the root class Myroot be a static class makes it work.
type: QuestionComment

http://stackoverflow.com/comment/40542094
comment on: http://stackoverflow.com/q/25902481
score: 0
type: Comment
has text: @5gon12eder is it because in ar ={1,2,3} memory is already allocated for ar and no need to use new[]?
type: QuestionComment

http://stackoverflow.com/comment/40493105
type: Comment
has text: I have posted the wrong code for the mainactivity im sorry!
comment on: http://stackoverflow.com/a/25875349
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40531386
has text: But then I still need to pass that along in my business objects. If that is what needs to happen I can live with it, but it just feels wrong sending Android objects to POJs, ya know?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25896722
type: AnswerComment

http://stackoverflow.com/comment/40628859
has text: Not a problem, don't feel dumb, the internet is unforgiving. IMHO the question is valid within a certain context, albeit very basic. Not sure what IDE you are using in class but the compiler doesn't lie (most of the time). An IDE can help you in these cases. If you are not using an IDE you should get yourself familiar with eclipse or something and go through the tutorials. Good luck.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25951445
type: AnswerComment

http://stackoverflow.com/q/25947892
score: 0
has answer: http://stackoverflow.com/a/25949735
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40624005
has comment: http://stackoverflow.com/comment/40623419
has title: List of numbers component on Swing
has comment: http://stackoverflow.com/comment/40623984
has comment: http://stackoverflow.com/comment/40623395
tagged with: swing
has comment: http://stackoverflow.com/comment/40623392
downvote count: 1
type: AnsweredQuestion
tagged with: jspinner
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25949735
has body: I want to show the same as the input type number of HTML5 but on Swing. This image illustrate what I want to do: and the number is going from 0 to 999 for example How can I make the same using Java Swing?
answer count: 1
has comment: http://stackoverflow.com/comment/40623429
has comment: http://stackoverflow.com/comment/40623352

http://stackoverflow.com/comment/43735677
comment on: http://stackoverflow.com/q/25882594
has text: I am not experienced in ejabberd but possibly [this answer](http://stackoverflow.com/a/27659800/2111944) might help you.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40542173
comment on: http://stackoverflow.com/q/25902545
score: 0
has text: Nothing is causing me trouble, it works, and I just recently added a default statement to it, that I forgot earlier. I want to understand why the 'null' statement works the way it does.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40554736
comment on: http://stackoverflow.com/q/25909649
score: 0
type: QuestionComment
has text: p2 and p1 refer to the same object so when you increment the x coordinate of p1, p2.x will also be incremented
type: Comment

http://stackoverflow.com/comment/43432971
comment on: http://stackoverflow.com/a/26975794
score: 0
type: AnswerComment
type: Comment
has text: Why are you answering if you don't know if it works?

http://stackoverflow.com/comment/40777542
type: Comment
has text: Thanks.. Does instagram feed give us the photo count for the place?
comment on: http://stackoverflow.com/a/25986157
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40576890
has text: Use csv (Comma Separated Values)
score: 0
comment on: http://stackoverflow.com/q/25921275
type: QuestionComment
type: Comment

android-context
tags question: http://stackoverflow.com/q/25979914
tag name: android-context
type: Tag

http://stackoverflow.com/a/50705589
type: Answer
answers question: http://stackoverflow.com/q/26003352
has body: I had similar problem, my standalone java program was not working. I had other compilation error in my workspace in other unrelated java files. After removing all compilation errors I could run my standalone java program.
score: 0

http://stackoverflow.com/q/25913127
tagged with: sshd
answer count: 0
upvote count: 3
type: UnansweredQuestion
type: Question
has body: I want to create java application, that will be my custom sshd server. Clients should be able to create tunnels to this server. Now I have this working example: import org.apache.sshd.SshServer; import org.apache.sshd.common.ForwardingFilter; import org.apache.sshd.common.Session; import org.apache.sshd.common.SshdSocketAddress; import org.apache.sshd.server.PasswordAuthenticator; import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; import org.apache.sshd.server.session.ServerSession; import java.io.IOException; public class Test { public static void main(String[] args) throws IOException { // create default server SshServer server = SshServer.setUpDefaultServer(); server.setPasswordAuthenticator(new PasswordAuthenticator() { @Override public boolean authenticate(String username, String password, ServerSession session) { return true; // auth everyone } }); server.setPort(2222); // allow forwarding server.setTcpipForwardingFilter(new ForwardingFilter() { @Override public boolean canForwardAgent(Session session) { return true; } @Override public boolean canForwardX11(Session session) { return true; } @Override public boolean canListen(SshdSocketAddress address, Session session) { return true; } @Override public boolean canConnect(SshdSocketAddress address, Session session) { return true; } }); // random hostkey provider server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey")); server.start(); // start server } } At this moment, I have minimal sshd server. When running, one can build tunnel to it: ssh user@host -p 2222 -R port:host:port -N The problem is, user can't create tunnel to the same port twice. First connection is successful, but after tunnel disconnect &amp; reconnect server says, that port is already in use. Second problem is that connection is unavailable through external IP. For example, server is 192.168.1.10. Client builds tunnel to server and forwards port 2020. Now, nmap -p 2020 localhost will say, that port is open…
tagged with: java
tagged with: apache
downvote count: 0
favorite count: 0
score: 3
has title: Java Apache sshd tunnel

http://stackoverflow.com/comment/40557867
type: Comment
comment on: http://stackoverflow.com/q/25911428
has text: Joda-time broke up with hibernate and hibernate is seeing jadira from the time it turned 4, just in case this helps.
score: 0
type: QuestionComment

http://stackoverflow.com/a/31958809
answers question: http://stackoverflow.com/q/26003352
has body: If all the solution does not work for you, it may be caused by missing libraries: Right click your project, Build Path --&gt; Configure Build Path --&gt; Java Build Path --&gt; Libraries Remove the missing libraries Go to your main class and run it
type: Answer
upvote count: 13
downvote count: 1
score: 12

http://stackoverflow.com/comment/40537904
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25898723
score: 0
has text: You could generate sample data, rather than maintaining test files. Currently there's nothing in your question which jumps out at me and suggests mocking.

http://stackoverflow.com/q/25898723
tagged with: mockito
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40537904
has comment: http://stackoverflow.com/comment/40554316
has body: I see myself currently in the need of writing tests relying on legacy code, and I have these generated model classes based on complex schemas, which leads to multiple nested levels of redirection. E.g: country.getProvinces().getCities().get(0).getInhabitants().get(0).getName(); I checked the Mockito framework, and the possibility to have Deep Nested Stubs, but unfortunately it doesn´t work when Generics is involved. Filling a test double is kind of out of the question, since the test code gets pretty soon hard to trace and maintain. A similar but somehow different option would be to load sample files. The code does not get as messy, but the maintenance problem remains. Am I missing some other option to the problem?
has comment: http://stackoverflow.com/comment/40549685
score: 1
has comment: http://stackoverflow.com/comment/40539765
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40630879
upvote count: 1
has title: How to mock complex JAXB generated classes?
tagged with: unit-testing
tagged with: java
has comment: http://stackoverflow.com/comment/40538552
tagged with: jaxb
type: Question
tagged with: mocking

http://stackoverflow.com/q/25982442
has answer: http://stackoverflow.com/a/26129523
accepted answer: http://stackoverflow.com/a/26129523
has body: I've set up In-App Billing v3 on an app according to the Google Developers page on that subject. I'm pretty much following the same approach and steps from their TrivialDrive sample application (as can be seen, for example, here). It all works OK (querying inventory, purchases, item consumption, etc. work) but I've been facing some rather annoying memory leaks. If I switch the phone's orientation a couple of times, cause Garbage Collection, do a HPROF dump and analyse using MAT, I can see that a bunch of Threads are still alive and kicking, while they shouldn't. It's not a lot of memory, but it still accumulates in any Activity where I use IabHelper... And yes, I am disposing my IabHelper instance (hell, even set the listeners as null...) in my Activity's onDestroy(): @Override protected void onDestroy() { super.onDestroy(); (...) if (mHelper != null) mHelper.dispose(); mHelper = null; mGotInventoryListener = null; mPurchaseFinishedListener = null; } Is anyone having the same issues? Can anyone point me in the right direction to fix this? Thanks in advance for any input.
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has title: Memory Leak while Using IabHelper (In-App Billing v3)
linked to: http://stackoverflow.com/q/11640390
upvote count: 2
answer count: 1
tagged with: in-app-purchase
favorite count: 0
tagged with: android
tagged with: memory-leaks

staledataexception
tags question: http://stackoverflow.com/q/25935978
type: Tag
tag name: staledataexception

http://stackoverflow.com/a/25986951
has body: Have another variable to reset startNum back to its original value, right before the for loop // ... int startNum = input.nextInt(); int reset = startNum; // ... startNum = reset; for (int x = 0; x &lt; startNum; x++) // ...
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25986904
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25986904

http://stackoverflow.com/comment/40758564
type: QuestionComment
comment on: http://stackoverflow.com/q/26022359
has text: I found out it works if I do a byteBuffer.position(0) before I call byteBuffer.asIntBuffer(). Seems weird to have to do that but it works.
score: 0
type: Comment

http://stackoverflow.com/q/25916393
type: Question
tagged with: jpa
tagged with: ant
has answer: http://stackoverflow.com/a/25977945
has comment: http://stackoverflow.com/comment/40662743
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40641205
tagged with: querydsl
has body: We are having this weird problem (or maybe we are missing some parameter configuration) that if we compile our project using a x86 JVM everything works OK, but if we use a x64 JVM we get this error during compilation: QT_LOG.java:66: incompatible types found : com.mysema.query.types.path.NumberPath&lt;java.lang.Long&gt; required: com.mysema.query.types.path.SimplePath&lt;java.lang.Long&gt; public final SimplePath&lt;Long&gt; id = _super.id; This behavior happens if we use ANT as described in here: http://www.querydsl.com/static/querydsl/3.4.3/reference/html/ch02.html#d0e147 &lt;javac includeantruntime="false" debug="true" debuglevel="source,lines,vars" fork="yes" executable="...x86...or...x64...JAVAC" classpathref="My Project.classpath" source="1.6" target="1.6" encoding="iso-8859-1" &gt; &lt;compilerarg value="-proc:only"/&gt; &lt;compilerarg value="-processor"/&gt; &lt;compilerarg value="com.mysema.query.apt.jpa.JPAAnnotationProcessor"/&gt; &lt;compilerarg value="-s"/&gt; &lt;compilerarg value="c:/myPath/"/&gt; &lt;src path="${mySourceFolder}" /&gt; &lt;/javac&gt; If we use Eclipse, we also get the different values (NumberPath/SimplePath) but we don't get any error. What can we do to fix this? Tested with QueryDSL 3.2.3 and 3.4.3.
favorite count: 0
has title: QueryDSL NumberPath/SimplePath mixup on x64/x86
accepted answer: http://stackoverflow.com/a/25977945
has comment: http://stackoverflow.com/comment/40632438
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40649932
upvote count: 3
tagged with: java

http://stackoverflow.com/q/25889479
tagged with: flexjson
has comment: http://stackoverflow.com/comment/40519777
score: 0
has comment: http://stackoverflow.com/comment/40519378
has title: How to insert a serialized json string into another json object /nested?
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40528112
answer count: 0
type: UnansweredQuestion
type: Question
has body: I have json serialized arraylist in java which i want to insert into another json object, how can i do this without having double quotes on my json string? JSONSerializer serializer = new JSONSerializer(); String serializedList = serializer.serialize(myArrayList); I want serializedList nested into my json object: myJsonOutput = Json.createObjectBuilder() .add("key1", "val1") .add("key2", "val2") .add("myArray", serializedList) .build(); If i do it like this my serializedList will be inserted as a whole string?
has comment: http://stackoverflow.com/comment/40519348
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/25893721
favorite count: 0
has comment: http://stackoverflow.com/comment/40526593
has comment: http://stackoverflow.com/comment/40526498
accepted answer: http://stackoverflow.com/a/25893812
upvote count: 1
type: AnsweredQuestion
has title: Persist entities unless they are already existing?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40526261
tagged with: datanucleus
has comment: http://stackoverflow.com/comment/40525828
answer count: 1
tagged with: jpa
downvote count: 0
has body: Consider the following JPA entity: @Entity class Entity { @Id private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } Entity entity = new Entity(); entity.setName('foo'); Inside a transaction, I would like to achieve the following: Persist the entity entity to the datastore if no other entity of that kind with name foo exists, or throw an exception if there is already an entity of kind Entity with name foo. What is the most idiomatic/the best way to achieve this? (For what is's worth, I'm using DataNucleus' JPA implementation with App Engine.)
has comment: http://stackoverflow.com/comment/40528644
has comment: http://stackoverflow.com/comment/40723648
has answer: http://stackoverflow.com/a/25893812

http://stackoverflow.com/comment/40598991
type: Comment
type: QuestionComment
has text: Ok. Are all logged ip addresses from the local machine? If so, are you connecting to the server through a tunnel?
comment on: http://stackoverflow.com/q/25931750
score: 0

http://stackoverflow.com/a/25924099
upvote count: 1
has comment: http://stackoverflow.com/comment/40583356
has comment: http://stackoverflow.com/comment/40583973
score: 1
has comment: http://stackoverflow.com/comment/40586939
accepted answer of: http://stackoverflow.com/q/25924067
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/137747928
downvote count: 0
answers question: http://stackoverflow.com/q/25924067
type: Answer
has body: You need to use the same type for input/output streams in both ends (server, client). So, change your code to: oout = new ObjectOutputStream(client.getOutputStream()); oin = new ObjectInputStream(client.getInputStream()); // REMOVE THIS LINE in = new BufferedReader(new InputStreamReader(client.getInputStream())); // REMOVE THIS LINE out = new PrintWriter(client.getOutputStream(), true); Remove the other in &amp; out and oout = new ObjectOutputStream(socket.getOutputStream()); oin = new ObjectInputStream(socket.getInputStream()); // REMOVE THIS LINE out = new PrintWriter(socket.getOutputStream(), true); // REMOVE THIS LINE in = new BufferedReader(new InputStreamReader(socket.getInputStream())); Remove the other in &amp; out

http://stackoverflow.com/q/26023180
has comment: http://stackoverflow.com/comment/43788809
accepted answer: http://stackoverflow.com/a/26023369
upvote count: 1
answer count: 1
favorite count: 0
tagged with: wikipedia-api
has answer: http://stackoverflow.com/a/26023369
has title: Wikipedia categories for articles by id
has body: I would like to get a list of categories of Wikipedia articles. I currently use this api http://en.wikipedia.org/w/api.php?action=query&amp;prop=categories&amp;pageids=17566205|39952380&amp;inprop=url&amp;format=xml However, I need the categories for over 4M articles and wonder if there are data dumps around for such task. I don't need the textual content of a page, only its categories. Thank you.
has comment: http://stackoverflow.com/comment/40760235
downvote count: 0
score: 1
tagged with: java
tagged with: wikipedia
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/40725977
type: Comment
comment on: http://stackoverflow.com/a/26003196
type: AnswerComment
score: 0
has text: All the examples above use java beans as data objects, so will convert data to another format. This holds true for java and guava, but when the class is not a data object this convention is some times violated, which leads to the question, when and why?

http://stackoverflow.com/a/25885125
has comment: http://stackoverflow.com/comment/40514206
type: Answer
answers question: http://stackoverflow.com/q/25885017
has comment: http://stackoverflow.com/comment/40514644
has body: Create a log4j.xml file to override the defaults in the 3rd party jar (an .xml file overrites property files). Here is an example: <?xml version="1.0" encoding="UTF-8" ?> <priority value="off"/> <level value="DEBUG" /> <appender-ref ref="console" /> In your case the package could be org.openqa.selenium! Or you have to try some values to get the right package!
has comment: http://stackoverflow.com/comment/40514295
has comment: http://stackoverflow.com/comment/40514260
score: 0
has comment: http://stackoverflow.com/comment/40514105
has comment: http://stackoverflow.com/comment/40512660

http://stackoverflow.com/comment/40577121
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25920748
has text: There is no real configuration. No arguments etc. at all. I just run my main class and outside eclipse I do java -jar file.jar. I'm gonna add my POM.XML to the post. (exporting with maven clean package)

http://stackoverflow.com/a/25995554
has body: The product of the empty set is 1, not 0. So if you are truly making the analogous problem, the product can never be below 1. The problem that you are actually trying to solve is therefore better described as, "The maximum product of subsequences with 2 or more members." To solve this one, try to come up with a recursive function that takes the sequence and a range, and returns 4 numbers: The minimum element. The maximum element. The minimum product of 2 or more elements. The maximum product of 2 or more elements. The cases of a 2 element section and a 3 element section need to be coded up as obvious special cases. For the recursive step, the logic for the minimum and maximum elements is obvious. And the minimum and maximum products will be the minimum and maximum of the 8 possible products of one of those 4 numbers for the one side with one of those 4 numbers for the other side.
type: Answer
answers question: http://stackoverflow.com/q/25983132
score: 0

http://stackoverflow.com/comment/40649264
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25962367
has text: You can create 1 more copy of array and work on it.
score: 0

http://stackoverflow.com/a/25964450
has body: I would use a timed join. At the end of the timeout, you can just interrupt your thread executing the logic, which may cause an InterruptedException. Of course, you should comply with the Java monitor specification, so you need some checks on the interrupted state in your logic thread. If you really cannot have interrupted checks, then you may want to use a Future: Runnable job = new MyRunnable(); ExecutorService executor = Executors.newSingleThreadExecutor(); final Future future = executor.submit(job); try { // Execute the job with a time limit future.get(5000, TimeUnit.MILLISECONDS); } catch (final TimeoutException e) { // Operation timed out, so log it and attempt to cancel the thread // Notice that the thread is not going to be killed! future.cancel(true); } finally { executor.shutdownNow(); } Just replace the Runnable job with your logic thread. Source for the code: http://www.coderanch.com/t/234096/threads/java/executing-time-bounded-job
has comment: http://stackoverflow.com/comment/40653117
score: -1
has comment: http://stackoverflow.com/comment/40652897
has comment: http://stackoverflow.com/comment/40653008
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/40656571
answers question: http://stackoverflow.com/q/25964203

http://stackoverflow.com/comment/40498383
comment on: http://stackoverflow.com/q/25877286
has text: @DavidWallace HP 16C :-) But seriously, a scientific-type calculator that's implemented using `double` would be far more accurate than any _physical_ scientific calculator that I've ever owned. We could talk about implementing a financial-type calculator, but then we're back to manipulating currencty.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40606085
score: 4
type: Comment
type: QuestionComment
has text: Where /w is a whitespace?
comment on: http://stackoverflow.com/q/25937806

http://stackoverflow.com/comment/40528567
score: 0
type: Comment
type: QuestionComment
has text: <field name="content" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
comment on: http://stackoverflow.com/q/25889004

http://stackoverflow.com/comment/40776545
type: AnswerComment
comment on: http://stackoverflow.com/a/26011622
score: 0
type: Comment
has text: thanks the image loads in the imageview, I ended up not using Base64 and bitmap and directly sending the file using multipartEntity

http://stackoverflow.com/a/25893338
type: AcceptedAnswer
has body: I have added mouse listener. MouseListener is not the right choice to listen to selection changes. You should attach a ListSelectionListener to the table's ListSelectionModel if you want to listen for rows selection changes: JTable table = new JTable(); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { // your code here } }); See more in Users Selections section of How to Use Tables tutorial. One way is I can hard code it to get data corresponding to individual id or is there any other way to do this or is there? Yes there is another better and more elegant way: implement your own TableModel. You can use AbstractTableModel as base. See Creating a Table Model
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40722546
has comment: http://stackoverflow.com/comment/40724812
accepted answer of: http://stackoverflow.com/q/25883548
answers question: http://stackoverflow.com/q/25883548

http://stackoverflow.com/a/25949646
answers question: http://stackoverflow.com/q/25901117
has comment: http://stackoverflow.com/comment/116320310
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25901117
type: Answer
upvote count: 1
has body: I was on SWT/GTK+ v4.3 and needed to download and update to SWT/GTK+ v4.4 (or the beta of v4.5), which supports the new GTK+ introduced in GTK version v22.* and present in CENTOS 7. See comment from Baz and myself.
score: 1

http://stackoverflow.com/comment/40595323
comment on: http://stackoverflow.com/q/25931723
score: 0
type: Comment
type: QuestionComment
has text: its for JavaScript or native android ?

http://stackoverflow.com/comment/40577666
comment on: http://stackoverflow.com/a/25921661
has text: Using `@Canonical` was impeccable. :)
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/25974760
downvote count: 0
has body: You can use a library dedicated to schedule code: quartz It use cron like syntax and can schedule Job implementations.
type: Answer
answers question: http://stackoverflow.com/q/25974676
upvote count: 1
score: 1

http://stackoverflow.com/a/25907276
answers question: http://stackoverflow.com/q/25905920
downvote count: 0
has body: Normally, you can use servletRequest.getRemoteAddr() to get the client’s IP address that’s accessing your Java web application. String ipAddress = request.getRemoteAddr(); But, if user is behind a proxy server or access your web server through a load balancer (for example, in cloud hosting), the above code will get the IP address of the proxy server or load balancer server, not the original IP address of a client. String ipAddress = request.getHeader("X-FORWARDED-FOR"); if (ipAddress == null) { ipAddress = request.getRemoteAddr(); }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/25884559
type: Answer
accepted answer of: http://stackoverflow.com/q/25884342
has body: It's impossible to tell for certain without the rest of the code, but it looks like this is a slightly hacky way to run complex initialization code on a background thread but still have the main thread wait until the initialization is done. The call to initialize() happens in the background, but conditionVariable.block() waits until it's finished. I'm left wondering what the point is, though. If the .block() call really does block, then it ties up the main thread just as much as just initializing directly. Maybe .block() does some polling but also allows GUI events to run or something. Hard to be sure without the code...
answers question: http://stackoverflow.com/q/25884342
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/comment/40515644
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25887281
has text: I think this input illegal, but better ask Jack

http://stackoverflow.com/comment/75466228
type: Comment
has text: What is the point of using a non-capturing group if is captured anyway? In your example, making groups 0 and 2 capturing would produce the same result?
comment on: http://stackoverflow.com/a/25972978
type: AnswerComment
score: 0

http://stackoverflow.com/q/25998192
has title: Arriving JSON entity is being incorrectly mapped in Spring Controller's method signature
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/40714801
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25998767
has body: I am passing json object. All but Timestamp properties is being set correctly. Timestamp properties of Entity is set to 1970 year ...smth. How to fix it? @RequestMapping(value = "/addProduct", method = RequestMethod.POST, consumes = "application/json") @ResponseBody public Product addProduct(Model model, @RequestBody Product product, BindingResult result){ cService = (ProductService) context.getBean("productService"); cService.addProduct(product); return product; } json input: {"name": "ag","dateTimeStart": 1411568760,"dateTimeEnd": 1412100000} Product entity: @Table(name = "product") @Entity public class Product implements Serializable { @Id @Column(name = "product") private int product; @Column(name = "name") @Basic @NotEmpty private String name; @Column(name = "date_time_start") @Basic private Timestamp dateTimeStart; @Column(name = "date_time_end") @Basic private Timestamp dateTimeEnd; } Added record to database: name ag dateTimeStart 1970-01-17 10:06:08 dateTimeEnd 1970-01-17 10:15:00 UPDATE I am using MySQL. I pass unix epoch timestamp and expect it to be correctly stored in database.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/40714668
score: 0
answer count: 1
tagged with: rest

http://stackoverflow.com/q/25894477
tagged with: combinations
has comment: http://stackoverflow.com/comment/40527209
has comment: http://stackoverflow.com/comment/40527915
tagged with: algorithm
upvote count: 0
duplicate of: http://stackoverflow.com/q/714108
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/40527327
answer count: 1
has comment: http://stackoverflow.com/comment/40527706
has comment: http://stackoverflow.com/comment/40527833
has title: Combination in java
has comment: http://stackoverflow.com/comment/40527668
has comment: http://stackoverflow.com/comment/40528064
favorite count: 0
has comment: http://stackoverflow.com/comment/40528344
has comment: http://stackoverflow.com/comment/40527570
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40527996
has answer: http://stackoverflow.com/a/25895003
has comment: http://stackoverflow.com/comment/40528442
has comment: http://stackoverflow.com/comment/40528137
has comment: http://stackoverflow.com/comment/40527801
tagged with: java
has body: I have an array that contains 3 arrays, like this: String[][] S = { {a,b,c} , {d,e}, {f,g,h} } Now I want to create all arrays R = {r1,r2,r3} where r1 belongs to S1, r2 belongs to S2, r3 belongs to S3 (S1, S2, S3 are sub-array of S) and I want have the output like that: R1 = {S[1][1], S[2][1], S[3][1]}, R2 = {S[1][1], S[2][1], S[3][2]}, R3 = {S[1][1], S[2][1], S[3][3]}, ..., R18 = {S[1][3], S[2][2], S[3][3]} I can not use 3 for-iterators because the array S is dynamic.
linked to: http://stackoverflow.com/q/714108
downvote count: 1
has comment: http://stackoverflow.com/comment/40527950
type: Question

http://stackoverflow.com/q/26017364
has answer: http://stackoverflow.com/a/26017653
answer count: 5
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3247067
has comment: http://stackoverflow.com/comment/79768282
score: 2
has body: I have a variable that's a string and I want to replace the string with "null" if the variable contains only a space or multiple spaces. How can I do it?
upvote count: 2
tagged with: java
type: Question
has title: How to know if the string variabel contains only space in java?
has answer: http://stackoverflow.com/a/26017596
has comment: http://stackoverflow.com/comment/40749338
has comment: http://stackoverflow.com/comment/40748977
downvote count: 0
tagged with: space
tagged with: string
has answer: http://stackoverflow.com/a/26017395
has answer: http://stackoverflow.com/a/26017537
has answer: http://stackoverflow.com/a/26017422
favorite count: 0

http://stackoverflow.com/comment/40639618
has text: I fixed your code formatting... it was really ugly, please respect the people trying to help you. Nonetheless, it's still difficult to understand. Refactor this code, rename your parameters, do something to make your code readable and understandable, add some comments, make it object oriented (what the hell is this 1/-1 position flag ?), try not to use breaks in loops... read "clean code"
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25956592

storage
tag name: storage
tags question: http://stackoverflow.com/q/26029707
type: Tag

http://stackoverflow.com/a/26072536
has body: I can recommend Groovy Sandbox for this purpose. In contrast to SecureASTCustomizer it will check if an execution is allowed dynamically at runtime. It intercepts every method call, object allocations, property/attribute access, array access, and so on - and you thus have a very fine grained control on what you allow (white-listing). Naturally the configuration on what is allowed is very important. For example you may want to allow using Strings and use methods like substring, but probably not the execute method on String, which could be exploited with something like 'rm -R ~/*'.execute(). Creating a configuration that is really safe is a challenge, and it is more difficult the more you allow. Downside of the Groovy Sandbox is that the code must run with the interceptor registered and you will have a performance penalty during execution. This image [1] shows an example from a project where we used Groovy Sandbox for Groovy code entered by the user. The code is run to valide the script - so if the statement there would actually be executed as part of it, the application would have exited before I could do the screenshot ;)
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/26017584
upvote count: 3
has comment: http://stackoverflow.com/comment/40907975
has comment: http://stackoverflow.com/comment/40905648
has comment: http://stackoverflow.com/comment/40982751
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26017584
has comment: http://stackoverflow.com/comment/40892401
has comment: http://stackoverflow.com/comment/40982326
type: Answer

http://stackoverflow.com/q/25999185
score: 4
has comment: http://stackoverflow.com/comment/40717099
has comment: http://stackoverflow.com/comment/40722432
answer count: 2
has comment: http://stackoverflow.com/comment/40716333
has answer: http://stackoverflow.com/a/46502290
accepted answer: http://stackoverflow.com/a/26000025
has comment: http://stackoverflow.com/comment/40716023
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26000025
has comment: http://stackoverflow.com/comment/40716423
has comment: http://stackoverflow.com/comment/40716215
upvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40716190
tagged with: reflection
possible better answer: http://stackoverflow.com/a/46502290
tagged with: java
has comment: http://stackoverflow.com/comment/40717484
has comment: http://stackoverflow.com/comment/40716098
has comment: http://stackoverflow.com/comment/40716945
has comment: http://stackoverflow.com/comment/40716139
type: Question
has comment: http://stackoverflow.com/comment/40716374
has body: I want to create copy of object via Reflection API. Here is my code: private &lt;T&gt; T copy(T entity) throws IllegalAccessException, InstantiationException { List&lt;Field&gt; fields = new ArrayList&lt;Field&gt;(); Field[] retrievedFields = entity.getClass().getDeclaredFields(); for (Field field : retrievedFields) { fields.add(field); } T newEntity = (T) entity.getClass().newInstance(); for (Field field : fields) { field.setAccessible(true); field.set(newEntity, field.get(entity)); } return newEntity; } But I don't know how to get values of fields.
has comment: http://stackoverflow.com/comment/40716738
has title: How can I make a copy of object via Reflection API?
has comment: http://stackoverflow.com/comment/40716300

http://stackoverflow.com/comment/40578354
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25922014
has text: Just name for example "amount", "size"
score: 0

http://stackoverflow.com/comment/40754863
score: 0
type: Comment
type: QuestionComment
has text: Hey thanks for the response, Yes Yes that is correct , the value which I am showing on the graph is item level , to be more specific on the the range of the y axis and x aixis . my Y axis is 0%,10%,20%,30%,40,....100% and x axis is year 2012,2013, 2014 . and the data in this is case 0.068 at 10% for year 2013 on the graph.
comment on: http://stackoverflow.com/q/26004659

http://stackoverflow.com/q/25939486
has body: How can I make java throw an IOexception as well as an InterruptedException? So far for an IO exception I made a file have no read/write/execute permissions but that did not work. I am not sure how else I can make an IO exception be thrown.
downvote count: 4
accepted answer: http://stackoverflow.com/a/25939550
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/25939523
has comment: http://stackoverflow.com/comment/40609390
favorite count: 0
possible better answer: http://stackoverflow.com/a/25939523
type: Question
tagged with: exception
has comment: http://stackoverflow.com/comment/40609571
linked to: http://stackoverflow.com/q/9719993
tagged with: java
answer count: 2
duplicate of: http://stackoverflow.com/q/9719993
tagged with: testing
has answer: http://stackoverflow.com/a/25939550
has title: Make exceptions be thrown
score: -4

http://stackoverflow.com/q/25999255
linked to: http://stackoverflow.com/q/20149397
has answer: http://stackoverflow.com/a/59075467
has answer: http://stackoverflow.com/a/26048916
has answer: http://stackoverflow.com/a/47380288
has answer: http://stackoverflow.com/a/26769030
has answer: http://stackoverflow.com/a/40681670
has comment: http://stackoverflow.com/comment/55703555
upvote count: 36
downvote count: 0
has comment: http://stackoverflow.com/comment/55698587
has comment: http://stackoverflow.com/comment/115413280
favorite count: 0
possible better answer: http://stackoverflow.com/a/26769030
has answer: http://stackoverflow.com/a/51330257
has title: Delete directory recursively in Scala
has body: I am writing the following (with Scala 2.10 and Java 6): import java.io._ def delete(file: File) { if (file.isDirectory) Option(file.listFiles).map(_.toList).getOrElse(Nil).foreach(delete(_)) file.delete } How would you improve it ? The code seems working but it ignores the return value of java.io.File.delete. Can it be done easier with scala.io instead of java.io ?
has answer: http://stackoverflow.com/a/41560402
has answer: http://stackoverflow.com/a/31174138
has answer: http://stackoverflow.com/a/25999465
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/115415496
tagged with: scala
has comment: http://stackoverflow.com/comment/51895869
has answer: http://stackoverflow.com/a/65282858
score: 36
tagged with: file
has answer: http://stackoverflow.com/a/29253684
accepted answer: http://stackoverflow.com/a/51330257
type: Question
has answer: http://stackoverflow.com/a/37247486
tagged with: java
has answer: http://stackoverflow.com/a/45703150
answer count: 13

http://stackoverflow.com/q/25903329
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25903426
accepted answer: http://stackoverflow.com/a/25903426
score: 0
has body: i'm trying to add a menu panel under a MapFragment but the thing always appear in the middle of the screen, like floating. I've tried several layout configurations but nothings seems to work. This is my layout: <fragment android:id="@+id/panel_map" android:name="com.google.android.gms.maps.MapFragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:scrollbars="vertical" /> <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Nuevo marcadort" android:textAppearance="?android:attr/textAppearanceMedium" /> This is the actual result: Any idea? What I'm doing wrong?
tagged with: google-maps-api-2
tagged with: android
has title: Adding a normal Layout under a MapFragment
type: AnsweredQuestion

http://stackoverflow.com/comment/40664508
comment on: http://stackoverflow.com/q/25963457
has text: It is exactly what I am doing, but when I put " C:\cygwin64\home\solr\example\solr ", it makes problem. When I put " C:\solr " it doesn't.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40690604
type: QuestionComment
comment on: http://stackoverflow.com/q/25984717
has text: I run both start-dfs.sh and start-yarn.sh. Only resourcemanager comes up (in jps) and is accessible through the browser. The namenode never comes up and I do not see any exceptions in the logs - just the printout when I run the start-dfs.sh that it cannot find $HADOOP_INSTALL/bin/hdfs. $HADOOP_INSTALL points to the hadoop directory where I have the bin/hdfs.
score: 0
type: Comment

http://stackoverflow.com/comment/40588249
score: 0
has text: If you use Thread.Sleep(), then the thread that you want to do things (ie display rolling image) is suspended (put to sleep) for the period of time. You want to use a `Timer` to make something else happen in 1.5 seconds.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25927708

http://stackoverflow.com/q/25948982
has comment: http://stackoverflow.com/comment/46107017
type: Question
has body: Maybe this is already answered but I can't find it on SO. I have a very simple requirement: Restrict the length of characters in an EditText. I use the maxLength tag in xml for this. The strange thing is, if the length of the inputted text exceeds the specified limit, the text can't be deleted by pressing backspace via soft keyboard. The inputted text remains in the EditText field. After closing and reopening the soft keayboard, the text becomes "deleteable". &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;EditText android:id="@+id/edit" android:layout_width="match_parent" android:layout_height="wrap_content" android:maxLength="5" android:hint="text"/&gt; &lt;/RelativeLayout&gt; Adding this layout is enough to get the described behaviour. I added an InputFilter to see what's going on here. The result as described will be the same without the InputFilter! @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); EditText et = (EditText) findViewById(R.id.edit); InputFilter filter = new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { if (source != null) { Log.v("edit","source = " + source.toString()); Log.v("edit","start = " + start); Log.v("edit","end = " + end); } if (dest != null) { Log.v("edit","dest= " + dest.toString()); Log.v("edit","dstart = " + dstart); Log.v("edit","dend = " + dend); } return null; } }; InputFilter[] oldFilters = et.getFilters(); InputFilter[] newFilters = new InputFilter[oldFilters.length + 1]; System.arraycopy(oldFilters, 0, newFilters, 0, oldFilters.length); newFilters[oldFilters.length] = filter; et.setFilters(newFilters); } While logging I can see that source will remain the same, if the maxLength is exceeded, but the S…
has answer: http://stackoverflow.com/a/36821352
has answer: http://stackoverflow.com/a/25949008
score: 4
tagged with: android-input-filter
answer count: 2
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: The maxLength attribute in EditText doesn't work as expected via xml and java
upvote count: 4
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-edittext
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/45600499

http://stackoverflow.com/comment/40534940
type: QuestionComment
type: Comment
has text: It looks recursive in nature.
score: 0
comment on: http://stackoverflow.com/q/25898503

http://stackoverflow.com/q/26002695
has comment: http://stackoverflow.com/comment/40722890
answer count: 2
has body: I was studying about anonymous types in c# and wondering if something similar exists in java. Does Java have something like anonymous types in c#?
favorite count: 0
has answer: http://stackoverflow.com/a/26002749
possible better answer: http://stackoverflow.com/a/26002749
has answer: http://stackoverflow.com/a/26002747
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40722781
score: 1
tagged with: java
downvote count: 3
has title: Anonymous types in java like in c#
type: Question
upvote count: 4
tagged with: c#
has comment: http://stackoverflow.com/comment/40722812
has comment: http://stackoverflow.com/comment/40722730
accepted answer: http://stackoverflow.com/a/26002747
tagged with: anonymous-types

http://stackoverflow.com/q/25986022
has comment: http://stackoverflow.com/comment/40692770
has comment: http://stackoverflow.com/comment/40692839
has answer: http://stackoverflow.com/a/25986253
downvote count: 1
has comment: http://stackoverflow.com/comment/40715645
favorite count: 0
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/25986211
upvote count: 0
type: Question
has body: I have tried my code like below.. public class GuessNumber { public static void main(String[] args) { Scanner scan = new Scanner(System.in); Random rand = new Random(); int number = rand.nextInt(100) + 1; int guess; System.out.println("Guess the number between 1 and 100"); System.out.println(""); guess = scan.nextInt(); while (guess &lt; number) { System.out.println("Higher!"); guess = scan.nextInt(); } while (guess &gt; number) { System.out.println("Lower!"); guess = scan.nextInt(); } while (guess == number) { System.out.println("Correct!"); break; } } } and I'm having trouble making it ask until the user gets the right number. And at the end for the game to ask if the user wants to play the game again
has answer: http://stackoverflow.com/a/25986115
has comment: http://stackoverflow.com/comment/40692869
tagged with: java
has answer: http://stackoverflow.com/a/25986128
score: -1
has title: While loops having trouble

http://stackoverflow.com/comment/40584891
comment on: http://stackoverflow.com/a/25925850
type: Comment
type: AnswerComment
has text: Is helping the very new frowned upon? I don't understand the down votes for hints or explanations. Please leave a constructive comment and explain the reasons an answer is wrong.
score: 0

http://stackoverflow.com/a/25996709
has comment: http://stackoverflow.com/comment/40711840
has body: Whatever data structure you are defining can just hold items Object since EVERY class implicitly inherits from Object. However this take a load on your memory be sure to find a way to handle Garbage collection. E.g. List&lt;Object&gt; or HashMap&lt;Object,Object&gt; obj; or something of that sort. Maybe if you know all the kinds of Objects that will be held in that data structure you can use the method getClass() within a switch statement to find out what class the Object belongs to. Hope this is of help to you. Please implement this solution only if there is no inheritance between the Objects you plan to use otherwise use @microsby0 's answer
score: 0
answers question: http://stackoverflow.com/q/25996444
type: Answer

http://stackoverflow.com/comment/40508872
type: Comment
has text: Ya i got it.If method is static means then we call the method using class name.
comment on: http://stackoverflow.com/a/25883581
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40536509
type: QuestionComment
comment on: http://stackoverflow.com/q/25894513
has text: Hey sorry to hear you're having issues. Are you hitting the limit despite using ProGuard? If not, I'd recommend trying that as it's much simpler than trying to compile the SDK yourself. You can turn off obfuscation in ProGuard while you are still in the development cycle so it doesn't get in the way of debugging. This issue is something we are aware of and actively working on fixing. If you still want to try to build it yourself then I will do my best to help but that's probably a last resort
score: 0
type: Comment

http://stackoverflow.com/a/26025417
type: Answer
answers question: http://stackoverflow.com/q/25962311
has body: try to call finish(); that you should call on destroy of the current activity and display the previous activity.
score: 0

http://stackoverflow.com/q/25994963
tagged with: aspose
downvote count: 0
type: UnansweredQuestion
tagged with: aspose.words
score: 2
favorite count: 0
has title: update mailmerge field after aspose.words.Document.getMailMerge().execute
has body: this is my first question here so bear with me please. I have an aspose.words.Document object with mailmerge fields. I need to change one of the fields more than one time. As far as I know once you change a MailMerge field with Document.getMailMerge().execute, the field becomes plain text and stop being a field. Thats because when I use these lines of code again with different values, it doesn't work for a second time. doc.getMailMerge().execute( new String[] { "title", "name", "address", "telephone", "fax", "date" }, new Object[] { "Some title", "some name", "some address", "some telephone", "some fax", "some date" }); I have two workarounds for this problem that I'm facing: One is that I create one more Document object and put that object through all the phases with my original Document object except for the doc.MailMerge().execute phase. However the phases before MailMerge phase cost much time (for big documents) which can be measured with minutes, so I dont want to double that time. I used a performance tool for it. Second is that right before using MailMerge() for the first time, I use Document.deepClone() on the original document to create a second independant object. With this I don't need to add those time costly code blocks for a second time, but I also haven't calculated or searched deeply for performance of this deepClone() method. I'll add that info after I dig into that. Long story short what I want to ask is, can I update a MailMerge field after I change it. If not so, is there a better workaround for this?
type: Question
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/26012731
tagged with: java

http://stackoverflow.com/comment/40690008
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25975822
has text: is it return from jsonparser ?

http://stackoverflow.com/comment/40667917
has text: yes I understand `exportReportToPdfStream()` method will produce streem. but my problem is, how to send this streem to next jsp file and using that how can I display report. Can you help me in this with some code snnipet.
comment on: http://stackoverflow.com/a/25972708
type: AnswerComment
score: 0
type: Comment

function
tags question: http://stackoverflow.com/q/26002304
tag name: function
tags question: http://stackoverflow.com/q/25916887
tags question: http://stackoverflow.com/q/25937705
tags question: http://stackoverflow.com/q/26027946
type: Tag
tags question: http://stackoverflow.com/q/25959104
tags question: http://stackoverflow.com/q/25964779

http://stackoverflow.com/comment/40717957
type: AnswerComment
has text: @przemekhertel Yes, static holder pattern is more preferable, but this doesn't mean that double-checked idiom is deprecated or unsafe.
type: Comment
comment on: http://stackoverflow.com/a/25995569
score: 0

http://stackoverflow.com/q/25965179
has comment: http://stackoverflow.com/comment/40654413
tagged with: queue
has title: Multi assignment using objects
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40654556
tagged with: variable-assignment
type: UnansweredQuestion
score: 1
has body: I am implementing a simple Queue Class for my programming class. Java assigns values from right to left, does that still apply to objects? I was hoping to cut out the use of a placeholder variable with something like this: public void enqueue(int i) { lastNode = lastNode.next = new Node(); lastNode.value = i; } Will that work? And/or should I just use a placeholder variable for readability?
upvote count: 1
tagged with: object
has answer: http://stackoverflow.com/a/25965251
tagged with: java

http://stackoverflow.com/a/25896450
type: AcceptedAnswer
type: Answer
has body: The API method Session.save(Object) takes input as an Object, so there is no problem if you try to call session.save(obj) in your DAOHelper class, so no problem with Object in DAOHelper. But: idInput = (Long) session.save(obj); You are casting the return type to Long so you will face exceptions if the identifier type of the entity object is not of type Long. As per your code it seems you are declaring the session variable as an instance variable. As session is not thread-safe you will face issues in multi-threading environment.
answers question: http://stackoverflow.com/q/25892580
accepted answer of: http://stackoverflow.com/q/25892580
score: 0

http://stackoverflow.com/q/25889639
type: Question
tagged with: mongodb
score: 0
answer count: 1
has title: How to update specific filed in mongodb document using Spring?
has body: I need to search product document by ObjectId and update specific field listed using Spring data framework. I get error from IDE when I try to use update method on injected MongoOperations @Repository public class ProductDao { @Autowired private MongoOperations mongoOperations; public void cancel(Long id) { mongoOperations.update("{"_id":"00000000001"}","$set{"listed":"False"}"); // error // something like that } } I think I need to use DBCollection but I have issues setting it up. To update field I need to use $set How to make it working?
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25894155
accepted answer: http://stackoverflow.com/a/25894155
tagged with: java

http://stackoverflow.com/comment/40522936
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25887346
type: Comment
has text: how we can do that? and ya by the way i need to include that two jars na?

http://stackoverflow.com/comment/40522377
comment on: http://stackoverflow.com/q/25891788
score: 1
type: Comment
has text: You're doing something wrong. `System.out.println(System.getProperty("FOOBAR"));` prints `foobar` for me. Note that the `"D"` is not part of the property name.
type: QuestionComment

http://stackoverflow.com/comment/40604633
comment on: http://stackoverflow.com/a/25926134
score: 0
type: Comment
has text: look at these links and if still you have a problem ask it on SO:http://stackoverflow.com/questions/16459196/java-lang-illegalargumentexception-pointerindex-out-of-range-exception-dispat and http://stackoverflow.com/questions/6919292/pointerindex-out-of-range-android-multitouch
type: AnswerComment

sentinel
tags question: http://stackoverflow.com/q/25943644
tags question: http://stackoverflow.com/q/25926598
type: Tag
tag name: sentinel

http://stackoverflow.com/q/26020326
tagged with: space
has answer: http://stackoverflow.com/a/26020467
has answer: http://stackoverflow.com/a/26021867
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26020394
tagged with: java
has comment: http://stackoverflow.com/comment/40754694
type: Question
has title: How to remove single character in a string (java)?
answer count: 6
has body: I have a variable of type string, I want to remove all single characters from it. example: String test = "p testing t testing"; I want the output to be like this: String test = "testing testing"; help me please. thanks.
tagged with: string
has answer: http://stackoverflow.com/a/74310366
score: 0
has comment: http://stackoverflow.com/comment/40754747
has answer: http://stackoverflow.com/a/26020363
has answer: http://stackoverflow.com/a/26020404

http://stackoverflow.com/q/25947195
tagged with: cordova
linked to: http://stackoverflow.com/q/2727763
type: UnansweredQuestion
tagged with: android
has title: Access java variables from javacode to javascript code
tagged with: java
has answer: http://stackoverflow.com/a/25947239
type: Question
has body: I am working on a Phonegap application . Here I want to access java variables in javascript code .I can access functions from javacode to javascript code here.So I think it should be possible to access java variables from javacode to javascript code . How can I do that . I have visited many post on Overflow but did't help . I am putting sample code here . JavaCode class A { String a, b ; A() { a = "phonegap"; b= "application" ; } } Javascript Code : &lt;HTML&gt; &lt;script type= "text/javascript"&gt; //Here I want to access java variables a and b . &lt;/script&gt;
score: 0
answer count: 1
tagged with: jquery

http://stackoverflow.com/q/25935326
answer count: 2
downvote count: 0
tagged with: logback
tagged with: slf4j
has answer: http://stackoverflow.com/a/25935925
favorite count: 0
accepted answer: http://stackoverflow.com/a/25935925
score: 11
upvote count: 11
type: AnsweredQuestion
has body: Recently added some println output to my program... and now dont want logback INFO messages merging with them. How can I get all messages to stderr ?
possible better answer: http://stackoverflow.com/a/25935937
tagged with: java
has answer: http://stackoverflow.com/a/25935937
has title: How can I configure logback conf to send all messages to stderr?
type: Question

http://stackoverflow.com/q/25889047
tagged with: ubuntu-12.04
has comment: http://stackoverflow.com/comment/40517051
answer count: 2
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25913594
downvote count: 0
type: UnansweredQuestion
has body: I am using Ubuntu 12.04 and JDK 1.6.0 and Eclipse 4.2 after installing JDK on my system i set the environments variables on /etc/profiles # file /etc/profiles JAVA_HOME=/opt/jdk1.6.0_22 export JAVA_HOME PATH=$PATH:$JAVA_HOME/bin export PATH I think its necessity a system reboot to apply this changes so I reboot the System Problem: After rebooting the command java -version give me this The program 'java' can be found in the following packages: * default-jre * gcj-4.6-jre-headless * openjdk-6-jre-headless * gcj-4.5-jre-headless * openjdk-7-jre-headless So I find this solution on net that i apply the changes of variables environment like this . /etc/profiles After the precedent command, java -version give me the good result java version "1.6.0_22" Java(TM) SE Runtime Environment (build 1.6.0_22-b04) Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode) Its OK and eclipse work but Problem is I must do the command . /etc/profiles before any program use java like SQL Developer or IReport So I want an idea to confirm this variables environments one time of all Thanks for reading
favorite count: 0
type: Question
has title: environment variable dont confirmed
tagged with: environment-variables
has answer: http://stackoverflow.com/a/25889872
score: 1

http://stackoverflow.com/q/25908751
has comment: http://stackoverflow.com/comment/40556885
tagged with: string
favorite count: 0
type: Question
score: -2
has answer: http://stackoverflow.com/a/25909717
downvote count: 3
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/25931906
has comment: http://stackoverflow.com/comment/40596598
has answer: http://stackoverflow.com/a/25908842
tagged with: java
has title: how to reverse a string with out using charAt()
type: UnansweredQuestion
has body: how to reverse a string without using inbuilt functions not even charAt() ? I was asked this at an interview and cannot find the solution. I'm sure he didn't mean to use string buffer , he specifically said no inbuilt functions at all, not even CharAt(). the language is java
linked to: http://stackoverflow.com/q/7569335
has comment: http://stackoverflow.com/comment/40554430

http://stackoverflow.com/q/26002304
favorite count: 0
has answer: http://stackoverflow.com/a/26002533
accepted answer: http://stackoverflow.com/a/26002533
upvote count: 4
has body: I want to write a function to find the next multiple of a number given a multiplier. Both the source number and multiplier could be floating point. expected: nextMult(3.654,0.5) = 4.0 nextMult(3.165,0.15) = 3.30 nextMult(3.452,0.002) = 3.452 nextMult(2, 0.3) = 2.1 nextMult(2, 0.2) = 2 nextMult(4, 3) = 6 My current solution: public double nextMult(double source, double multiplier) { for (double i = (double)((long)source - multiplier); i &lt;= source + multiplier; i += multiplier) { if (i &gt;= source) return i; } } I don't like the multiple castings. Are there more efficient ways or existing library solutions that can do this?
tagged with: double
has answer: http://stackoverflow.com/a/26002459
type: AnsweredQuestion
score: 3
tagged with: algorithm
has title: next multiple of a number to given multiplier
possible better answer: http://stackoverflow.com/a/26002459
tagged with: math
tagged with: java
type: Question
answer count: 2
tagged with: function
downvote count: 1

http://stackoverflow.com/q/25961763
favorite count: 0
has body: I want to use switch statement after an if statement but I can't and I don't know what is the problem. public class main { public static void main (String[] args) { String input; //To hold user's input. char selectPackage; //To hold Internet Package double hourUsage, totalCharges, addCharges; //other variables //Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); //Prompt the user to select a Internet Package. System.out.print("Which package did you purchase? ( Enter the Package's letter)"); input = keyboard.nextLine(); selectPackage = input.charAt(0); System.out.print("Please select the amount of hours used."); input = keyboard.nextLine(); hourUsage = Double.parseDouble(input); //Display pricing for selected package... switch (selectPackage) { case 'a': case 'A': if (hourUsage &gt; 10) { addCharges = hourUsage - 10; totalCharges = (addCharges * 2.0) + 9.95; System.out.println("You have used " + hourUsage + " hours and your total is $" + totalCharges + " per month. "); } else System.out.println("Your total is $9.95 per month."); break; case 'b': case 'B': if (hourUsage &gt; 20 ) { addCharges = hourUsage - 20; totalCharges = (addCharges * 1.0) + 13.95; System.out.println("You have used " + hourUsage + " and your total is $" + totalCharges + " per month."); } else System.out.println("Your total is $13.95 per month."); break; case 'c': case 'C': System.out.println("Your total is $19.95 per month."); break; default: System.out.println("Invalid Choice. Choice A,B,C"); } } } System.out.println("Your total is $19.95 per month."); } else System.out.println("Your total is $19.95 per month."); } } Now I want to use the switch statement for telling user that if he/she chose package "B", he would save 20 dollars.
has comment: http://stackoverflow.com/comment/40648134
has comment: http://stackoverflow.com/comment/40648027
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40648202
has comment: http://stackoverflow.com/comment/40647939
tagged with: java
upvote count: 1
downvote count: 1
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/40648102
accepted answer: http://stackoverflow.com/a/25962149
has comment: http://stackoverflow.com/comment/40647983
has comment: http://stackoverflow.com/comment/40648098
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40648311
score: 0
has answer: http://stackoverflow.com/a/25962149
answer count: 1
has title: Use switch statement after if statement

http://stackoverflow.com/comment/140141884
comment on: http://stackoverflow.com/a/75004577
has text: I think this is a good technique to have available, though doing the mapping in `collect` (per e.g. https://stackoverflow.com/a/25903190/1108305) saves on creating an additional interim `Entry` object for each element in the stream.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25959691
has body: I am making a stopwatch for android in eclipse. I am using chronometer and i want to know how do i show milliseconds.This is how my code looks like. P.S: I am a beginner, So this may sound stupid to you :P Button startChrono; Button pauseChrono; Chronometer chrono; long time = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startChrono = (Button) findViewById(R.id.button1); pauseChrono = (Button) findViewById(R.id.button2); chrono = (Chronometer) findViewById(R.id.chronometer1); startChrono.setOnClickListener(this); pauseChrono.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @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); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub switch (arg0.getId()) { case R.id.button1: chrono.setBase(SystemClock.elapsedRealtime() + time); chrono.start(); break; case R.id.button2: time = chrono.getBase() - SystemClock.elapsedRealtime(); chrono.stop(); break; } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25960656
tagged with: java
tagged with: eclipse
type: Question
score: 0
tagged with: sdk
tagged with: android
answer count: 1
has title: Show milliseconds in Chronometer

http://stackoverflow.com/comment/40745984
has text: Not a wise thinking if compare two different languages.
comment on: http://stackoverflow.com/q/26015704
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/40558138
comment on: http://stackoverflow.com/q/25911090
score: 0
has text: @Jea Good. You want to split by `$` now?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25995124
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25995054
type: Answer
answers question: http://stackoverflow.com/q/25995054
score: 2
upvote count: 2
has body: You state: the display is never clean the refresh isn't happening The reason is that you don't call the super method in your paintComponent method and so the component never gets to do its image cleaning housekeeping. So to fix that, call the super's method by changing: @Override protected void paintComponent(Graphics g){ g.drawString(String.format("%d %d", x,y), x, y); } to @Override protected void paintComponent(Graphics g){ super.paintComponent(g); // ********** g.drawString(String.format("%d %d", x,y), x, y); }

http://stackoverflow.com/comment/40613649
type: Comment
comment on: http://stackoverflow.com/a/25941131
has text: I mean, the endless listview will work fine without it, right?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40718236
comment on: http://stackoverflow.com/q/26000221
score: 0
type: Comment
type: QuestionComment
has text: Shouldn't you be doing your network calls in doInBackground()?

http://stackoverflow.com/q/25944831
score: 0
answer count: 1
tagged with: regex
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25946674
has title: Finding a regex to return all special characters in a single group
tagged with: java
has body: I want the regex to return all special characters in a single group. I have made the regex that would return the characters using [^a-zA_Z0-9] but this one does not return the characters not being a letter or digit in a single group. For example if the string to be checked is Today is ~Friday() then I am expecting that the output would be ~() in one string so that I can replace them in one go. But using the regex I provided I am getting: 0: [14,15] ~ 0: [21,22] ( 0: [22,23] )
has comment: http://stackoverflow.com/comment/40619395
type: Question
has comment: http://stackoverflow.com/comment/40618940

http://stackoverflow.com/a/25959664
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25959542
has comment: http://stackoverflow.com/comment/40646283
answers question: http://stackoverflow.com/q/25959542
type: Answer
has comment: http://stackoverflow.com/comment/40645695
upvote count: 1
has body: You can't call a method of another Activity before it is created through startActivity(intent). Furthermore in order to pass values to another Activity you have to use the method Intent putExtra(...). (See here what can be passed) Example In your first activity do something like this: intent.putExtra("KEY_NAME", name); // TODO other values that need to be passed In order to retrieve this value in your second activity you have to do something like this (for example in your displayInfo() method): Bundle bundle = getIntent().getExtras(); textview.setText(bundle.getString("KEY_NAME")); // TODO get the other values and set the text
score: 1

http://stackoverflow.com/a/25989689
has body: The only way you could do is use some implicit objects (request, session) for storing the objects &amp; then forward it to next jsp.
type: Answer
accepted answer of: http://stackoverflow.com/q/25988156
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25988156
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/27210975
score: 1
has body: String[] result = EMAIL_TEXT.split("\\|"); for(String s:result){ System.out.println(s); } you have all the text inside result array... just loop through them to get all of the lines...
answers question: http://stackoverflow.com/q/25894909
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/25951342
answers question: http://stackoverflow.com/q/25950876
type: Answer
upvote count: 3
has body: In one regex you can do like this. String s[] = passage.split("[.;?]"); List&lt;String&gt; allSentences = new ArrayList&lt;String&gt;(); allSenteces.addAll(Arrays.asList(s)); Or use an StringTokenizer StringTokenizer tokenizer = new StringTokenizer(passage, ".;?"); List&lt;String&gt; s = new ArrayList&lt;String&gt;(); while(tokenizer.hasMoreTokens()){ s.add(tokenizer.nextToken()); }
score: 3
accepted answer of: http://stackoverflow.com/q/25950876
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40544420
has text: and everythig works after?
comment on: http://stackoverflow.com/a/25903762
score: 0
type: Comment
type: AnswerComment

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/25912339

http://stackoverflow.com/a/25889743
downvote count: 1
answers question: http://stackoverflow.com/q/25889698
has comment: http://stackoverflow.com/comment/40518414
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40537985
has body: Why not just use another list? If you really need to use a HashMap for whatever reason, you can just add null values instead of void. Map&lt;Integer,Object&gt; map=new HashMap&lt;Integer, Object&gt;(); map.put("ss", null);
upvote count: 2
has comment: http://stackoverflow.com/comment/40518483

immutability
tags question: http://stackoverflow.com/q/25949574
tags question: http://stackoverflow.com/q/25935818
tags question: http://stackoverflow.com/q/25939228
tag name: immutability
tags question: http://stackoverflow.com/q/25875318
type: Tag
tags question: http://stackoverflow.com/q/25922996

state
tag name: state
tags question: http://stackoverflow.com/q/25888012
type: Tag

http://stackoverflow.com/comment/40657621
comment on: http://stackoverflow.com/q/25966089
score: 0
type: Comment
type: QuestionComment
has text: @dieend I already had done that before and its just the same. any ideas why?

http://stackoverflow.com/q/25895899
answer count: 2
accepted answer: http://stackoverflow.com/a/25896016
linked to: http://stackoverflow.com/q/923863
has comment: http://stackoverflow.com/comment/40529993
possible better answer: http://stackoverflow.com/a/25896020
has answer: http://stackoverflow.com/a/25896020
tagged with: string
has comment: http://stackoverflow.com/comment/40530142
favorite count: 0
tagged with: equals
has body: I have the following statement in my java code System.out.println(cName+" "+pName+" "+cName.equals(pName)); Output is ???????????????? ???????????????? false The equals should return true right as the two strings have equal number of '?'. But I a m getting false
has answer: http://stackoverflow.com/a/25896016
has comment: http://stackoverflow.com/comment/40530074
has comment: http://stackoverflow.com/comment/40530242
has comment: http://stackoverflow.com/comment/40529935
type: AnsweredQuestion
score: 3
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/40530211
has title: Java String comparison
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/40530328

http://stackoverflow.com/comment/40545714
type: Comment
comment on: http://stackoverflow.com/q/25904346
has text: @user3580890 Did yo want to allow `R,A,R`?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40642585
comment on: http://stackoverflow.com/q/25958940
type: Comment
has text: And you think two photos is all the information we need to solve your issue?
type: QuestionComment
score: 1

http://stackoverflow.com/a/25963261
has comment: http://stackoverflow.com/comment/40651285
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/40651228
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25963157
has comment: http://stackoverflow.com/comment/40651126
answers question: http://stackoverflow.com/q/25963157
downvote count: 0
has body: Note that T extends Comparable&lt;T&gt;. It doesn't have to be Comparable&lt;T&gt;. So you could, for example, create an array of Integers, because Integer implements Comparable&lt;Integer&gt;. Integer[] list = new Integer[100]; /* fill the array somehow */ Sorting.quickSort(list, 0, 99);

http://stackoverflow.com/a/25877830
score: 0
has comment: http://stackoverflow.com/comment/40512648
has body: I think it must be something with your code that you are not showing us as the SSCCE below works fine and doesn't throw any exceptions. import javafx.application.Application; import javafx.collections.FXCollections; import javafx.scene.Scene; import javafx.scene.control.ComboBox; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class NullComboBoxApp extends Application { @Override public void start(Stage primaryStage) { ComboBox&lt;String&gt; cb = new ComboBox&lt;&gt;(FXCollections.observableArrayList( "Option 1", "Option 2", "Option 3" )); cb.getItems().add(null); StackPane root = new StackPane(); root.getChildren().add(cb); Scene scene = new Scene(root, 300, 250); primaryStage.setTitle("Null ComboBox Example"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } Although this actually works, quite why you'd want your users to be able to select null is beyond me...is this actually the behaviour you want? I suspect you really want to be able to clear the current selection, something like: cb.getSelectionModel().clearSelection();
answers question: http://stackoverflow.com/q/25877323
type: Answer
has comment: http://stackoverflow.com/comment/40517234
has comment: http://stackoverflow.com/comment/60853129
has comment: http://stackoverflow.com/comment/40510348
has comment: http://stackoverflow.com/comment/40512169
has comment: http://stackoverflow.com/comment/40511891

http://stackoverflow.com/comment/40566046
type: QuestionComment
has text: Missing information - where do you get those String literals from? If you're reading product names and lists of patterns from somewhere... Than the answer kind of shows itself. And if you have to write them by hand, than you're already doomed.
comment on: http://stackoverflow.com/q/25915684
score: 0
type: Comment

http://stackoverflow.com/a/25927343
type: Answer
answers question: http://stackoverflow.com/q/25907687
score: 0
has body: I solved the problem by using org.apache.ibatis.logging.LogFactory.useCustomLogging method and giving a parameter as a custom logging class that extends Log4jImpl class. I overrode isTraceEnabled method. So error giving method would not be called anymore.

http://stackoverflow.com/comment/40577358
type: Comment
has text: @JosueEspinosa Perhaps you should make sure that x and y aren't past the edge of your window.
type: AnswerComment
comment on: http://stackoverflow.com/a/25921483
score: 0

http://stackoverflow.com/q/25903320
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40543647
possible better answer: http://stackoverflow.com/a/25905994
has title: Creating Objects on the stack memory in java ?
has answer: http://stackoverflow.com/a/25903366
has answer: http://stackoverflow.com/a/25905994
upvote count: 21
type: Question
score: 21
tagged with: java
tagged with: value-type
linked to: http://stackoverflow.com/q/38613390
tagged with: stack-memory
has comment: http://stackoverflow.com/comment/60051270
accepted answer: http://stackoverflow.com/a/25903366
has body: This is just a simple theoretical question out of curiosity. I have always been like a java fan boy. But one thing makes me wonder why java does not provide mechanism for creating objects on the stack ? Wouldn't it be more efficient if i could just create small Point(int x,int y ) object on the stack instead of the heap like creating a structure on C# . Is there any special security reason behind this restriction in java ? :)
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40543681
has answer: http://stackoverflow.com/a/25903379
has answer: http://stackoverflow.com/a/78834728

http://stackoverflow.com/q/25909854
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/40555188
upvote count: 2
linked to: http://stackoverflow.com/q/23662727
has title: How to fix BootReciever java.lang.NullPointerException?
accepted answer: http://stackoverflow.com/a/25910076
downvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40555026
tagged with: eclipse
tagged with: broadcastreceiver
answer count: 1
has body: I am getting this error and I don't know how to fix it: 09-18 10:14:34.482: E/Trace(787): error opening trace file: No such file or directory (2) 09-18 10:14:34.542: W/ResourceType(787): No package identifier when getting value for resource number 0x00000000 09-18 10:14:34.683: E/BootReceiver(787): java.lang.NullPointerException can someone tell me how to fix this error, BroadcastReceiver java: public class BootReceiver extends BroadcastReceiver { private static final String TAG="BootReceiver"; @Override public void onReceive(Context context,Intent intent) { try { DisplayMetrics metrics = new DisplayMetrics(); WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); windowManager.getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels; Bitmap tempbitMap = BitmapFactory.decodeResource(context.getResources(), MainActivity.tophone); WallpaperManager wallpaperManager = WallpaperManager.getInstance(context); wallpaperManager.setWallpaperOffsetSteps(1, 1); wallpaperManager.suggestDesiredDimensions(width, height); try { wallpaperManager.setBitmap(tempbitMap); } catch (IOException e) { e.printStackTrace(); } } catch(Exception e){ Log.e(TAG,e.toString()); } } }
has answer: http://stackoverflow.com/a/25910076
favorite count: 0

http://stackoverflow.com/q/26021525
has body: java.lang.NoClassDefFoundError: Could not initialize class com.sun.j3d.utils.universe.SimpleUniverse at com.jbatik.modules.corak.component.CorakViewElement.init(CorakViewElement.java:140) at com.jbatik.modules.corak.component.CorakViewElement.&lt;init&gt;(CorakViewElement.java:109) Caused: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:447) Please help me, i very confuse for installing java3d on MacOSX, before i using Windows 8.1 is good no problem. I have copy the j3dutil,j3dcore,vecmath,jogl, and gluegen-rt on jre/lib/ext and nothing happen.
score: 0
answer count: 1
tagged with: netbeans
has title: Error runtime can't find classes java3D simpleUniverse lib at netbeans on MacOSX 10.9.5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26045153
tagged with: java-3d
tagged with: java
type: Question

http://stackoverflow.com/comment/40676067
comment on: http://stackoverflow.com/q/25977197
score: 0
type: Comment
type: QuestionComment
has text: What do you mean by "the time in dt is in UTC"? That's clearly not the case given your first line of output. Do you mean `"2014-09-15T21:20:14"` is meant to be UTC?

http://stackoverflow.com/comment/40773701
has text: I have no idea you might consider asking on the eclim mailing list. (And if you get an answer post back here with the solution/problem)
comment on: http://stackoverflow.com/q/25994751
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/25998649
has title: How to convert multipage PDF to multipage TIFF
linked to: http://stackoverflow.com/q/31973354
tagged with: java
score: 0
type: Question
tagged with: ghost4j
has comment: http://stackoverflow.com/comment/80921450
has answer: http://stackoverflow.com/a/25999002
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
has body: I am using Ghost4j to convert multipage PDFs to multipage TIFF images. I haven't found an example of how this is done. Using below code I'm able to convert the multipage PDF to images but how do I create a single multipage TIFF image out of it? PDFDocument lDocument = new PDFDocument(); lDocument.load(filePath); // create renderer SimpleRenderer lRenderer = new SimpleRenderer(); // set resolution (in DPI) lRenderer.setResolution(300); // render as images List&lt;Image&gt; lImages = lRenderer.render(lDocument); Iterator&lt;Image&gt; lImageIterator = lImages.iterator(); //how to convert the images to a single TIFF image?
type: UnansweredQuestion

http://stackoverflow.com/q/25900245
tagged with: eclipse
score: 0
linked to: http://stackoverflow.com/q/5113579
answer count: 1
has comment: http://stackoverflow.com/comment/40622695
has comment: http://stackoverflow.com/comment/40604655
has comment: http://stackoverflow.com/comment/40604400
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/40539883
tagged with: spring
has comment: http://stackoverflow.com/comment/40610274
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40605033
tagged with: java
has comment: http://stackoverflow.com/comment/40602303
type: Question
has answer: http://stackoverflow.com/a/25901285
has body: I have two (web) projects in ways that the second one uses the first extending a class. I don't even know if my project's design is right, but the fact is that I'm facing an error during server start, and I don't know if there's a design mistake: - ProjectBird package com.mycompany.dao; public interface BirdDao{ public void saveFly(Fly fly); } package com.mycompany.dao.impl; public class BirdDaoImpl implements BirdDao{ public BirdDaoImpl(){ } public void saveFly(Fly fly){ System.out.println("I'm saving flight data..."); } } - ProjectFalcon package com.mycompany.myunit.dao; public interface FalconDao { public void saveHunt(Hunt hunt); } package com.mycompany.myunit.dao.impl; import com.mycompany.dao.impl.BirdDaoImpl; public class FalconDaoImpl extends BirdDaoImpl implements FalconDao{ public FalconDaoImpl(){ } public void saveHunt(Hunt hunt){ System.out.println("I'm saving hunt data... poor prey!"); } } When I try to run this schema on server, Spring raises an exception: Platform: Eclipse Luna 4.4 Spring Tool Suite 3.6.1 Severe: Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to load bean class: com.mycompany.myunit.dao.impl.FalconDaoImpl; nested exception is java.io.FileNotFoundException: class path resource [com/mycompany/dao/impl/BirdDaoImpl.class] cannot be opened because it does not exist at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:162) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:305) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) at org.springframework.context.support.PostProcessorRegistrationDelega…
has title: Spring importing extending and implementing class from a project
has comment: http://stackoverflow.com/comment/40602772

http://stackoverflow.com/a/26005563
accepted answer of: http://stackoverflow.com/q/25949642
answers question: http://stackoverflow.com/q/25949642
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41140531
has body: You don't need locking because entity classes are not thread-safe. Entities must not be shared between threads, that's all. Your database comes with ACID guarantees, but that is not always sufficient, and you sometimes nees to explicitely lock rows to get what you need. Imagine the following scenarios: transaction A reads employee 1 from database transaction B reads employee 1 from database transaction A sets employee 1 salary to 3000 transaction B sets employee 1 salary to 4000 transaction A commits transaction B commits The end result is that the salary is 4000. The user that started transaction A is completely unaware that even though he set the salary to 3000, another user, concurrently, set it to 4000. Depending on which transaction writes last, the end result is different (and thus unpredictable). That's the kind of situation that can be avoided using optimistic locking. Next scenario: you want to generate purely sequential invoice numbers, without lost values and without duplicates. You could imagine reading and incrementing a value in the database to do that. But two transactions might both read the same value concurrently, and then incrementing it. You would thus have a duplicate. Using a lock in the table row holding the next number allows avoiding this situation.

playframework-2.0
tags question: http://stackoverflow.com/q/26016604
tags question: http://stackoverflow.com/q/26011549
tags question: http://stackoverflow.com/q/25922747
tags question: http://stackoverflow.com/q/25969072
tags question: http://stackoverflow.com/q/25922749
type: Tag
tags question: http://stackoverflow.com/q/25964280
tag name: playframework-2.0
tags question: http://stackoverflow.com/q/26012735
tags question: http://stackoverflow.com/q/25949561
tags question: http://stackoverflow.com/q/25908857
tags question: http://stackoverflow.com/q/25947543

http://stackoverflow.com/q/25927652
answer count: 1
has body: I need to generate xls file from jsp. this is the code for generating the xls. response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); java.io.File fn=new java.io.File(this.getServletContext().getRealPath("/")+"BillSummaryReport.xls"); if(!fn.exists()){ fn.createNewFile(); } System.out.println(this.getServletContext().getRealPath("/")+"BillSummaryReport.xls"); //FileOutputStream fileOut = new FileOutputStream(f); java.io.FileInputStream fin = new java.io.FileInputStream(fn); ServletOutputStream outStream =response.getOutputStream(); hwb.write(response.getOutputStream()); response.setHeader("Content-Disposition","attachment;filename=BillSummaryReport.xls"); byte[] buffer = new byte[1024]; int n = 0; while ((n = fin.read(buffer)) != -1) { outStream.write(buffer, 0, n); System.out.println(buffer);} outStream.flush(); fin.close(); outStream.close(); } catch( Exception ex ) { System.out.println(ex); } Error occurs like this when i am trying to run the application. &gt;Sep 19, 2014 11:45:28 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [jsp] in context with path [/Midrest] 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:636) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:213) 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:194) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xls
has comment: http://stackoverflow.com/comment/40588397
tagged with: java
linked to: http://stackoverflow.com/q/14951041
tagged with: servlets
type: Question
has title: Generating Xls File Using JSP
tagged with: jsp
score: 0
has answer: http://stackoverflow.com/a/25927873

http://stackoverflow.com/comment/40671682
score: 0
has text: Reading this log, I can see you forgot _the package part_ in the full path: Surely your .class file is in m/ru/intetech/module/CModulePrinter2.class
type: AnswerComment
comment on: http://stackoverflow.com/a/25971705
type: Comment

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/25890680
tags question: http://stackoverflow.com/q/25934846
tags question: http://stackoverflow.com/q/26010067
tags question: http://stackoverflow.com/q/25993330
tags question: http://stackoverflow.com/q/25964505
type: Tag

http://stackoverflow.com/q/25931305
has comment: http://stackoverflow.com/comment/40594524
downvote count: 0
has comment: http://stackoverflow.com/comment/40595291
favorite count: 0
has comment: http://stackoverflow.com/comment/40595127
tagged with: android
tagged with: http://stackoverflow.com/tag/html
has body: I have a variable which contains an img tag and then various p tags. I want to remove all of these and be left with just the text. The text has several special characters within, such as &amp;#8211; and &amp;quot;. I am trying to convert all of this to just plain text to be displayed in an Android app. I've tried Html.escapeHtml but it just removes the &lt;img part and leaves the rest. Any ideas?
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/40594860
type: Question
has title: Stripping out all html on java variable
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40594605

android
tags question: http://stackoverflow.com/q/25914155
tags question: http://stackoverflow.com/q/25880267
tags question: http://stackoverflow.com/q/26024030
tags question: http://stackoverflow.com/q/25896360
tags question: http://stackoverflow.com/q/25991767
tags question: http://stackoverflow.com/q/25980118
tags question: http://stackoverflow.com/q/25983919
tags question: http://stackoverflow.com/q/25919574
tags question: http://stackoverflow.com/q/25931723
tags question: http://stackoverflow.com/q/25883396
tags question: http://stackoverflow.com/q/25989413
tags question: http://stackoverflow.com/q/25967571
tags question: http://stackoverflow.com/q/25909606
tags question: http://stackoverflow.com/q/25876926
tags question: http://stackoverflow.com/q/25983535
tags question: http://stackoverflow.com/q/26000418
tags question: http://stackoverflow.com/q/26014181
tags question: http://stackoverflow.com/q/25908272
tags question: http://stackoverflow.com/q/25998272
tags question: http://stackoverflow.com/q/25947221
tags question: http://stackoverflow.com/q/25930764
tags question: http://stackoverflow.com/q/25947198
tags question: http://stackoverflow.com/q/25931319
tags question: http://stackoverflow.com/q/25940748
tags question: http://stackoverflow.com/q/25894485
tags question: http://stackoverflow.com/q/25945474
tags question: http://stackoverflow.com/q/25996748
tags question: http://stackoverflow.com/q/25938662
tags question: http://stackoverflow.com/q/26010879
tags question: http://stackoverflow.com/q/25945504
tags question: http://stackoverflow.com/q/25906776
tags question: http://stackoverflow.com/q/25990790
tags question: http://stackoverflow.com/q/25966946
tags question: http://stackoverflow.com/q/26020937
tags question: http://stackoverflow.com/q/26005657
tags question: http://stackoverflow.com/q/25908457
tags question: http://stackoverflow.com/q/25900393
tags question: http://stackoverflow.com/q/25995231
tags question: http://stackoverflow.com/q/26027988
tags question: http://stackoverflow.com/q/26033835
tags question: http://stackoverflow.com/q/25889013
tags question: http://stackoverflow.com/q/25957093
tags question: http://stackoverflow.com/q/25876284
tags question: http://stackoverflow.com/q/25995806
tags question: http://stackoverflow.com/q/26006481
tags question: http://stackoverflow.com/q/25989048
tags question: http://stackoverflow.com/q/25875359
tags question: http://stackoverflow.com/q/26028625
tags question: http://stackoverflow.com/q/26025188
tags question: http://stackoverflow.com/q/25977183
tags question: http://stackoverflow.com/q/25972345
tags question: http://stackoverflow.com/q/25940187
tags question: http://stackoverflow.com/q/25875191
tags question: http://stackoverflow.com/q/25933697
tags question: http://stackoverflow.com/q/25882768
tags question: http://stackoverflow.com/q/25916595
tags question: http://stackoverflow.com/q/25974573
tags question: http://stackoverflow.com/q/25963127
tags question: http://stackoverflow.com/q/26018991
tags question: http://stackoverflow.com/q/25976590
tags question: http://stackoverflow.com/q/25924465
tags question: http://stackoverflow.com/q/25912550
tags question: http://stackoverflow.com/q/25997976
tags question: http://stackoverflow.com/q/25876575
tags question: http://stackoverflow.com/q/25968334
tags question: http://stackoverflow.com/q/26006278
tags question: http://stackoverflow.com/q/25980177
tags question: http://stackoverflow.com/q/25967570
tags question: http://stackoverflow.com/q/26027141
tags question: http://stackoverflow.com/q/25924459
tags question: http://stackoverflow.com/q/25902231
tags question: http://stackoverflow.com/q/25917630
tags question: http://stackoverflow.com/q/26033109
tags question: http://stackoverflow.com/q/25897758
tags question: http://stackoverflow.com/q/26029109
tags question: http://stackoverflow.com/q/25904720
tags question: http://stackoverflow.com/q/25993410
tags question: http://stackoverflow.com/q/25883306
tags question: http://stackoverflow.com/q/25881326
tags question: http://stackoverflow.com/q/25945873

http://stackoverflow.com/q/25974315
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40690484
tagged with: applet
has body: I'm trying to get an applet to work but it refuses to. Here's the code for the applet. &lt;html&gt; &lt;head&gt; &lt;title&gt;GAME!&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;GAME BY SID&lt;/h1&gt; &lt;hr&gt; &lt;applet code=GameManager.class width=240 height=300&gt; alt="Your browser understands the &amp;lt;APPLET&amp;gt; tag but isn't running the applet, for some reason." Your browser is completely ignoring the &amp;lt;APPLET&amp;gt; tag! &lt;/applet&gt; &lt;hr&gt; &lt;/body&gt; &lt;/html&gt; Here is the code for GameManager /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package alienLanding; import java.awt.*; import java.applet.*; import java.net.MalformedURLException; import java.net.URL; /** * * @author Admin */ public class GameManager extends Applet implements Runnable{ private int width; private int height; private Graphics offscreen; private Thread animation; private Image image; private GunManager gm; private UFOManager um; private Image gunImage; private Image ufoImages[]; private Image[] attackImages; private Image[] explodeImages; private AudioClip explosionSound; private static final int REFRESH_RATE=80; @Override public void init(){ showStatus("&gt;&gt;Initializing&lt;&lt;"); width=bounds().width; height=bounds().height; setBackground(Color.black); image=createImage(width,height); offscreen=image.getGraphics(); loadImages(); um=new UFOManager(width,height,ufoImages,attackImages,explodeImages,this,explosionSound); gm=new GunManager(width,height,gunImage,this,um.getUFOs()); um.intialize(gm); } private void loadImages(){ MediaTracker t=new MediaTracker(this); try{ URL baseURL; URL gunURL; //G:\EBOOKS\Java Game Programming\CD\BOOK\chap06 baseURL=new URL("file:///C:/ShortenedURLProgramming/ch06/"); gunURL=new URL(baseURL,"image/gun.gif"); gunImage=getImage(gunURL); t.addImage(gunImage,0); ufoImages=new Image[6]; URL UFOImageURL; for(int i=0;i&lt;ufoImages.length;++i){ UFOImageURL=new URL(baseURL,"i…
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6255106
tagged with: netbeans
tagged with: java
has answer: http://stackoverflow.com/a/25974804
has title: Can't get my java applet game running NoClassDefFoundError

http://stackoverflow.com/a/40319366
has body: I identified this same bug today on our systems. This is a bug in the JDK caused by the native implementation used in java. Was fixed as recently as 21st September 2016, so should be available in later JDK releases. This is the bug: https://bugs.openjdk.java.net/browse/JDK-8075484 If you can't wait, seems like someone has created a workaround: https://github.com/nukesparrow/JNativeSocket
score: 4
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25968769

http://stackoverflow.com/q/25998628
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40715124
favorite count: 0
accepted answer: http://stackoverflow.com/a/25998729
tagged with: android
type: AnsweredQuestion
has title: Itext list duplicate id = 1 android
tagged with: java
score: -4
tagged with: itext
has comment: http://stackoverflow.com/comment/40715347
type: Question
has body: Where is error? When I generate pdf then repeats itself and is id = 1 then id = 1 and only id = 2 and so on. List list = new List(List.ORDERED); String query = "SELECT * FROM property "; Cursor c1 = db.selectQuery(query); if (c1 != null &amp;&amp; c1.getCount() != 0) { if (c1.moveToFirst()) { do { list.add(c1.getString(c1.getColumnIndex("id"))); list.add(c1.getString(c1.getColumnIndex("type"))); list.add(c1.getString(c1.getColumnIndex("address"))); list.add(c1.getString(c1.getColumnIndex("value"))); list.add(c1.getString(c1.getColumnIndex("debt"))); list.add(c1.getString(c1.getColumnIndex("notes"))); doc.add(list); }while (c1.moveToNext()); } } c1.close();
has comment: http://stackoverflow.com/comment/40724881
has answer: http://stackoverflow.com/a/25998729
downvote count: 4

http://stackoverflow.com/a/26003232
has body: by programs if you mean 3dmax , maya , houdini ,zbrush , .. so the answer is no and you have to buy them yourself but if you mean models and scenes that are used during training yes they are in the package
accepted answer of: http://stackoverflow.com/q/25993360
score: 0
answers question: http://stackoverflow.com/q/25993360
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/77322332
score: 5
type: AnswerComment
type: Comment
has text: In Spring Boot 1.3.x it is `SecurityProperties.DEFAULT_FILTER_ORDER` and is `FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100` or simply `-100`.
comment on: http://stackoverflow.com/a/35765960

user-defined-functions
tags question: http://stackoverflow.com/q/26026027
type: Tag
tags question: http://stackoverflow.com/q/25982163
tag name: user-defined-functions

http://stackoverflow.com/q/26010312
score: 0
has comment: http://stackoverflow.com/comment/40737172
has comment: http://stackoverflow.com/comment/40737289
answer count: 1
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/40737203
tagged with: android
has comment: http://stackoverflow.com/comment/40737318
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40736439
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26010798
accepted answer: http://stackoverflow.com/a/26010798
has body: I am using an Async Task to Get Objects from a Database and Put them into an ArrayList. I am also using this same ArrayList to draw things on Screen. This is done through a for loop, that loops through the array. It seems that when the Async task is started, it clears the array list to populate it with the new Objects whilst the for loop is running sometimes, which results in an indexOutOfBounds exception. How do I prevent this behaviour? ASYNC: // GET ORDER LISTINGS: LIST ORDERS IN RANGE public void listOrders() { if (Utility.getCurrentLocation() != null) { handler.post(new Runnable() { public void run() { new ListOrdersTask().execute((Void) null); } }); } else { // Cannot Determine Location showMessage("Cannot Determine Location."); } } class ListOrdersTask extends AsyncTask&lt;Void, Void, Boolean&gt; { private void postData() { if (user.loggedIn) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "http://cyberkomm.ch/sidney/php/getOrders.php"); try { ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;( 4); nameValuePairs.add(new BasicNameValuePair("LatMin", String .valueOf(user.latitude - seekRange))); nameValuePairs.add(new BasicNameValuePair("LatMax", String .valueOf(user.latitude + seekRange))); nameValuePairs.add(new BasicNameValuePair("LongMin", String .valueOf(user.longitude - seekRange))); nameValuePairs.add(new BasicNameValuePair("LongMax", String .valueOf(user.longitude + seekRange))); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); BufferedReader in = new BufferedReader( new InputStreamReader(response.getEntity() .getContent())); StringBuffer sb = new StringBuffer(""); String line = ""; while ((line = in.readLine()) != null) { sb.append(line); break; } in.close(); responseString = sb.toString(); responseString = responseString.substring(0, responseString.length() - 1); // Handle Response user.orderList.clear(); String[] tm…
has title: Android Async Task ArrayList Manipulation Causes IndexOutOfBounds in onDraw

http://stackoverflow.com/comment/83829006
type: AnswerComment
comment on: http://stackoverflow.com/a/26024633
score: 0
type: Comment
has text: Check my question. Its a scenario which I faced. Not everyone need not the same.

http://stackoverflow.com/a/25925520
has comment: http://stackoverflow.com/comment/40584386
upvote count: 1
answers question: http://stackoverflow.com/q/25925490
has body: I think you will need to pass local info in toString() method. Here is an example in Java official documentation with Turkish as an example. Without Locale info, the toString() method will use default locale. Here is how to create Turkish Locale, Locale trlocale= Locale.forLanguageTag("tr_TR");
downvote count: 0
has comment: http://stackoverflow.com/comment/40584716
has comment: http://stackoverflow.com/comment/40584371
type: Answer
score: 1

http://stackoverflow.com/q/25921358
answer count: 1
has answer: http://stackoverflow.com/a/25925116
has title: Is there a way to resize child elements of a GridLayout so that they fit the screen?
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: layout
accepted answer: http://stackoverflow.com/a/25925116
has body: I have created a GridLayout with 6 rows and 6 columns and I want to fill it with ImageViews and TextViews. I placed the Views in the 6 columns, but they are too big for the screen. What is the best way to adjust them so that the GridLayout columns automatically adjust to the screen? Here is the XML that I have so far (only the first row is filled here) &lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:rowCount="6" android:columnCount="6"&gt; &lt;ImageView android:id="@+id/imageButton1" android:layout_column="0" android:layout_gravity="left|top" android:layout_row="0" android:src="@drawable/number_placeholder" /&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_column="1" android:layout_gravity="left|top" android:layout_row="0" android:src="@drawable/sign_placeholder" /&gt; &lt;ImageView android:id="@+id/imageButton2" android:layout_column="2" android:layout_gravity="left|top" android:layout_row="0" android:src="@drawable/number_placeholder" /&gt; &lt;ImageView android:id="@+id/imageView2" android:layout_column="3" android:layout_gravity="left|top" android:layout_row="0" android:src="@drawable/sign_placeholder" /&gt; &lt;ImageView android:id="@+id/imageButton3" android:layout_column="4" android:layout_gravity="left|top" android:layout_row="0" android:src="@drawable/sign_placeholder" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_column="5" android:layout_gravity="left|center_vertical" android:layout_row="0" android:text="TextView" /&gt; &lt;/GridLayout&gt;
score: 0
tagged with: android

http://stackoverflow.com/comment/40693089
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25986177
has text: where are your numcheese,numPepperoni declared and initialized? please edit that in your post
score: 1

http://stackoverflow.com/comment/40590441
type: Comment
has text: You are contradicting yourself... "Do not make the UI-Thread wait" and then you code a synchronized block into the UI-Thread ? It should be ok, if these two are the only accesses to it, but it is a possible hazard -> app not responding.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25925455

http://stackoverflow.com/a/66897807
score: -1
has body: You just need to loop over two strings if characters are matched increment the count and just remove those count from total len of two characters s = 'hackerhappy'\ t = 'hackerrank'\ count = 0 for i in range(len(s)): for j in range(len(t)): if s[i] == t[j]: count += 2 break char_unmatched = (len(s)+len(t)) - count char_unmatched contains the count of number of characters from both the strings that are not equal
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/25949977

http://stackoverflow.com/a/25884403
type: Answer
has body: I'm assuming you are using linux, sudo update-alternatives --config javac Then you can type your choice. If you get message like 'There is only one alternative...' then you should type to the terminal sudo update-alternatives --install "/usr/bin/javac" "javac" "/(your java home)/bin/javac" 1
answers question: http://stackoverflow.com/q/25884235
score: 5
downvote count: 0
upvote count: 5

hibernate
tags question: http://stackoverflow.com/q/25929212
tags question: http://stackoverflow.com/q/26017319
tags question: http://stackoverflow.com/q/26016678
tags question: http://stackoverflow.com/q/25972864
tags question: http://stackoverflow.com/q/25923672
tags question: http://stackoverflow.com/q/25909838
tags question: http://stackoverflow.com/q/25993631
tags question: http://stackoverflow.com/q/25892580
tags question: http://stackoverflow.com/q/26019857
tags question: http://stackoverflow.com/q/25893567
tags question: http://stackoverflow.com/q/25965446
tags question: http://stackoverflow.com/q/25894459
tags question: http://stackoverflow.com/q/26013769
tags question: http://stackoverflow.com/q/25926222
tags question: http://stackoverflow.com/q/25933474
tags question: http://stackoverflow.com/q/26029940
tags question: http://stackoverflow.com/q/25967935
tags question: http://stackoverflow.com/q/25986231
tags question: http://stackoverflow.com/q/25921111
tags question: http://stackoverflow.com/q/25986482
tags question: http://stackoverflow.com/q/25912599
tags question: http://stackoverflow.com/q/25981236
tags question: http://stackoverflow.com/q/25950605
tags question: http://stackoverflow.com/q/26009103
tags question: http://stackoverflow.com/q/25951570
tags question: http://stackoverflow.com/q/25979405
tags question: http://stackoverflow.com/q/25950065
tags question: http://stackoverflow.com/q/25911428
tags question: http://stackoverflow.com/q/26022184
tags question: http://stackoverflow.com/q/26030394
tags question: http://stackoverflow.com/q/25878158
tags question: http://stackoverflow.com/q/25948804
tags question: http://stackoverflow.com/q/25963897
tags question: http://stackoverflow.com/q/25964864
tags question: http://stackoverflow.com/q/25952489
tags question: http://stackoverflow.com/q/26021050
tags question: http://stackoverflow.com/q/25934968
tags question: http://stackoverflow.com/q/25911177
tags question: http://stackoverflow.com/q/26021985
tags question: http://stackoverflow.com/q/25969332
tags question: http://stackoverflow.com/q/25971953
tags question: http://stackoverflow.com/q/25967776
tags question: http://stackoverflow.com/q/25977082
tags question: http://stackoverflow.com/q/25988765
tags question: http://stackoverflow.com/q/25908496
tags question: http://stackoverflow.com/q/26032733
tags question: http://stackoverflow.com/q/25991831
tags question: http://stackoverflow.com/q/25922823
tags question: http://stackoverflow.com/q/25997438
tags question: http://stackoverflow.com/q/25885310
tags question: http://stackoverflow.com/q/25931281
tags question: http://stackoverflow.com/q/25944516
tags question: http://stackoverflow.com/q/25916477
tags question: http://stackoverflow.com/q/25897677
tags question: http://stackoverflow.com/q/25931948
tags question: http://stackoverflow.com/q/26028388
tag name: hibernate
tags question: http://stackoverflow.com/q/25960504
tags question: http://stackoverflow.com/q/25935978
tags question: http://stackoverflow.com/q/26024406
tags question: http://stackoverflow.com/q/25938331
tags question: http://stackoverflow.com/q/25893892
tags question: http://stackoverflow.com/q/25890569
tags question: http://stackoverflow.com/q/25936740
tags question: http://stackoverflow.com/q/25899269
tags question: http://stackoverflow.com/q/25921699
tags question: http://stackoverflow.com/q/25893476
tags question: http://stackoverflow.com/q/26014217
tags question: http://stackoverflow.com/q/25970797
tags question: http://stackoverflow.com/q/25886620
tags question: http://stackoverflow.com/q/25930805
tags question: http://stackoverflow.com/q/25935430
tags question: http://stackoverflow.com/q/25969544
tags question: http://stackoverflow.com/q/26031199
tags question: http://stackoverflow.com/q/25898909
tags question: http://stackoverflow.com/q/25948436
tags question: http://stackoverflow.com/q/25937421
tags question: http://stackoverflow.com/q/25961883
tags question: http://stackoverflow.com/q/25951930
tags question: http://stackoverflow.com/q/25970817

http://stackoverflow.com/a/25882746
upvote count: 4
has body: Initializing instance variables directly does not initialize them before creating the object - it's just syntactic sugar that Java provides to save you another line in the constructor. For example, the following snippet: public class MyClass { int member = 7; } Is equivilant to public class MyClass { int member; public MyClass() { memeber = 7; } }
accepted answer of: http://stackoverflow.com/q/25882658
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25882658

http://stackoverflow.com/comment/40597733
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25933171
has text: are you sure there are no javascript, cookies or redirection involved?
type: Comment

http://stackoverflow.com/a/25916870
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40568622
has body: Your mapping seems to be ok. As documented here 5.1.1. Entity The &lt;class&gt; attribute lazy is by default true lazy (optional): lazy fetching can be disabled by setting lazy="false". The same for &lt;many-to-one&gt;: 5.1.7.1. Using a foreign key or an association table lazy attribute: lazy (optional - defaults to proxy): by default, single point associations are proxied. lazy="no-proxy" specifies that the property should be fetched lazily when the instance variable is first accessed. This requires build-time bytecode instrumentation. lazy="false" specifies that the association will always be eagerly fetched. So, where is the issue? I would say in your debug window. Because you do have a reference to your list, and you are watching the result - in the moment it is executed - the reference is also loaded. Lazily - but loaded. That's in fact what we want. Proxy - when firstly tuched - is forcing the load. Try to remove it from watch. Or close the session and then put it in the watch... You should see, taht the query used above - is not loading references... only when really accessed... even via debug window
has comment: http://stackoverflow.com/comment/40568588
downvote count: 0
answers question: http://stackoverflow.com/q/25916563

http://stackoverflow.com/comment/40638671
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25956756
type: QuestionComment
has text: You get a NullPointerException when you access a variable which was manually set to null? This is surprising. Or in other words .. check the variable `arrayCount`.

http://stackoverflow.com/q/25962386
has comment: http://stackoverflow.com/comment/40649296
favorite count: 0
tagged with: android
answer count: 1
downvote count: 1
tagged with: maya
has title: Maya and Android Applications - TCP to send Mel commands to Maya
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: sockets
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/31193844
type: Question
upvote count: 2
has body: Here is a fun one... I am trying to develop a Android app that will let users control a camera in Autodesk Maya (a 3d modeling application). You can tell Maya to listen for Mel commands (maya's scripting language) on a specific port. So, I wrote this app to send the commands and I get the following errors: 09-21 14:07:34.021 23651-23651/com.jvspad.mayaterm I/System.out﹕ Begin.... 09-21 14:07:34.071 23651-24337/com.jvspad.mayaterm E/TCP Client﹕ C: Connecting... 09-21 14:07:34.182 23651-24337/com.jvspad.mayaterm E/TCP﹕ C: Error java.net.ConnectException: failed to connect to /10.0.0.2 (port 1024): connect failed: ECONNREFUSED (Connection refused) at libcore.io.IoBridge.connect(IoBridge.java:114) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.Socket.startupSocket(Socket.java:566) at java.net.Socket.<init>(Socket.java:225) at com.jvspad.mayaterm.DisplayMessageActivity$SendCommandTask.doInBackground(DisplayMessageActivity.java:71) at com.jvspad.mayaterm.DisplayMessageActivity$SendCommandTask.doInBackground(DisplayMessageActivity.java:62) at android.os.AsyncTask$2.call(AsyncTask.java:287) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:841) Caused by: libcore.io.ErrnoException: connect failed: ECONNREFUSED (Connection refused) at libcore.io.Posix.connect(Native Method) at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85) at libcore.io.IoBridge.connectErrno(IoBridge.java:127) at libcore.io.IoBridge.connect(IoBridge.java:112) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.Socket.startupSocket(Socket.java:566) at java.net.…

http://stackoverflow.com/comment/40624845
type: QuestionComment
comment on: http://stackoverflow.com/q/25948799
has text: I take it back, the `.intern()` at the end of your second line makes it different from [this](http://stackoverflow.com/questions/10045147/how-many-objects-are-being-created?rq=1), [this](http://stackoverflow.com/questions/1881922/questions-about-javas-string-pool), and [this](http://stackoverflow.com/questions/11180866/how-many-string-objects-will-be-created-in-memory?lq=1).
score: 0
type: Comment

http://stackoverflow.com/comment/40725834
type: Comment
type: QuestionComment
score: 0
has text: The issue was fixed after restarting my server. I will post an answer if I can figure out what was happening from the logs.
comment on: http://stackoverflow.com/q/26002483

http://stackoverflow.com/q/25898028
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25898533
has body: I've tried searching for this and all the documentation seems to be from the perspective of creating a new keystore and/or a new alias. However, I have the keystore with the alias I want as a PrivateKeyEntry and the soon-to-expire Globalsign code-signing certificate installed to it. Now, I want to know the proper procedure for updating the certificate with a new one under the same alias/PrivateKeyEntry? TIA for your help. Regards, B.K.
tagged with: code-signing
linked to: http://stackoverflow.com/q/150167
score: 0
answer count: 2
has title: Update java keystore alias with new code-signing certificate
tagged with: keytool
tagged with: keystore
has answer: http://stackoverflow.com/a/25899599
accepted answer: http://stackoverflow.com/a/25899599
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25898533

http://stackoverflow.com/comment/40529988
type: Comment
comment on: http://stackoverflow.com/a/25874925
has text: I have no idea, because my english is not very good i keep getting moderators modyfing my original post. I dont know if its the moderators that downvote my post. But this is definetly solved
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40635393
score: 1
comment on: http://stackoverflow.com/a/25954962
type: AnswerComment
type: Comment
has text: Yes. It's so close that I might mistake you for standing behind me now. Haha. Thanks bunches for clarifying this and providing detailed explanations.

http://stackoverflow.com/comment/40634800
has text: @Jerry That changes everything, you should've mentioned from the beginning you were having trouble understanding the for loop
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25954556

http://stackoverflow.com/q/25884704
has answer: http://stackoverflow.com/a/25885015
favorite count: 0
has title: splitting strings with , space, ordinal number and commas
type: Question
has comment: http://stackoverflow.com/comment/40509632
score: -1
tagged with: java
answer count: 3
accepted answer: http://stackoverflow.com/a/25885015
downvote count: 1
has body: Tuesday, 7th of May 2013 splitting this I want to have 7, "may" and 2013, what if the day is 1st 2nd and 3rd day of the month?
has answer: http://stackoverflow.com/a/25884883
has answer: http://stackoverflow.com/a/25885022
tagged with: split
possible better answer: http://stackoverflow.com/a/25884883
type: AnsweredQuestion
upvote count: 0
tagged with: string

http://stackoverflow.com/comment/52718426
type: Comment
comment on: http://stackoverflow.com/a/30441841
score: 1
type: AnswerComment
has text: Can you please explain this? What's the logic?

http://stackoverflow.com/q/26016188
linked to: http://stackoverflow.com/q/9283040
linked to: http://stackoverflow.com/q/19006793
has body: I have two android application projects in my workspace, Testobject and MyAndroidApplication. I would like to use one of them, Testobject, as a base for the new one. For that purpose, I have setting up Testobject as a library (Properties - Android - checked Checkbox Is Library). In MyAndroidApplication I have add the lib Testobject (Properties - Android - Add...). Now I can use all classes and ressources from Testobject: reference library I have used an XML from Testobject and changed for example the ImageView. /** called when the activity is first created */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView stImageView = (ImageView) findViewById(R.id.imageview_ov_remote); stImageView.setImageResource(R.drawable.car_launcher); } While clicking the ImageView, a new activity get started. Intent intent = new Intent(this, TestKlasse1.class); startActivity(intent); The started activity is in the project Testobject. How can I change a TextView from TestKlasse1 in the project MyAndroidApplication? //cutout from Testklasse1 in Testobject TextView testString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_testklasse_eins); testString = (TextView) findViewById(R.id.testKlasse1TextView); } I won't change the content in TestKlasse1, because I want to use this class for different apps. For example for a supermarket app or an automobile manufacturer app. I don't want only to change the ic_launcher. Multiple Applications with different names How can I change for example the TextView, though the class is in another project?
score: 1
tagged with: java
tagged with: eclipse
type: Question
has title: Using the same android app as a base for a new one
downvote count: 0
tagged with: android
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26016469
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/25976120
answer count: 9
has answer: http://stackoverflow.com/a/49976575
tagged with: log4j2
tagged with: logging
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/37616587
has answer: http://stackoverflow.com/a/25976208
tagged with: java
has answer: http://stackoverflow.com/a/78417325
type: Question
possible better answer: http://stackoverflow.com/a/37616587
has answer: http://stackoverflow.com/a/25976379
downvote count: 0
has answer: http://stackoverflow.com/a/49399303
has body: I have the log4j-api-2.0.0.jar and log4j-core-2.0.2.jar import into my build path. But somehow the following code were fail: import org.apache.logging.log4j.core.Logger; public class TheClass { private static Logger log = Logger.getLogger(TheClass.class); ... And the error message shows that: The method getLogger(Class&lt;TheClass&gt;) is undefined for the type Logger I am just so curious is getLogger() no longer a valid method in Logger?
score: 39
accepted answer: http://stackoverflow.com/a/25976208
upvote count: 39
has title: Method getLogger() no longer a member of Logger in log4j2?
has answer: http://stackoverflow.com/a/77101007
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/25977825
has answer: http://stackoverflow.com/a/43669191

http://stackoverflow.com/comment/40758318
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26021985
score: 0
has text: are you using hibernate with or without JPA? what version of vaadin your project is using?

http://stackoverflow.com/a/25921002
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25921000
score: 0
type: Answer
has body: It turned out we had deployed the XA Drivers JDBC to Weblogic 12C when we really needed the Standard JDBC Drivers in this environment. Thanks, Tom
answers question: http://stackoverflow.com/q/25921000

http://stackoverflow.com/q/26010367
has title: cxf rest service jboss deployment exception
downvote count: 0
tagged with: cxf
tagged with: java
type: Question
score: 3
upvote count: 3
has body: Working on a CXF rest service. This is the interface import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @Path("/example") @Produces("application/json") public interface TrackerService { @GET @Path("/{id}") public String get(@PathParam("id") String id); } Implementation class import org.springframework.stereotype.Service; import com.service.TrackerService; @Service("trackerService") public class TrackerImpl implements TrackerService { public String get(String id) { // TODO Auto-generated method stub return "HELLO"; } web.xml, where CXF servlet is defined <?xml version="1.0" encoding="UTF-8"?> Admin index.html index.htm index.jsp default.html default.htm default.jsp contextConfigLocation /WEB-INF/cxf-service.xml org.springframework.web.context.ContextLoaderListener CXFServlet org.apache.cxf.transport.servlet.CXFServlet 1 CXFServlet /services/* cxf-service.xml, where beans are registered <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:cxf="http://cxf.apache.org/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd"> <context:component-scan base-package="com" /> <jaxrs:server id="trackerCxfServer" address="/"> <jaxrs:serviceBeans> </jaxrs:serviceBeans> <jaxrs:extensionMappings> <entry key="json" value="application/json"/> </jaxrs:extensionMappings> <jaxrs:features> <cxf:logging/> </jaxrs:features> <jaxrs:providers> <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" /> </j…
has answer: http://stackoverflow.com/a/26011320
answer count: 1
favorite count: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/40738114
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40737931
tagged with: jboss-eap-6
tagged with: spring

http://stackoverflow.com/q/25899632
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40537350
has body: I have a simple example program here: package com.test; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.support.FileSystemXmlApplicationContext; public class Main { public static void main(String[] args) throws InterruptedException { try { FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext("TestBeanFile.xml"); Object o = context.getBean("AInstance"); } catch (Throwable e) { e.printStackTrace(); } Thread.sleep(Long.MAX_VALUE); } private static class A implements InitializingBean { private B myB; public A() { System.out.println("A constructor"); } public void setB(B aB) { myB = aB; } @Override public void afterPropertiesSet() throws Exception { System.out.println("A aps"); } } private static class B implements Runnable, InitializingBean { private C myC; private volatile boolean exit = false; public B() { System.out.println("B constructor"); } public void setC(C aC) { myC = aC; } @Override public void afterPropertiesSet() throws Exception { System.out.println("B aps"); if (myC == null) throw new IllegalArgumentException("C cannot be null"); new Thread(this).start(); } public void exit() { exit = true; } @Override public void run() { while (!exit) { System.out.println(myC.getValue()); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } private static class C implements InitializingBean { private String value = "C's value"; public C() { System.out.println("C constructor"); } public String getValue() { return value; } @Override public void afterPropertiesSet() throws Exception { System.out.println("C aps"); } } } And here is a simple XML to bean load them which intentionally has an incorrect fully qualified name to the A class. This should mean that C B and A dont get constructed. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance…
has answer: http://stackoverflow.com/a/25900576
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40537267
favorite count: 0
accepted answer: http://stackoverflow.com/a/25900576
has title: Spring Bean object marshaling depends on the order given in the XML?

http://stackoverflow.com/comment/40648912
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25961553
type: Comment
has text: May I suggest to use a little less indentation spaces? I agree, nowadays' widescreens are wide. But SO's content area is not and horizontal scrolling is cumbersome.

http://stackoverflow.com/comment/40781208
type: Comment
type: QuestionComment
has text: If you want help from SO, then find a way that prints the stacktrace into the browser window and not into a log-file. The community has no access to them and the reason for this error is individual from a individual project.
score: 0
comment on: http://stackoverflow.com/q/26033729

http://stackoverflow.com/comment/40490506
score: 1
comment on: http://stackoverflow.com/q/25874120
type: Comment
type: QuestionComment
has text: Searching for the solution would have helped you too! Read carefully the http://stackoverflow.com/tour

tomcat
tags question: http://stackoverflow.com/q/26002682
tags question: http://stackoverflow.com/q/25970123
tags question: http://stackoverflow.com/q/25938089
tags question: http://stackoverflow.com/q/26018332
tags question: http://stackoverflow.com/q/25876897
tags question: http://stackoverflow.com/q/26018748
tags question: http://stackoverflow.com/q/25984373
tags question: http://stackoverflow.com/q/25890198
tags question: http://stackoverflow.com/q/26018963
tags question: http://stackoverflow.com/q/26005684
tags question: http://stackoverflow.com/q/26026142
tags question: http://stackoverflow.com/q/25947576
tags question: http://stackoverflow.com/q/25957790
tags question: http://stackoverflow.com/q/25940090
tags question: http://stackoverflow.com/q/26006521
tags question: http://stackoverflow.com/q/25938270
tags question: http://stackoverflow.com/q/26025927
tags question: http://stackoverflow.com/q/26028210
tags question: http://stackoverflow.com/q/25883588
tags question: http://stackoverflow.com/q/25885758
tags question: http://stackoverflow.com/q/26029308
tags question: http://stackoverflow.com/q/25917773
tags question: http://stackoverflow.com/q/25963087
tags question: http://stackoverflow.com/q/26024290
tags question: http://stackoverflow.com/q/25927230
tags question: http://stackoverflow.com/q/25988189
tags question: http://stackoverflow.com/q/25956370
tags question: http://stackoverflow.com/q/25886658
tags question: http://stackoverflow.com/q/26022614
tags question: http://stackoverflow.com/q/25875401
tags question: http://stackoverflow.com/q/26025941
tags question: http://stackoverflow.com/q/25928486
tags question: http://stackoverflow.com/q/25963457
tags question: http://stackoverflow.com/q/25897413
tags question: http://stackoverflow.com/q/25949598
tag name: tomcat
tags question: http://stackoverflow.com/q/25992231
tags question: http://stackoverflow.com/q/25889586
tags question: http://stackoverflow.com/q/25935810
tags question: http://stackoverflow.com/q/25987860
tags question: http://stackoverflow.com/q/26005483
tags question: http://stackoverflow.com/q/25931170
tags question: http://stackoverflow.com/q/25971965
tags question: http://stackoverflow.com/q/25892337
tags question: http://stackoverflow.com/q/25941726
tags question: http://stackoverflow.com/q/26027839
tags question: http://stackoverflow.com/q/25875396
tags question: http://stackoverflow.com/q/25894459
tags question: http://stackoverflow.com/q/26027275
tags question: http://stackoverflow.com/q/25941892
tags question: http://stackoverflow.com/q/26030851
tags question: http://stackoverflow.com/q/25887766
tags question: http://stackoverflow.com/q/25931750
tags question: http://stackoverflow.com/q/25880952
tags question: http://stackoverflow.com/q/25878554
tags question: http://stackoverflow.com/q/25902804
tags question: http://stackoverflow.com/q/25898168
tags question: http://stackoverflow.com/q/25937487
type: Tag
tags question: http://stackoverflow.com/q/26021985
tags question: http://stackoverflow.com/q/25879125
tags question: http://stackoverflow.com/q/25926593
tags question: http://stackoverflow.com/q/25910536
tags question: http://stackoverflow.com/q/25897954
tags question: http://stackoverflow.com/q/25876829
tags question: http://stackoverflow.com/q/25924245
tags question: http://stackoverflow.com/q/25875947
tags question: http://stackoverflow.com/q/25978398
tags question: http://stackoverflow.com/q/25930167
tags question: http://stackoverflow.com/q/25929756
tags question: http://stackoverflow.com/q/25877575
tags question: http://stackoverflow.com/q/25926532
tags question: http://stackoverflow.com/q/25918711
tags question: http://stackoverflow.com/q/25978915
tags question: http://stackoverflow.com/q/25916211
tags question: http://stackoverflow.com/q/25908046
tags question: http://stackoverflow.com/q/25931940
tags question: http://stackoverflow.com/q/26018079
tags question: http://stackoverflow.com/q/25921000
tags question: http://stackoverflow.com/q/25980860

http://stackoverflow.com/comment/40552422
type: QuestionComment
has text: Thanks Andrei. It worked. Now i need to get distinct highlight. I am getting Shampoo multiple times
comment on: http://stackoverflow.com/q/25906975
score: 0
type: Comment

byte
tags question: http://stackoverflow.com/q/25898612
tag name: byte
tags question: http://stackoverflow.com/q/25890776
type: Tag
tags question: http://stackoverflow.com/q/25890122
tags question: http://stackoverflow.com/q/25961581

http://stackoverflow.com/q/25985282
has comment: http://stackoverflow.com/comment/40691547
type: AnsweredQuestion
has title: How to create an arraylist from a file where the input for the program is IntegerType?
accepted answer: http://stackoverflow.com/a/25985720
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40691887
tagged with: java
has comment: http://stackoverflow.com/comment/40691717
score: -1
has comment: http://stackoverflow.com/comment/40691573
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40692660
has comment: http://stackoverflow.com/comment/40691635
favorite count: 0
has answer: http://stackoverflow.com/a/25985720
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40691541
has body: Forgive me if this may seem elementary/answered but I am not understanding how to apply it to my program. I'm trying to create a program that accepts an array of either integers or strings from a text file which will then be sorted by other classes with the isBetterThan() method in the sort classes. How can I accept input from a text file line by line to create an array of IntegerType or StringType? (Integer/String and File will be user input.) As it sits, I'm getting an error which is either "no suitable method" for the array class or "incompatible types". Thanks. import java.util.ArrayList; import java.util.Scanner; import java.io.*; public class Insert { public static void main(String[] args) throws IOException { //Variables String fileName; IntegerType line; ArrayList&lt;IntegerType&gt; aList = new ArrayList&lt;IntegerType&gt;(); //Ask for which file Scanner scan = new Scanner (System.in); System.out.print ("Enter the pathname of the input file: "); fileName = scan.nextLine(); Scanner s = new Scanner(new File(fileName)); //--------------------My problem while (s.hasNext()){ aList.add(s.next()); } s.close(); } } class IntegerType implements AnyType { private int number; public IntegerType() { number = 0; } public IntegerType(int i) { number = i; } public boolean isBetterThan(AnyType datum) { return (this.number &gt; ((IntegerType)datum).number); } public int toInteger() { return number; } } class StringType implements AnyType { private String word; public StringType(){ word = ""; } public StringType(String s){ word = s; } public boolean isBetterThan(AnyType datum) { return (this.word.compareTo(((StringType)datum).word) &gt; 0); } public String toString() { return word; } } interface AnyType { public boolean isBetterThan(AnyType datum); }

http://stackoverflow.com/a/25996050
accepted answer of: http://stackoverflow.com/q/25940384
answers question: http://stackoverflow.com/q/25940384
has body: Well I got it to work perfectly with this instead of the limit filter: searchQueryBuilder = searchQueryBuilder.withPageable(new PageRequest(0, limit));
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/40611361
score: 0
has text: Unfortunately, I don't own the server side.
comment on: http://stackoverflow.com/q/25937821
type: QuestionComment
type: Comment

fileoutputstream
tags question: http://stackoverflow.com/q/25915934
type: Tag
tag name: fileoutputstream

http://stackoverflow.com/comment/40896085
has text: I think that with `Context#registerReceiver` the receiver gets called in the activity thread, so it will only work if that activity is up and running
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26055054
type: AnswerComment

http://stackoverflow.com/q/25881212
tagged with: java
accepted answer: http://stackoverflow.com/a/25881315
possible better answer: http://stackoverflow.com/a/58942095
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/58942095
downvote count: 0
has title: What is the equivalent of register-defaults="false" in Spring 4?
favorite count: 0
has answer: http://stackoverflow.com/a/25881315
upvote count: 7
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has body: How can I configure my custom message converter to have register-defaults="false" in a XML-less project with Spring 4? &lt;mvc:annotation-driven register-defaults="false"&gt; &lt;mvc:message-converters&gt; &lt;bean class="myproject.MyCustomHttpMessageConverter"/&gt; &lt;/mvc:message-converters&gt; &lt;/mvc:annotation-driven&gt; Currently I have this Configuration: @Configuration @EnableWebMvc @ComponentScan public class TestDataConfig extends WebMvcConfigurerAdapter { @Override public void configureMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) { final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); converters.add(converter); } } Thank you
score: 7

http://stackoverflow.com/comment/40499515
type: Comment
has text: so, what about this? http://stackoverflow.com/a/15840257/3960528 He is proving with the source code.
comment on: http://stackoverflow.com/a/25878681
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40506245
score: 1
comment on: http://stackoverflow.com/a/25882358
has text: The word 'stop' is chosen a bit unlucky since a thread can also by really stopped and this functionality is deprecated. The thread that calls join blocks till the callee completes.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25922163
has title: Play 2.3.4 unable to create new project [TimeOut Exception]
has body: I'm calling the activator to create a new project with the play-java template activator new "projectName" 3 It always fail and I get the following error: akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://default/user/te mplate-cache#1973480390]] after [10000 ms] at akka.pattern.PromiseActorRef$$anonfun$1.apply$mcV$sp(AskSupport.scala :333) at akka.actor.Scheduler$$anon$7.run(Scheduler.scala:117) at scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Fu ture.scala:599) at scala.concurrent.BatchingExecutor$class.execute(BatchingExecutor.scal a:109) at scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scal a:597) at akka.actor.LightArrayRevolverScheduler$TaskHolder.executeTask(Schedul er.scala:467) at akka.actor.LightArrayRevolverScheduler$$anon$8.executeBucket$1(Schedu ler.scala:419) at akka.actor.LightArrayRevolverScheduler$$anon$8.nextTick(Scheduler.sca la:423) at akka.actor.LightArrayRevolverScheduler$$anon$8.run(Scheduler.scala:37 5) at java.lang.Thread.run(Thread.java:745) I tried to increase the timeout: activator -Dactivator.timeout=30s but I get the exception in less than a second regardless.
score: 0
tagged with: playframework
has comment: http://stackoverflow.com/comment/40578813
answer count: 1
has answer: http://stackoverflow.com/a/28447344
accepted answer: http://stackoverflow.com/a/28447344
has comment: http://stackoverflow.com/comment/40618539
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/25977179
has comment: http://stackoverflow.com/comment/40676031
has comment: http://stackoverflow.com/comment/40676376
has comment: http://stackoverflow.com/comment/40676193
has comment: http://stackoverflow.com/comment/40676143
has comment: http://stackoverflow.com/comment/40676221
has body: If you are trying to run a class you need the main method. Add the main method to the class and put the code you are trying to execute inside the main method and it should execute. Also post the code you do have so it's easier for us to understand what you are trying to do. public static void main(String[] args) { //code goes here }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40676078
answers question: http://stackoverflow.com/q/25977150

http://stackoverflow.com/q/25929514
type: UnansweredQuestion
tagged with: java
tagged with: onedrive
type: Question
score: 3
has body: I am trying to upload a file into OneDrive folder using POST REST call. My application is able to communicate with OneDrive. The response I am getting says The request entity body isn't a valid JSON object. Below is my Code, Kindly let me know the wrong part of code or my approach. public static void onedriveFileUpload() { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost uploadFile = new HttpPost("https://apis.live.net/v5.0/folder.id"); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); uploadFile.addHeader("Authorization", "Bearer access_token"); builder.addPart("file", new FileBody(new File("Test.txt"), ContentType.APPLICATION_OCTET_STREAM, "Test.txt")); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); Charset chars = Charset.forName("utf-8"); builder.setCharset(chars); uploadFile.setEntity(builder.build()); uploadFile.setHeader("Content-Type", "multipart/form-data"); uploadFile.setHeader("charset", "UTF-8"); uploadFile.setHeader("boundary", "AaB03x"); HttpResponse response = null; try { response = httpClient.execute(uploadFile); HttpEntity responseEntity = response.getEntity(); String json = EntityUtils.toString(responseEntity); System.out.println(json); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } Here is the Json response I am getting from OneDrive. { "error": { "code": "request_body_invalid", "message": "The request entity body isn't a valid JSON object." } }
has comment: http://stackoverflow.com/comment/40684151
tagged with: http-headers
has answer: http://stackoverflow.com/a/27031752
answer count: 2
has answer: http://stackoverflow.com/a/27474804
tagged with: multipartform-data
downvote count: 0
favorite count: 0
has title: Onedrive API file Upload using Java
tagged with: multipartentity
upvote count: 3

http://stackoverflow.com/comment/40660419
score: 0
has text: Sure! Nothing has changed.
comment on: http://stackoverflow.com/q/25967906
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25980953
type: Question
has answer: http://stackoverflow.com/a/25985722
tagged with: java
has answer: http://stackoverflow.com/a/25997053
has body: I've tried to delete my videos with this code, but on some devices they appear as damaged videos that can't be played in Gallery. File videoFile = new File(filepath); videoFile.delete(); How can I delete them properly?
has title: How to delete a video from Gallery?
score: 0
answer count: 3
tagged with: android
tagged with: gallery
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25981563

http://stackoverflow.com/q/25924656
type: UnansweredQuestion
has body: I'm trying to compile a jMonkeyEngine project I made a while back. But when I compile I get a message saying "lwjgl.dll (Access is denied)." I have looked online for some help but found nothing. FYI: I'm using an AMD A6 64-bit CPU with Windows 8. Stacktrace: Sep 18, 2014 7:30:33 PM com.jme3.system.JmeDesktopSystem initialize INFO: Running on jMonkeyEngine 3.0.0 Beta Sep 18, 2014 7:30:33 PM com.jme3.system.Natives extractNativeLibs INFO: Extraction Directory: E:\JME\jMonkeyEngine 3.0\Lab11 Sep 18, 2014 7:30:33 PM com.jme3.system.JmeDesktopSystem initialize SEVERE: Error while copying native libraries java.io.FileNotFoundException: E:\JME\jMonkeyEngine 3.0\Lab11\lwjgl.dll (Access is denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:221) at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:171) at com.jme3.system.Natives.extractNativeLib(Natives.java:170) at com.jme3.system.Natives.extractNativeLib(Natives.java:113) at com.jme3.system.Natives.extractNativeLibs(Natives.java:265) at com.jme3.system.JmeDesktopSystem.initialize(JmeDesktopSystem.java:309) at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:228) at com.jme3.system.JmeSystem.newContext(JmeSystem.java:128) at com.jme3.app.Application.start(Application.java:387) at com.jme3.app.Application.start(Application.java:368) at com.jme3.app.SimpleApplication.start(SimpleApplication.java:130) at lab11.Lab11.main(Lab11.java:105) Sep 18, 2014 7:30:34 PM com.jme3.system.lwjgl.LwjglAbstractDisplay run INFO: Using LWJGL 2.8.4 Sep 18, 2014 7:30:34 PM com.jme3.system.lwjgl.LwjglDisplay createContext INFO: Selected display mode: 500 x 500 x 0 @0Hz Sep 18, 2014 7:30:37 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo INFO: Adapter: aticfx64 Sep 18, 2014 7:30:37 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo INFO: Driver Version: null Sep 18, 2014 7:30:37 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo …
tagged with: java
tagged with: file
has title: jMonkeyEngine: lwjgl.dll (Access is denied)
type: Question
has answer: http://stackoverflow.com/a/25925581
tagged with: dll
score: 0
answer count: 1
tagged with: jmonkeyengine
tagged with: sdk

http://stackoverflow.com/comment/40579514
type: Comment
has text: Fix your indentation please
score: 1
comment on: http://stackoverflow.com/q/25922801
type: QuestionComment

http://stackoverflow.com/q/25922920
linked to: http://stackoverflow.com/q/10326460
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: webserver
accepted answer: http://stackoverflow.com/a/25923002
upvote count: 4
answer count: 1
downvote count: 0
tagged with: jax-rs
has body: I have a workflow that involves doing a HTTP POST from my Java client to my web server. The body of the post has a specification object. I then pass that on from my webserver to Apache ZooKeeper (which runs in its own process on the server) that runs a big hairy calculation. I am struggling with figuring out how to send back the bytes to my webserver in streaming fashion. I need it to stream back because I have a HTTP GET request on my webserver from my Java client that is waiting to stream back the bytes. I cannot wait for the whole calculation to finish, I want bytes sent as soon as possible back to the client. Most the examples online for JAX-RS that do a HTTP PUT from the client side and on the webserver side don't have examples for streaming code. I'll post what I have so far, but it doesn't work. Here is my ZooKeeper Java code, which calls a JAX-RS client-side PUT. I am really unsure of how to do this, I have never tried streaming data with JAX-RS. final Client client = ClientBuilder.newClient(); final WebTarget createImageTarget = client.target("groups/{imageGroupUuid:" + Regex.UUID + "}"); StreamingOutput imageResponse = createImageTarget.request(MediaType.APPLICATION_OCTET_STREAM).put(Entity.entity(createRandomImageDataBytes(imageConfigurationObject), MediaType.APPLICATION_OCTET_STREAM), StreamingOutput.class); Here is my webserver code which handles the HTTP PUT. It is just a stub because I have no confidence in my client side HTTP PUT. @PUT @PATH("groups/{uuid:" + Regex.UUID + "}") @Consumes(MediaType.APPLICATION_OCTET_STREAM) public void updateData(StreamingOutput streamingOutput) { }
has answer: http://stackoverflow.com/a/25923002
favorite count: 0
score: 4
has title: Streaming bytes via HTTP PUT with JAX-RS
tagged with: streaming
has comment: http://stackoverflow.com/comment/40724939
tagged with: http

http://stackoverflow.com/q/25948090
type: Question
tagged with: spring-security
answer count: 2
has answer: http://stackoverflow.com/a/29419369
upvote count: 17
favorite count: 0
has title: How Spring Security add/configure AuthenticationManagerBuilder?
type: UnansweredQuestion
has body: I am working on Spring Security Java-based configuration. I have created my own MyAuthenticationProvider which I want to register in the ProviderManager (single instance of AuthenticationManager). I have found that ProviderManager has a list of providers to which I can register my single MyAuthenticationProvider. Here is the part of my Configuration: @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(MyAuthenticationProvider); } } I found out that AuthenticationManagerBuilder has parentAuthenticationManager, defaultUserDetailsService and many other fields. My questions are: Where is this @Autowired annotation adding AuthenticationManagerBuilder auth from? Is the AuthenticationManagerBuilder already created in the application context? What would be the default state of AuthenticationManagerBuilder which is being injected? By default state I mean will there be some parentAuthenticationManager, authenticationProviders already registered in the AuthenticationManagerBuilder? If I am adding auth.authenticationProvider(MyAuthenticationProvider), does this mean that I am adding one more provider in the AuthenticationManagerBuilder? What does this mean? Taken from Spring Documentation The name of the configureGlobal method is not important. However, it is important to only configure AuthenticationManagerBuilder in a class annotated with either @EnableWebSecurity, @EnableWebMvcSecurity, @EnableGlobalMethodSecurity, or @EnableGlobalAuthentication. Doing otherwise has unpredictable results.
has answer: http://stackoverflow.com/a/54603001
downvote count: 0
tagged with: java
score: 17

http://stackoverflow.com/q/26010602
accepted answer: http://stackoverflow.com/a/26010617
has comment: http://stackoverflow.com/comment/40737496
has answer: http://stackoverflow.com/a/26010720
tagged with: string
has body: How to get first character of string? string test = "StackOverflow"; first character = "S"
has answer: http://stackoverflow.com/a/26010632
favorite count: 0
has answer: http://stackoverflow.com/a/26010631
has title: Android How to get first character of string?
has comment: http://stackoverflow.com/comment/40737013
answer count: 4
possible better answer: http://stackoverflow.com/a/26010631
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26010617
downvote count: 10
type: Question
has comment: http://stackoverflow.com/comment/40737092
linked to: http://stackoverflow.com/q/11229986
score: 43
upvote count: 53

http://stackoverflow.com/a/25924919
has comment: http://stackoverflow.com/comment/40583217
has comment: http://stackoverflow.com/comment/40634412
type: Answer
has comment: http://stackoverflow.com/comment/40584139
has body: The else statement is repeated before the while statement. There can however sometimes be a problem with Streams. A Stream does not necessarily print the data immediately. Especially in the case one uses two different streams, the order of printing the output data can be interleaved. You can use: System.err.flush(); to ensure the data is written to the console first.
score: 0
answers question: http://stackoverflow.com/q/25924857

http://stackoverflow.com/comment/40550728
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25907380
score: 0
has text: Note that `delete()` returns false on failure; it doesn't throw an exception. Regarding your problem, is the file open?

http://stackoverflow.com/q/25890198
has comment: http://stackoverflow.com/comment/40522503
score: 1
has comment: http://stackoverflow.com/comment/40519355
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
tagged with: deployment
has title: Eclipse not deploying 'Web Content' to root folder
has comment: http://stackoverflow.com/comment/40519199
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40521994
type: Question
has comment: http://stackoverflow.com/comment/40520033
has answer: http://stackoverflow.com/a/26215944
has body: I have following in my workspace : and below on configured as deployment assembly : Still I dont see everything deployed to : \.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\&lt;workspace&gt; What could be going wrong ?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40521807
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/40496558
has text: @blueberryfields: Right, that would make perfect sense. It would have been nice to have that information from the start :) I suggest you either edit this question significantly and use 1.2 everywhere, or delete the question while you search for a way of making WebLogic use 2.3.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25877208
type: Comment

http://stackoverflow.com/comment/40720169
score: 1
comment on: http://stackoverflow.com/a/25990689
type: AnswerComment
has text: Checkout this project https://github.com/tmarwen/stackoverflow-showcase/tree/master/cxf-rest
type: Comment

http://stackoverflow.com/comment/40579584
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25914987
type: QuestionComment
has text: Ugh.. silly me. That is not a good test. It would work anyway since you already have the agns jar with dependencies (includes slf4j) in your class path. I assume you dumped the actual object ie `LOCAL.APNSService` and verified the method is there? Is there anything else listed in the stack trace OR CF error logs? Sometimes the cause is further down in the chained message.

http://stackoverflow.com/q/25961122
has title: java.awt.Graphics, how to define position?
has answer: http://stackoverflow.com/a/25961147
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40646794
downvote count: 1
type: Question
tagged with: graphics
accepted answer: http://stackoverflow.com/a/25961147
answer count: 1
has comment: http://stackoverflow.com/comment/40646657
has body: So, I've noticed that when overriding JFrame, or JPanel's paint method that the graphics context provided's position is relative to the component. For example: public class Example extends JFrame { JPanel panel1 = new JPanel() { public void paint(Graphics g) { super.paint(g); g.setColor(Color.LIGHT_GRAY); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.blue); g.fillRect(0, 0, 25, 25); } }; JPanel panel2 = new JPanel() { public void paint(Graphics g) { super.paint(g); g.setColor(Color.GRAY); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.blue); g.fillRect(0, 0, 25, 25); } }; public Example() { setTitle("Test"); setSize(800, 600); setLocationRelativeTo(null); setDefaultCloseOperation(3); setLayout(null); panel1.setBounds(0, 0, 400, 600); add(panel1); panel2.setBounds(400, 0, 400, 600); add(panel2); setVisible(true); } public static void main(String args[]) throws Exception { SwingUtilities.invokeAndWait(new Runnable() { public void run() { new Example(); } }); } } Result: The rectangles that are painted are at x25, y25 relative to the component, and not to the screen or top-level window. I was looking to implement this myself, but haven't seen any method in the graphics class that let's you do this.
tagged with: user-interface
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/25982100
answers question: http://stackoverflow.com/q/25980692
has comment: http://stackoverflow.com/comment/41144984
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: Since SonarQube 4.2, all language analysers behave the same way and so indeed the path of all source files is relative to the project root directory. I known this might sound like a regression in your case.
accepted answer of: http://stackoverflow.com/q/25980692
score: 2
downvote count: 0

http://stackoverflow.com/comment/40707185
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25994462
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ If that's what the OP wants, that's what he/she will get. If the OP wants to get a specific property from the object, there is nothing stopping him/her from doing it.
type: Comment

http://stackoverflow.com/comment/40534836
has text: uncheck build automatically and keep trying to clean it.
comment on: http://stackoverflow.com/a/25897926
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40733663
type: Comment
comment on: http://stackoverflow.com/a/26008644
has text: im inflating another layout. because activity_albums layout contains the listview and the list_item_albums layout contains the content that i want to be displayed in the listview
score: 0
type: AnswerComment

http://stackoverflow.com/q/26027503
has comment: http://stackoverflow.com/comment/40768317
score: -1
possible better answer: http://stackoverflow.com/a/26027606
answer count: 2
has body: I am having some trouble with some homework. I hope someone can tell me what I am doing wrong :) This is what I have to do: Now add a method to class Customer that takes an object of type BankAccount as argument and assigns the argument to the attribute myBankAccount. You may want to use the following method heading: public void addAccount(BankAccount account); So I have to assign the class BankAccount to an attribute in a method in my other class called Customer. This sound straightforward for me, but I get an error when I try to run the program. public void addAccount(BankAccount account) { account = myBankAccount; }
downvote count: 1
has comment: http://stackoverflow.com/comment/40768699
favorite count: 0
has answer: http://stackoverflow.com/a/26027637
accepted answer: http://stackoverflow.com/a/26027637
has comment: http://stackoverflow.com/comment/40768318
has title: assigns the argument to the attribute Java
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40768641
has answer: http://stackoverflow.com/a/26027606

http://stackoverflow.com/comment/40522599
type: QuestionComment
comment on: http://stackoverflow.com/q/25887346
has text: The problem is that you are not using Maven or Gradle, which means that you also need to include their dependencies (shown in the links I provided). I would strongly suggest that you use a build tool that handled dependencies and not try to handle them on your own
score: 0
type: Comment

http://stackoverflow.com/comment/40499738
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25878681
has text: Thanks I will accept it..But I did not understand "This is a one time deal and does not affect performance in any meaningful way" How can toy tell this?
score: 0

http://stackoverflow.com/comment/40719725
has text: Where you deal with the input image ?
score: 0
comment on: http://stackoverflow.com/a/25988890
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40738817
comment on: http://stackoverflow.com/q/26011620
score: 1
has text: share your build.gradle to obtain an useful answer
type: QuestionComment
type: Comment

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/25880133
type: Tag
tags question: http://stackoverflow.com/q/25944566

http://stackoverflow.com/q/25912550
answer count: 3
has title: How to convert a string to class Name and vice versa
has comment: http://stackoverflow.com/comment/40561563
has answer: http://stackoverflow.com/a/25912820
has answer: http://stackoverflow.com/a/25912806
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40559880
has answer: http://stackoverflow.com/a/25912896
tagged with: java
type: Question
score: 0
has body: I have a number of activities (Main1, Main2...Mainn) managed from a superClass so what I'm trying to do but fail is to Move from Main i to Main i+1 thru a button (nextPage), and in order not to repeat the same code n times I tried to convert the ClassName into Integer to get its number (i) and after that i concatenate that number (i+1) into a string and after that convert the string into Class type to call it from the Button (nextPage). here is the code : I edited my code an this is the solution that's working perfectly: str = getClass().getName();// this code line converts the class name to string int num = Integer.parseInt(str.substring(str.indexOf("_") + 1)); //this extracts integer from string str1 = "com.example.Test.Main_" + (num + 1);//this is a pure concatenation str2 = "com.example.Test.Main_" + (num - 1);//this is a pure concatenation try { nextClass = Class.forName(str1);// this how to convert string to a class name i10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(), nextClass); startActivity(i); str = nextClass.getName(); overridePendingTransition(R.anim.pushin, R.anim.pushout); } }); } catch (ClassNotFoundException e) { e.printStackTrace(); }

http://stackoverflow.com/comment/40528783
comment on: http://stackoverflow.com/a/25893023
has text: Thanks, got that. But there is no attrubutes in request-scope. Parsed it through getAttributeNames()
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25920826
type: AnsweredQuestion
tagged with: sql
has comment: http://stackoverflow.com/comment/40576126
upvote count: 0
favorite count: 0
has title: SQL syntax error in Java Servlet
has body: I tried to do this: query1="INSERT INTO `users`(`email`, `password`, `login`, `familiya`, `name`, `otchestvo`, `age`, `country`, `city`, `mob`, `skype`) VALUES ("+user.getEmail()+","+user.getPassword()+","+user.getLogin()+","+user.getFamiliya()+","+user.getName()+","+user.getOtchestvo()+",11,"+user.getCountry()+","+user.getCity()+","+user.getMob()+","+user.getSkype()+")"; what did I do wrong? All "get" is not null, only syntax error. I want to post image of database but I need 10 reputation... all fields are varchar(15), age is int(2) 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 '@mail.ru,12345,dima,Dmitriev,dima,Dmitrievich,11,Dmitrountry,Dmitriegrad,2020327' at line 1
type: Question
has comment: http://stackoverflow.com/comment/40575956
has comment: http://stackoverflow.com/comment/40575997
score: -1
accepted answer: http://stackoverflow.com/a/25921008
has comment: http://stackoverflow.com/comment/40576237
tagged with: syntax
tagged with: java
has comment: http://stackoverflow.com/comment/40575950
downvote count: 1
answer count: 1
tagged with: database
has comment: http://stackoverflow.com/comment/40575957
has answer: http://stackoverflow.com/a/25921008

http://stackoverflow.com/comment/40616672
type: Comment
comment on: http://stackoverflow.com/a/25943421
has text: Thank you for this answer, this is what I was hoping for.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25934191
has comment: http://stackoverflow.com/comment/42604516
accepted answer of: http://stackoverflow.com/q/25916864
type: Answer
has body: After reading these links: http://docs.mongodb.org/manual/core/query-plans/#index-filters https://jira.mongodb.org/browse/SERVER-3071 I come to conclude that there is no way for now to force query to use index intersection. In fact, when several candidate index are possible for a query, mongodb runs them in parallel and waits a index to "win the match". The winner index is the one that completes the whole query first or returns a threshold number of matching result first. Then mongodb uses this index to query. In the case that your queries are very variant and you cannot build many compound index, its dead. You can only trust mongodb's test. Sometimes, one index is more selective than another. But it doesn't mean that it returns more quickly the result. Like my case, the "name" index is more selective. It may fetch less documents. But it requires a date comparaison to determine if the fetched document matches the whole query. On the other side, the "date" index fetches more documents from the disque but only does a simple equality test on the "name" field to determine if the document matches the query. That is possibly why it can win the test. About the index intersection, it has never been used in my several query tests. I doubt if it is useful and expect mongodb to improve its performance in future version. If my conclusion is wrong, please point it out. Still learning about MongoDB :)
answers question: http://stackoverflow.com/q/25916864
has comment: http://stackoverflow.com/comment/42580182
score: 4
has comment: http://stackoverflow.com/comment/43065083
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26012092
has body: You can use the following code: public class ChildClass extends ParentClass { @Override public void myMethod(final double value) { new Runnable() { @Override public void run() { ChildClass.super.myMethod(value); } }; } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26011964
has comment: http://stackoverflow.com/comment/40739624
answers question: http://stackoverflow.com/q/26011964
type: Answer
has comment: http://stackoverflow.com/comment/40739677
upvote count: 15
score: 15

http://stackoverflow.com/q/25904416
linked to: http://stackoverflow.com/q/218384
score: -2
has comment: http://stackoverflow.com/comment/40545521
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/40545497
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has title: NullPointerException when calling method on a null Map
duplicate of: http://stackoverflow.com/q/218384
has body: Why the below code throws null pointer excetion in test.put(1,"sd") public class HashMap { @SuppressWarnings("null") public static void main(String a[]){ Map test = null; test.put(1, "sd"); System.out.println(test); } }
has answer: http://stackoverflow.com/a/25904426
has comment: http://stackoverflow.com/comment/40545542
upvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/a/44936883
answers question: http://stackoverflow.com/q/25903137
type: Answer
has body: Guava's function Maps.transformValues is what you are looking for, and it works nicely with lambda expressions: Maps.transformValues(originalMap, val -&gt; ...)
score: 17
upvote count: 18
downvote count: 1
has comment: http://stackoverflow.com/comment/85105335
has comment: http://stackoverflow.com/comment/86059039
has comment: http://stackoverflow.com/comment/113403002
has comment: http://stackoverflow.com/comment/140141872

http://stackoverflow.com/comment/40788635
type: QuestionComment
comment on: http://stackoverflow.com/q/26024742
type: Comment
has text: I would like to be able to inject a service class into the resource class. The cxf-servlet.xml is registering the jaxws endpoints.
score: 0

http://stackoverflow.com/a/25893045
downvote count: 0
type: Answer
has body: You will have endless loop if you have the same exception. check which exceptions can be thrown by executeUpdate and add the appropriate catch blocks with appropriate messages. Example: catch (PSQLException) { System.out.println("The key is already exist"); isInserted=true; } catch (SQLException e) { System.out.println(e); isInserted=false; }catch (SQLTimeoutException e) { System.out.println(e); isInserted=false; }
answers question: http://stackoverflow.com/q/25892982
score: 1
upvote count: 1

ldap
tags question: http://stackoverflow.com/q/25914001
tags question: http://stackoverflow.com/q/25881201
tags question: http://stackoverflow.com/q/25987936
tag name: ldap
tags question: http://stackoverflow.com/q/25908345
type: Tag
tags question: http://stackoverflow.com/q/25897042

http://stackoverflow.com/q/25894123
score: 1
favorite count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40526653
has answer: http://stackoverflow.com/a/25894194
type: Question
has title: How to access JSONArray inside of a JSONArray in a JSON object response
answer count: 1
downvote count: 0
has body: Within this Json response, how do I get access to "smallImageUrls" and get the image url using Java? Seems like "smallImageUrls" is an array within the "matches" jsonarray. Someone please correct me if I am wrong on that. { "attribution":{ "html":"Recipe search powered by &lt;a href='http://www.yummly.com/recipes'&gt;&lt;img alt='Yummly' src='http://static.yummly.com/api-logo.png'/&gt;&lt;/a&gt;", "url":"http://www.yummly.com/recipes/", "text":"Recipe search powered by Yummly", "logo":"http://static.yummly.com/api-logo.png" }, "totalMatchCount":17663, "facetCounts":{ }, "matches":[ { "imageUrlsBySize":{ "90":"http://lh3.ggpht.com/bTkxROvVTjHChEsGLRnkuwPoi-eNrHmESYP3xDHMsIisN-U06z-OfwErSjT5AHvMG0Ccgw8cN4mVqNyjWzbz=s90-c" }, "sourceDisplayName":"Serious Eats", "ingredients":[ "mayonnaise", "crema mexican", "feta", "ancho powder", "garlic", "coriander leaf", "shuck corn", "lime" ], "id":"Mexican-street-corn-_elotes_-370469", "smallImageUrls":[ "http://lh5.ggpht.com/itong2VhnBU2mvPtzNimL58MnkC4l113RgNyrEWq8Jf76AsOGOlBoVQyCF-jYDPtzTB-7SoViNzyV5-Xe0NS=s90" ], "recipeName":"Mexican Street Corn (Elotes)", "totalTimeInSeconds":2400, "attributes":{ "cuisine":[ "Mexican" ] }, "flavors":{ "sweet":0.5, "sour":0.6666666666666666, "salty":0.6666666666666666, "piquant":0.3333333333333333, "meaty":0.3333333333333333, "bitter":0.6666666666666666 }, "rating":5 } ], "criteria":{ "excludedIngredients":null, "allowedIngredients":null, "terms":null } } this is the code that I currently have. I can access all the other strings, just not the image urls . JSONObject resObj = new JSONObject(result); JSONArray foundrecipes = resObj.getJSONArray("matches"); for(int i = 0;i&lt;foundrecipes.length(); i++){ JSONObject recipe = foundrecipes.getJSONObject(i); String recipeName = recipe.getString("recipeName"); String rating = recipe.getString("rating"); String id = recipe.getString("id"); String imageurl = recipe.getString("smallImageUrls"); data.add(new Recipes(recipeName, rating, id, imageurl)); }
tagged with: android
accepted answer: http://stackoverflow.com/a/25894194

http://stackoverflow.com/q/25935810
tagged with: java
tagged with: mysql
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25935938
tagged with: datasource
has title: Getting Connection object from DataSource in Java
answer count: 1
downvote count: 0
score: 1
tagged with: tomcat
has body: I'm trying to get connection for my web application I'm using DataSource object and it's injected by @Resource @Resource(name="jdbc/name") private DataSource dataSource; and then in method getConnection() trying to get connection from DataSource object by private Connection getConnection() { Connection con = null; try { con = dataSource.getConnection(); } catch (SQLException e) { LOGGER.error(e.getMessage()); } return con; } But my dataSource is null and I'm getting a NullPointerException. By the way, the same code works fine in class, that extends HttpServlet. I need to use this code in simple DBManager class. Help please, what I have to do? P.S. I have configured context.xml and web.xml
favorite count: 0
accepted answer: http://stackoverflow.com/a/25935938
has comment: http://stackoverflow.com/comment/40602384
has comment: http://stackoverflow.com/comment/40615766
type: AnsweredQuestion

http://stackoverflow.com/comment/40667777
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25972433
has text: It seems to fail to import NumberUtils.

http://stackoverflow.com/q/25923405
tagged with: java
has answer: http://stackoverflow.com/a/74026023
has answer: http://stackoverflow.com/a/66979175
has answer: http://stackoverflow.com/a/64061700
has answer: http://stackoverflow.com/a/66239793
type: Question
has answer: http://stackoverflow.com/a/44359421
has answer: http://stackoverflow.com/a/73568508
has comment: http://stackoverflow.com/comment/41102163
downvote count: 0
has answer: http://stackoverflow.com/a/68035630
accepted answer: http://stackoverflow.com/a/39952534
has answer: http://stackoverflow.com/a/62061174
has answer: http://stackoverflow.com/a/45538849
tagged with: cucumber-jvm
has answer: http://stackoverflow.com/a/55381159
has answer: http://stackoverflow.com/a/68048746
favorite count: 0
has answer: http://stackoverflow.com/a/62653669
has answer: http://stackoverflow.com/a/62063487
has answer: http://stackoverflow.com/a/69818366
has answer: http://stackoverflow.com/a/64335899
has title: Exception in thread "main" cucumber.runtime.CucumberException: No backends were found
has answer: http://stackoverflow.com/a/47057135
answer count: 18
has answer: http://stackoverflow.com/a/39952534
possible better answer: http://stackoverflow.com/a/26088881
has body: I am developing my Selenium-JVM framework with Cucumber and while running my first feature got below error. Please help. How did I launch the feature - Right click on feature file Select Run As -> Cucumber Feature Immediate Exception - Exception in thread "main" cucumber.runtime.CucumberException: No backends were found. Please make sure you have a backend module on your CLASSPATH. at cucumber.runtime.Runtime.&lt;init&gt;(Runtime.java:78) at cucumber.runtime.Runtime.&lt;init&gt;(Runtime.java:67) at cucumber.runtime.Runtime.&lt;init&gt;(Runtime.java:63) at cucumber.api.cli.Main.run(Main.java:24) at cucumber.api.cli.Main.main(Main.java:16) What I have in code - Launcher.java - package cucumber; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(format={"pretty","json:target/"} , features="/src/test/java/cucumber/features") public class Launcher { } Feature file - Feature: it works demo Scenario: First test Given this is my step When this is my second step Then this is my final step List of Dependencies added to list - cucumber-core-1.1.8 cucumber-html-0.2.3 cucumber-java-1.1.8 cucumber-junit-1.1.8 cucumber-jvm-deps-1.0.3 gherkin-2.12.2 hamcrest-all-1.3 junit-4.11 selenium-api-2.42.2 selenium-firefox-driver-2.42.2 selenium-java-2.42.2 selenium-remote-driver-2.42.2 selenium-support-2.42.2 My JVM - 1.7 Only this much is available in project. Please help.
score: 14
tagged with: selenium-webdriver
type: AnsweredQuestion
upvote count: 14
has answer: http://stackoverflow.com/a/26088881

http://stackoverflow.com/comment/40559806
comment on: http://stackoverflow.com/q/25912341
type: Comment
type: QuestionComment
has text: oh. well I had a SimpleXML question here: http://stackoverflow.com/questions/24106734/simplexml-throws-xmlpullparserexception-unterminated-entity-ref-for-no-reason , I think the problem has to do with the fact that `category` has a `domain` attribute and thus it cannot be made into a `String`, and you should have your own `Category` class for it. I also had a tag that wrapped the list, I don't know if that was truly necessary or not, but it worked for me.
score: 0

http://stackoverflow.com/q/25953585
favorite count: 0
accepted answer: http://stackoverflow.com/a/25953634
has body: Which one of these styles is more widely used and appropriate? 1. if (condition1) { //... } else if (condition2) { //... } else { //... } 2. if (condition1) { //... } else if (condition2) { //... } else { //... }
upvote count: 2
has comment: http://stackoverflow.com/comment/40632791
type: AnsweredQuestion
tagged with: coding-style
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40632856
has answer: http://stackoverflow.com/a/25953634
has comment: http://stackoverflow.com/comment/40632875
has title: Should else & else-if statements be on separate lines
has comment: http://stackoverflow.com/comment/40632818
has comment: http://stackoverflow.com/comment/40632820
answer count: 1
score: 1

http://stackoverflow.com/comment/40763195
type: Comment
has text: By "only", do you mean it's doing it automatically at other times? For what language?
comment on: http://stackoverflow.com/q/26024821
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40646722
has text: This could be dangerous to call in a `paint(Graphics g)` method override.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25961147

http://stackoverflow.com/comment/40523033
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25892162
has text: neither `new FooA()[12]` nor `new FooA[12]()` compiles, you can't do this in java?
score: 0

http://stackoverflow.com/comment/40717470
type: Comment
has text: I was also thinking about extending `RollingFileAppender` and implement custom one. Just wanted to check whether there is a another way of doing it, through some configuration.
comment on: http://stackoverflow.com/a/25997338
score: 0
type: AnswerComment

http://stackoverflow.com/q/25972777
tagged with: post
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/58300189
has comment: http://stackoverflow.com/comment/40668391
favorite count: 0
has body: /** Jre 1.5 */ Map&lt;String, String&gt; paramsMap= new HashMap&lt;String, String&gt;(); /** add few params into paramsMap */ /** Jsoup 1.6.3*/ String post = Jsoup.connect(url) .header("Content-Type","application/x-www-form-urlencoded") .data(paramsMap) .method(Method.POST) .toString(); Variable post contains just org.jsoup.helper.HttpConnection@15a62c31. Method toString() for Connection is not overloaded. Is there a way to print and examine POST request that is constructed by jsoup? And no to use packet sniffers.
upvote count: 2
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/40668090
tagged with: java
tagged with: http
has comment: http://stackoverflow.com/comment/40752851
type: Question
has title: Jsoup debug POST request
tagged with: jsoup

http://stackoverflow.com/comment/40518253
has text: Do you know any other free database hosting without that problem so that I can test my app
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25889354
score: 0

http://stackoverflow.com/comment/40693440
comment on: http://stackoverflow.com/q/25986290
type: Comment
type: QuestionComment
has text: If 'client2' is listening in the TCP sense it is a server not a client. You don't state which port you want to share. Please clarify.
score: 0

http://stackoverflow.com/comment/40504508
comment on: http://stackoverflow.com/a/25881551
has text: A couple of minor points: It is generally preferable to code to an interface, and diamond syntax can be used from Java 7, so your example becomes: Map<Integer, Double> myMap = new HashMap<>();
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/57293477
score: 0
has body: I have used it for my selection table. When the auto order is activated (setAutoCreateRowSorter(true)) the indices of the model table and the visual change, so you have to tell it to look for it within the model with respect to the one you are seeing. ((CustomTable)form.getAvailListView().getModel()).data.get(form.getListView().convertRowIndexToModel(i))
answers question: http://stackoverflow.com/q/25926070
type: Answer

http://stackoverflow.com/comment/40513386
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25886706
has text: can you show the content of ./AUTOMATE_RUN.sh? It looks like there is a path inside which doesn't exist!

http://stackoverflow.com/q/25935749
has comment: http://stackoverflow.com/comment/40602240
has body: I need to find a regex to extract date section from the name of several files. In particular I have these two formats: ATC0200720140828080610.xls ATC0200720140901080346_UFF_ACC.xls I use these two regex to check file name format: ^ATC02007[0-9]{14}.xls$ ^ATC02007[0-9]{14}_UFF_ACC.xls$ But I need a regex to extract a specific section: constant | yyyyMMddHHmmss | constant ^ ^ ^ ATC02007 | 20140901080346 | _UFF_ACC.xls Both regex I'm using match the entire file name, so I can't use to extract the middle section, so which is the right expression?
has title: How to extract date section from filename?
possible better answer: http://stackoverflow.com/a/25935846
has answer: http://stackoverflow.com/a/25935846
has comment: http://stackoverflow.com/comment/40602196
linked to: http://stackoverflow.com/q/237061
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25935844
type: Question
answer count: 2
tagged with: regex
has comment: http://stackoverflow.com/comment/40602336
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25935844

http://stackoverflow.com/comment/40551182
score: 3
has text: I *think* the better way is to have another variable for the return, say `result`, then set it in your `if-else`, then at the end, `return result`. In this way, you'll just have a single return statement.
comment on: http://stackoverflow.com/q/25907588
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25997365
tagged with: css
has answer: http://stackoverflow.com/a/25997612
has answer: http://stackoverflow.com/a/25998820
favorite count: 0
answer count: 5
tagged with: selenium
type: AnsweredQuestion
score: 3
has title: How to check a radio button with Selenium WebDriver?
accepted answer: http://stackoverflow.com/a/26046517
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/55228455
has answer: http://stackoverflow.com/a/68357100
has comment: http://stackoverflow.com/comment/40714474
type: Question
linked to: http://stackoverflow.com/q/23362768
downvote count: 0
has answer: http://stackoverflow.com/a/69095620
has body: I want to check this radio button, but I didn't know how. My HTML is: id="contentContainer" class="grid_list_template"> Paradas
has answer: http://stackoverflow.com/a/26046517
tagged with: http://stackoverflow.com/tag/html
possible better answer: http://stackoverflow.com/a/25998820

http://stackoverflow.com/comment/40551292
has text: _Using the else statement is more efficient_ More efficient in which way?
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25907683

http://stackoverflow.com/q/25920371
favorite count: 0
tagged with: android-asynctask
type: Question
possible better answer: http://stackoverflow.com/a/25920445
tagged with: android
has answer: http://stackoverflow.com/a/25920445
has answer: http://stackoverflow.com/a/25920527
has answer: http://stackoverflow.com/a/25920669
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40575043
downvote count: 1
has title: Android AsyncTask: Will methods that are called inside doInBackground() executed in main or background thread?
answer count: 4
has body: Lets say i have a class which contains inner class that is named fooTask that extends AsyncTask and a method named getFoo() that returns some int value. If i call this getFoo() method inside AsyncTask's doInBackground() method, will this getFoo() method be executed in main or background thread? public class SomeClass extends Activity { @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); fooTask task = new fooTask(); task.execute(); } private class fooTask extends AsyncTask&lt;Void, Void, Integer&gt;{ @Override protected Integer doInBackground(Void... params) { int foo = getFoo(); return foo; } } private int getFoo(){ // Will this method be executed in main or background thread? return 1; } }
accepted answer: http://stackoverflow.com/a/25920527
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25920474

http://stackoverflow.com/q/25929085
has comment: http://stackoverflow.com/comment/40591180
has comment: http://stackoverflow.com/comment/40590770
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25931725
tagged with: java
tagged with: swing
type: Question
tagged with: border-layout
has body: I have used BorderLayout.CENTER to add a panel2 inside another panel1. But panel2 doesnt take the full available space. This is what I have done so far //constructor SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub try{ new JFXPanel(); add(getJPanel(), BorderLayout.CENTER); add(getJBottomPanel(),BorderLayout.SOUTH); getJBottomPanel().add(getTestPanel(),BorderLayout.CENTER); Platform.runLater((new Runnable() { @Override public void run() { // TODO Auto-generated method stub try { initFX(fxPanel); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } })) ; } catch(Exception e){ System.out.println("Error in swing utilities thread :" + e.getMessage()); } } }); getJPanel method private JPanel getJPanel(){ if(panel == null){ panel = new JPanel(); panel.setSize(applicationWidth_600,upperPanelHeight_535); panel.setBackground(Color.gray); } return panel; } getJBottomPanel method private JPanel getJBottomPanel(){ if(bPanel == null){ bPanel = new JPanel(); bPanel.setSize(200,bottomPanelHeight_65); bPanel.setPreferredSize(new Dimension(300, 65)); bPanel.setBackground(Color.pink); } return bPanel; } getTestPanel method private JPanel getTestPanel(){ if(testPanel == null){ testPanel = new JPanel(); testPanel.setBackground(Color.black); } return testPanel; } This is the output :- https://imagizer.imageshack.us/v2/195x383q90/908/wndsCC.png
score: 0
has title: Component inside JPanel with Border Layout is not taking full available space
answer count: 1

http://stackoverflow.com/a/62542978
answers question: http://stackoverflow.com/q/25909611
score: 0
has body: This works for me ... file &gt;&gt; New &gt;&gt; Dynamic web project &gt;&gt; Enter project name &gt;&gt; Change 'Dynamic Web module version' from 3.0 to a lower version ,say 2.5, then change it back to 3.0 , the error message disappears . I think the initial error message that says it requires java 1.6 or above is a bug in Eclipse Java EE.
type: Answer

http://stackoverflow.com/q/25994660
has comment: http://stackoverflow.com/comment/40708294
linked to: http://stackoverflow.com/q/132231
has body: I am using Apache Maven and Spring. In the src/main/resources folder I have a properties file. These property values can have different values. I am using PropertyPlaceholderConfigurer. @Configuration public class ResourceConfig { @Bean public PropertyPlaceholderConfigurer properties( ) { PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); ppc.setIgnoreResourceNotFound(true); ppc.setLocations(new ClassPathResource[] {new ClassPathResource("propertiesFile"), new ClassPathResource("myapp.properties")}); return ppc; } } I replace these values at runtime: @Configuration public class DataSourceConfig { @Value("${jdbc.url}") private String jdbcUrlDefault; // there are more @Value } This is just a sample. I have a main method: public static void main(String[] args) { // accept a properties file and override those values defined in DataSourceConfig class ApplicationContext application = new AnnotationConfigApplicationContext("packaageThatContainsConfiguration"); DataSourceConfig dataSourceConfig = (DataSourceConfig) application.getBean("dataSourceConfig"); System.out.println(dataSourceConfig.getJdbcUrlDefault()); } org.apache.maven.plugins maven-assembly-plugin 2.4 jar-with-dependencies com.Main package single server-app When Apache Maven builds the application the properties file will be on the classpath. I want to override the properties value with the properties file provided. I want to accept a properties file through the main program that gets replaced, so the Spring side starts the PropertyPlaceholderConfigurer. I have a properties file containing the value that I want. When I run the following command on the Command prompt: java -jar server-app-jar-with-dependencies.jar -D myapp.properties "C:\Users\user\Desktop\myapp.properties" It prints out the original value that is placed in src/main/resources/myapp.properties I want to print the value that is on the Desktop myapp.properties. What am I doing wrong?
has comment: http://stackoverflow.com/comment/40709859
tagged with: java
has comment: http://stackoverflow.com/comment/40707746
type: Question
linked to: http://stackoverflow.com/q/4097614
has answer: http://stackoverflow.com/a/25995910
score: 0
answer count: 1
tagged with: jar
has title: Java Main Class Apache Maven
type: UnansweredQuestion
tagged with: maven
tagged with: spring

http://stackoverflow.com/a/25931530
answers question: http://stackoverflow.com/q/25931472
has body: You would need to cast the result of list.get(0) - the compiler is complaining because List&lt;ClientInfo&gt;.get(...) will definitely return a reference to a ClientInfo-compatible object (or null), but it might not be a ClientAdditionalInfo: ClientAdditionalInfo fetched = (ClientAdditionalInfo) list.get(0); System.out.println(fetched.age); System.out.println(fetched.name); System.out.println(fetched.additionalinfo); Note that you'll get a ClassCastException if the first element isn't a ClientAdditionalInfo. You can check that: ClientInfo info = list.get(0); if (info instanceof ClientAdditionalInfo) { ClientAdditionalInfo fetched = (ClientAdditionalInfo) info; ... } This sort of thing is usually a design smell - typically if you need to know that elements of a collection are of a particular subclass (rather than just letting subclasses override methods from the superclass if they need to customize behaviour), then the collection type should be specified with that subclass. It's not always the case, but it's at least worth considering whether this should be a List&lt;ClientAdditionalInfo&gt;.
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25931472
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26001273
has answer: http://stackoverflow.com/a/26001688
has body: java 7, NetBeans 7, Several years of experience with Netbeans and Java. I'm trying to include Apache's HttpClient (4.3.5) and HttpCore (4.3.2) jar files in my project. I've added them in both runtime and compiletime libraries. When I type in the import statement, NetBeans marks them as an error - "package org.apache.http does not exist". However I can compile cleanly. Yet when I run the project, first it says "one or more projects are compiled with errors". When I tell it to run, the current code line stops on the first import and says - "Uncompilable source code - package org.apache.http does not exist" Why oh why oh why does NetBeans not see these two jar files? Thanks.
type: UnansweredQuestion
tagged with: java
has title: HttpClient and HttpCore jar files not seen by Netbeans
type: Question
tagged with: jakarta-ee
score: 0
answer count: 1

http://stackoverflow.com/a/25921009
downvote count: 0
answers question: http://stackoverflow.com/q/25920799
score: 4
has body: There are a number of tools capable of doing this included in various frameworks and app servers (CXF, JBoss/Wildfly, etc.), but the JDK itself includes a tool called wsimport which can consume a WSDL file and produce the JAX-WS stubs you need to remotely-invoke the service endpoints via a Java client. Here's one quick description: http://www.mkyong.com/webservices/jax-ws/jax-ws-wsimport-tool-example/; here is the Oracle documentation for the tool in JDK 7: http://docs.oracle.com/javase/7/docs/technotes/tools/share/wsimport.html.
type: Answer
upvote count: 4

arrays
tags question: http://stackoverflow.com/q/25988018
tags question: http://stackoverflow.com/q/25998893
tags question: http://stackoverflow.com/q/26003767
tags question: http://stackoverflow.com/q/25972707
tags question: http://stackoverflow.com/q/25980377
tags question: http://stackoverflow.com/q/26006804
tags question: http://stackoverflow.com/q/25967277
tags question: http://stackoverflow.com/q/26018736
tags question: http://stackoverflow.com/q/25921902
tags question: http://stackoverflow.com/q/25894719
tags question: http://stackoverflow.com/q/26000823
tags question: http://stackoverflow.com/q/25944044
tags question: http://stackoverflow.com/q/26033962
tags question: http://stackoverflow.com/q/25989334
tags question: http://stackoverflow.com/q/25962367
type: Tag
tags question: http://stackoverflow.com/q/26030657
tags question: http://stackoverflow.com/q/25935355
tags question: http://stackoverflow.com/q/25924997
tags question: http://stackoverflow.com/q/25903964
tags question: http://stackoverflow.com/q/25976315
tags question: http://stackoverflow.com/q/26021283
tags question: http://stackoverflow.com/q/25985791
tags question: http://stackoverflow.com/q/26000103
tags question: http://stackoverflow.com/q/25969135
tags question: http://stackoverflow.com/q/25903898
tags question: http://stackoverflow.com/q/25925403
tags question: http://stackoverflow.com/q/26021049
tags question: http://stackoverflow.com/q/25879534
tags question: http://stackoverflow.com/q/25940782
tags question: http://stackoverflow.com/q/26028798
tags question: http://stackoverflow.com/q/25918532
tags question: http://stackoverflow.com/q/25982929
tags question: http://stackoverflow.com/q/26004207
tags question: http://stackoverflow.com/q/25954374
tags question: http://stackoverflow.com/q/25879983
tags question: http://stackoverflow.com/q/25881355
tags question: http://stackoverflow.com/q/25947680
tags question: http://stackoverflow.com/q/25940999
tags question: http://stackoverflow.com/q/25936812
tags question: http://stackoverflow.com/q/25968676
tags question: http://stackoverflow.com/q/25926105
tags question: http://stackoverflow.com/q/25979298
tags question: http://stackoverflow.com/q/26017460
tags question: http://stackoverflow.com/q/25953127
tags question: http://stackoverflow.com/q/25883613
tags question: http://stackoverflow.com/q/25959228
tags question: http://stackoverflow.com/q/25983096
tags question: http://stackoverflow.com/q/25975669
tags question: http://stackoverflow.com/q/26028081
tags question: http://stackoverflow.com/q/25881428
tags question: http://stackoverflow.com/q/25961598
tags question: http://stackoverflow.com/q/25900547
tags question: http://stackoverflow.com/q/25879284
tags question: http://stackoverflow.com/q/26026503
tags question: http://stackoverflow.com/q/25956756
tags question: http://stackoverflow.com/q/26021671
tags question: http://stackoverflow.com/q/25938949
tags question: http://stackoverflow.com/q/25901715
tags question: http://stackoverflow.com/q/25949760
tags question: http://stackoverflow.com/q/25966263
tags question: http://stackoverflow.com/q/25932063
tags question: http://stackoverflow.com/q/25884381
tags question: http://stackoverflow.com/q/25945397
tags question: http://stackoverflow.com/q/25947567
tags question: http://stackoverflow.com/q/25903469
tags question: http://stackoverflow.com/q/25927050
tags question: http://stackoverflow.com/q/25990229
tags question: http://stackoverflow.com/q/25963619
tags question: http://stackoverflow.com/q/25995948
tags question: http://stackoverflow.com/q/25928999
tags question: http://stackoverflow.com/q/26028051
tags question: http://stackoverflow.com/q/25947404
tag name: arrays
tags question: http://stackoverflow.com/q/26019422
tags question: http://stackoverflow.com/q/25955664
tags question: http://stackoverflow.com/q/25984586
tags question: http://stackoverflow.com/q/26015704
tags question: http://stackoverflow.com/q/25990920
tags question: http://stackoverflow.com/q/25880500

http://stackoverflow.com/comment/40572189
comment on: http://stackoverflow.com/a/25918851
has text: yes, it fits ok, what I mean is, in order to print a positive integer there are two ways: 1) change result to long. 2) handle signed int as unsigned int by yourself.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25914733
answers question: http://stackoverflow.com/q/25909459
type: Answer
has comment: http://stackoverflow.com/comment/40565090
score: 1
has comment: http://stackoverflow.com/comment/40565592
upvote count: 1
downvote count: 0
has body: To me it looks like location.href = $(this).data('url') + "/" + email.value; should be location.href = $(this).data('url') + "/?email=" + URLEncoder.encode(email.value, "UTF-8"); Though I might be on the wrong track. (URLEncoder needs to be revised too.) P.S. FireFox with TamperData plugin or other tools allow interception of the traffic from and to the browser.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25909459

http://stackoverflow.com/q/25962948
type: Question
accepted answer: http://stackoverflow.com/a/25962979
has title: is a interface that is implemented considered a superclass of the implementation?
has comment: http://stackoverflow.com/comment/40650411
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40650237
has body: HashSet implements interface Set extends interface Collection which extends interface iterable Can we then say that HashSet is said to implement the interface Iterable? What does this look like in terms of the JVM runtime and classloading? In there just one big class created called HashSet (which includes all Iterable methods)?
has answer: http://stackoverflow.com/a/25962979
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/40693735
type: AnswerComment
comment on: http://stackoverflow.com/a/25986475
type: Comment
has text: are all of these changes all within the pizzaOutput class?
score: 0

http://stackoverflow.com/a/64769043
has comment: http://stackoverflow.com/comment/114517719
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25988707
has body: //By using lambda int sum = primes.stream().mapToInt(a-&gt;a).sum(); System.out.println(sum); int min = primes.stream().mapToInt(a-&gt;a).min().orElse(0); System.out.println(min); int max = primes.stream().mapToInt(a-&gt;a).max().orElse(0); System.out.println(max); double average = primes.stream().mapToInt(a-&gt;a).average().orElse(0); System.out.println(average); //By using Collections System.out.println(Collections.min(primes)); System.out.println(Collections.max(primes));

http://stackoverflow.com/q/25947576
has body: I have Maven project and Tomcat server. I work in IDEA when I click in "Maven LifeCicle" -> "deploy", i have a problem: [INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ TestMaven --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 8.035 s [INFO] Finished at: 2014-09-20T13:52:32+04:00 [INFO] Final Memory: 11M/93M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project TestMaven: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException Piace of my POM.xml is: org.codehaus.mojo tomcat-maven-plugin tomcat http://localhost:8080/manager/text Not worked or: org.apache.tomcat.maven tomcat7-maven-plugin 2.0 also not worked.
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/40622735
score: 0
answer count: 2
has title: Deploy maven project to tomcat
tagged with: tomcat
favorite count: 0
possible better answer: http://stackoverflow.com/a/45126221
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/45126221
tagged with: java
has answer: http://stackoverflow.com/a/25947749
accepted answer: http://stackoverflow.com/a/25947749
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/q/25876448
tagged with: content-assist
tagged with: java
has body: I went to Preferences -> Editor -> Templates and I edited the for loops so the brackets would begin on the next line instead of the current line. I clicked Apply -> Okay and the changes showed up in the Templates section. But when I use the Content Assist it still autofills the for loops so the brackets begin on the current line.
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40495304
has comment: http://stackoverflow.com/comment/40495120
answer count: 0
type: UnansweredQuestion
has title: Eclipse - Edit the autofill template in Content Assist

http://stackoverflow.com/comment/40782577
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26031896
has text: @mKorbel *"I need to filter the table data with respect to leave code when leave code is selected in the combo box and filter with respect to leavedesc when leave description is selected in the combo box"* - So, when "code" is selected, the data will be filtered according to the reg-expr ONLY against the code column and the same for description...Unlike the OP's code which is filter across ALL columns...
score: 0

apache-fop
tags question: http://stackoverflow.com/q/25915648
tag name: apache-fop
tags question: http://stackoverflow.com/q/25895984
tags question: http://stackoverflow.com/q/25931318
type: Tag
tags question: http://stackoverflow.com/q/26009439

http://stackoverflow.com/a/26000107
downvote count: 0
answers question: http://stackoverflow.com/q/25999718
score: 1
has comment: http://stackoverflow.com/comment/40719754
has comment: http://stackoverflow.com/comment/40718672
has comment: http://stackoverflow.com/comment/40719031
has comment: http://stackoverflow.com/comment/40718734
has comment: http://stackoverflow.com/comment/40718946
has comment: http://stackoverflow.com/comment/40719097
has comment: http://stackoverflow.com/comment/40718948
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40719128
has body: I think you didn't get the difference between JSP and JavaScript. While JSP is executed on the Server at the time your browser requires the web page, JavaScript is executed at the Client side, so in your browser, when you do an interaction that causes the JavaScript to run. You Server (eg Apache Tomcat) will firstly execute your JSP code: String st = "document.writeln(dat)"; BufferedImage image = null; byte[] imageByte; BASE64Decoder decoder = new BASE64Decoder(); imageByte = decoder.decodeBuffer(st); ByteArrayInputStream bis = new ByteArrayInputStream(imageByte); image = ImageIO.read(bis); bis.close(); if (image != null) ImageIO.write(image, "jpg", new File("d://1.jpg")); out.println("value=" + st); System.out.println("value=" + st); As you can see, nowhere is the value of st changed. Your broser will receive the following snippet from your server: value=document.writeln(dat); Since your browser is the one that executes JavaScript, he will execute it and show the Base64-encoded Image - but your server won't. For the exact difference, read this article. To make the code working, the easiest way is to redirect the page: function(data_uri) { // redirect document.location.href = 'saveImage.jsp?img='+data_uri; } Now, you can have a JSP-page called saveImage.jsp that saves the Image, and returns the webpage you had already, and write the dara_uri into the element results. Another, but more difficult way is to use AJAX. Here is an introduction to it.
type: Answer
accepted answer of: http://stackoverflow.com/q/25999718

http://stackoverflow.com/comment/135836855
type: AnswerComment
score: 0
type: Comment
has text: OP does recursive file deletion, so you'll have to call `deleteEmpty` for each file you find. Also, don't hesitate to comment on any problems you see in other's answers. It increases the general quality of answers! ;)
comment on: http://stackoverflow.com/a/72785478

http://stackoverflow.com/q/25893892
score: 0
answer count: 1
tagged with: jsp
has body: How can i retrieve data from Database using Java servlet, Hibernate, JSP? Help me :) File StudentModel.java public class StudentModel { private final SessionFactory sf = HibernateUtil.getSessionFactory(); public List&lt;Student&gt; studentList() { try{ sf.getCurrentSession().beginTransaction(); List&lt;Student&gt; result = sf.getCurrentSession().createCriteria(Student.class).list(); return result; } catch(Exception e) { return null; } } } File Index.jsp &lt;body&gt; &lt;% StudentModel sm = new StudentModel();%&gt; &lt;c:forEach var ="student" items="&lt;%= sm.studentList()%&gt;"&gt; Id: ${student.Id}&lt;br&gt; name:${student.Name} &lt;/c:foreach&gt; &lt;/body&gt; File Student.hbm.xml (file config mapping to property in DB) &lt;hibernate-mapping&gt; &lt;class name="entities.Student" table="Student" schema="dbo" catalog="javaTest"&gt; &lt;id name="id" type="int"&gt; &lt;column name="Id" /&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="name" type="string"&gt; &lt;column name="Name" length="100" /&gt; &lt;/property&gt; &lt;/class&gt;
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has title: How to show data from SQL server using JSP, Servlet,Hibernate
has answer: http://stackoverflow.com/a/25895207
tagged with: servlets

http://stackoverflow.com/q/26015294
score: 4
favorite count: 0
has title: Fetch the all tv channel in the tv byusing tvinputmanager in android
tagged with: android
answer count: 0
tagged with: television
type: UnansweredQuestion
tagged with: java
type: Question
upvote count: 4
tagged with: video-streaming
has body: Main Activity.java Plese help me fiends how it fetch all channel list public class MainActivity extends Activity { private static final String TAG = MainActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button button = (Button)findViewById(R.id.ping_button); Button access = (Button)findViewById(R.id.btnaccess); Button justtest=(Button)findViewById(R.id.btntest); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { System.out.print("Listing TvInputManager's TvInputInfo list:\n"); TvInputManager tvInputManager=(TvInputManager)getApplicationContext().getSystemService(TV_INPUT_SERVICE); List&lt;TvInputInfo&gt; tvInputList=tvInputManager.getTvInputList(); Log.i("TV", "Got "+tvInputList.size()+ " TvInputsInfos."); for (int i=0; i&lt;tvInputList.size(); i++) { Log.i("TV", tvInputList.get(i).getId()); } } }); Intent intent = new Intent(); intent.setAction("com.futarque.StartTvService"); sendBroadcast(intent); justtest.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { System.out.print("Listing TvInputManager's TvInputInfo list:\n"); TvInputManager tvInputManager=(TvInputManager)getApplicationContext().getSystemService(TV_INPUT_SERVICE); List&lt;TvInputInfo&gt; tvInputList=tvInputManager.getTvInputList(); Log.i("TV", "Got "+tvInputList.size()+ " TvInputsInfos."); for (int i=0; i&lt;tvInputList.size(); i++) { Log.i("TV", tvInputList.get(i).getId()); } } }); Intent intent = new Intent(); intent.setAction("com.futarque.StartTvService"); sendBroadcast(intent);
downvote count: 0

http://stackoverflow.com/q/25890617
has answer: http://stackoverflow.com/a/25890692
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25890706
has answer: http://stackoverflow.com/a/25890706
tagged with: ide
accepted answer: http://stackoverflow.com/a/25890692
score: 0
has title: Eclipse: is there a shortcut for changing the order of methods in a class?
has body: In Eclipse, is there a shortcut for moving a certain method up or down the method list in a class, without having to cut and paste it manually?
type: AnsweredQuestion

http://stackoverflow.com/q/25909994
has comment: http://stackoverflow.com/comment/40555310
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/25912697
has body: I'm developping an application with GAE/Datanucleus/cloudSQL. Datanucelus version is 3.1.3 because newest App Engine SDK (1.9.11) includes this version, but I was advised to use Datanucleus v4 in this question. I removed 3.1.3 jars from war/WEB-INF/lib and added 4.0.2 jars to the same folder. When I run the application, it seems working well. But eclipse is complaining errors as belows. The App Engine SDK JAR datanucleus-api-jpa-3.1.3.jar is missing in the WEB-INF/lib directory The App Engine SDK JAR datanucleus-core-3.1.3.jar is missing in the WEB-INF/lib directory The App Engine SDK JAR datanucleus-api-jdo-3.1.3.jar is missing in the WEB-INF/lib directory If I add the 3.1.3 to war/WEB-INF/lib, eclipse error has gone, but application fails because of multiple JAR versions. Can anybody tell me the straightforward way to use Datanucleus v4 with GAE?
type: AnsweredQuestion
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/25912697
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40557002
has title: Datanucleus v4 with GAE
tagged with: datanucleus
answer count: 1
has comment: http://stackoverflow.com/comment/40556161
has comment: http://stackoverflow.com/comment/40560126
has comment: http://stackoverflow.com/comment/40556056
linked to: http://stackoverflow.com/q/25904674

http://stackoverflow.com/a/25914923
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25914863
has body: Pull the check in to its own method: protected void validateWeight( int weight ) { if(weight&lt;0){ throw new IllegalArgumentException("weight cannot be zero"); } } and then you can reuse it like this public double calOne modeling mistake that you may be at risk of here is misuse of inheritence. Unfortunately there are many OO tutorials that teach that a bird extends an animal which extends a thculatePriceSuper(int weight){ validateWeight(weight); return calculateprice(weight); } But is that really better? When the logic that is being repeated is truely identical, and not just circumstantial then yes this approach is significantly better. It reduces clutter, and means that if a change is required to the validation of weight then it only needs to be made in one place. Every time code is duplicated, we have one more place to maintain and opportunities for behaviour to diverge. However this can become bad when the use of the shared code is only circumstantially similar. That is where different checks may be required that are not needed everywhere. Spotting the difference takes time and experience, but don't be afraid to go for it here. Additional One modeling mistake that you may be at risk of here is a misuse of inheritence; there is not enough context here for me to be sure. Unfortunately there are many OO tutorials that teach that a bird extends an animal which extends a thing etc. Unfortunately that becomes very rigid when modeling, especially in a single inheritance language such as Java. Sub classing by types of sugar sounds like a similar problem to me. You would probably benefit from using delegation instead, ie have a single Sugar class and then use the strategy pattern or similar to enhance the behaviour of calculating price. Depending on your domain model, the class type may even be best as 'Product', 'Commodity' or even 'Priceable' or PriceCalculator. But you are the best just of that.
answers question: http://stackoverflow.com/q/25914863

http://stackoverflow.com/q/26031347
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/40777116
tagged with: java
has comment: http://stackoverflow.com/comment/40775813
score: -1
type: Question
has comment: http://stackoverflow.com/comment/40776727
has comment: http://stackoverflow.com/comment/40775646
has comment: http://stackoverflow.com/comment/40780858
has comment: http://stackoverflow.com/comment/40783630
tagged with: roottools
tagged with: android
has answer: http://stackoverflow.com/a/26157887
answer count: 1
accepted answer: http://stackoverflow.com/a/26157887
downvote count: 1
has comment: http://stackoverflow.com/comment/40776410
favorite count: 0
tagged with: root
has title: Copy folders from "/data/data" on Android
has body: I want to copy entire folders from "/data/data/THIRDPARTYPACKAGE" to the SD card. My app crashes whenever I call: FileManager.copyDirectory("/data/data/THIRDPARTYPACKAGE", "/sdcard"); Here is my code so far: class FileManager { public static void copyDirectory(String src, String dest) { File srcDirectory = new File(src); File destDirectory = new File(dest); if (srcDirectory.isDirectory()) { if (!destDirectory.exists()) {destDirectory.mkdirs();} File[] children = srcDirectory.listFiles(); for (File child : children) {FileManager.copyDirectory(child.getAbsolutePath(), destDirectory.getAbsolutePath() + "/" + child.getName());} } else { File directory = destDirectory.getParentFile(); if (!directory.exists()) {directory.mkdirs();} RootTools.copyFile(srcDirectory.getAbsolutePath(), destDirectory.getAbsolutePath(), true, true); } } } Logcat is as per follows: I/notification_cancel_all( 981): [com.wincinderith.totalappkit,-1,0,0] I/am_create_activity( 981): [0,1112896688,22,com.wincinderith.totalappkit/.MainActivity,android.intent.action.MAIN,NULL,NULL,268435456] I/am_proc_start( 981): [0,17197,10163,com.wincinderith.totalappkit,activity,com.wincinderith.totalappkit/.MainActivity] I/am_proc_bound( 981): [0,17197,com.wincinderith.totalappkit] I/am_restart_activity( 981): [0,1112896688,22,com.wincinderith.totalappkit/.MainActivity] I/notification_cancel_all( 981): [com.wincinderith.totalappkit,-1,0,0] I/am_on_resume_called(17197): [0,com.wincinderith.totalappkit.MainActivity] I/am_activity_launch_time( 981): [0,1112896688,com.wincinderith.totalappkit/.MainActivity,6220,6220] I/am_pause_activity( 981): [0,1112896688,com.wincinderith.totalappkit/.MainActivity] I/am_resume_activity( 981): [0,1112896688,22,com.wincinderith.totalappkit/.MainActivity] I/am_on_paused_called(17197): [0,com.wincinderith.totalappkit.MainActivity] I/am_failed_to_pause( 981): [0,1112896688,com.wincinderith.totalappkit/.MainActivity,(none)] I/am_on_resume_called(17197): [0,com.wincinderith.totalappkit.Mai…
has comment: http://stackoverflow.com/comment/40775354

http://stackoverflow.com/comment/40692378
type: Comment
has text: That is the point. In `Integer.parseInt(in.next())` can be replaced with `nextInt()` (if you need `Integer` instead of `int` you can let autobixing handle it).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25985720

http://stackoverflow.com/comment/40606724
comment on: http://stackoverflow.com/q/25938090
score: 0
has text: I think we need more details. What kind of object?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25940448
has comment: http://stackoverflow.com/comment/40611586
upvote count: 0
answers question: http://stackoverflow.com/q/25940276
has comment: http://stackoverflow.com/comment/40611908
has comment: http://stackoverflow.com/comment/40611535
type: Answer
downvote count: 2
has body: String choice2=scan.next(); if(choice2.equals(y)){ System.out.println("How many rows/columns(5-21)?"); try { rows=scan.nextInt(); }catch(Exception e) { rows = -1; } while(rows&lt;5||rows&gt;21){ System.out.println("That is either out of range or not an integer, try again! "); try { rows=scan.nextInt(); }catch(Exception e) { rows = -1; } }
score: -2

http://stackoverflow.com/q/25905519
tagged with: java
has title: How to remove trailing zero from a double?
type: Question
duplicate of: http://stackoverflow.com/q/703396
possible better answer: http://stackoverflow.com/a/25905609
has answer: http://stackoverflow.com/a/25905609
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/703396
has comment: http://stackoverflow.com/comment/40547456
has answer: http://stackoverflow.com/a/25905621
tagged with: currency
accepted answer: http://stackoverflow.com/a/25905621
has comment: http://stackoverflow.com/comment/40547285
tagged with: double
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40547282
has comment: http://stackoverflow.com/comment/40547287
has comment: http://stackoverflow.com/comment/40547343
has body: My program is supposed to calculate change: double purchaseAmount = Double.parseDouble(s1); double amountGiven = Double.parseDouble(s2); double change = purchaseAmount - amountGiven; JOptionPane.showMessageDialog(null, change); String result = "Change consists of:"; My change is counted in bills and coins. But once I get to the coins, which are double: double quarters = 0; if (change &gt;= .25) { quarters = change / .25; change = change - quarters * .25; result = result + quarters + "quarters"; change = change - quarters % .25; } The result is giving me a trailing .0 for instance instead of telling me my change is 1 twenty 2 quarters. I get 1 twenty 2.0 quarters. I've tried almost everything, BigDecimal, NumberFormat DecimalFormat(##.###) I already have a String in the program and would not know how to add another.

http://stackoverflow.com/comment/40677880
score: 0
type: AnswerComment
has text: Set it back to setEditable(true). STill fails.
type: Comment
comment on: http://stackoverflow.com/a/25977846

http://stackoverflow.com/comment/40563144
has text: sorry I just woke and took a closer look at your web xml, I see several mistakes in it. You have commented out critical parts where it's supposed to initialize spring. You need the context loader listener, you need the dispatcher servlet to have its init params, and your match pattern should be '/*' not '/'. I will try to write a formal answer when I get home from work tonight, in the mean time, I suggest you search spring's documentation for the correct way to configure your web xml.
comment on: http://stackoverflow.com/q/25904298
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40528344
type: Comment
type: QuestionComment
has text: @Bidi Look at the question, it contains a link of previous thread discussing the same thing. Only difference the old thread was using an array of `Set`s instead of 2D arrays, but it is easily to modify the solutions from the linked thread to your case. Good Luck.
score: 0
comment on: http://stackoverflow.com/q/25894477

http://stackoverflow.com/a/25992390
has comment: http://stackoverflow.com/comment/40703716
has comment: http://stackoverflow.com/comment/40703969
has comment: http://stackoverflow.com/comment/40703666
score: 0
type: Answer
has body: The method remove doesn't take any arguments , try it.remove(); There is no harm in removing object while iterating from the List if you are using Iterator but calling directly myList.remove(obj/index) can result in ConcurrentModificationException. Care should be taken when you are in multi-threaded environment.
has comment: http://stackoverflow.com/comment/40703896
answers question: http://stackoverflow.com/q/25992350

http://stackoverflow.com/comment/40565309
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25913982
type: AnswerComment
has text: @Rafay Did you check which encoding is set on the table in database?

http://stackoverflow.com/a/25905196
downvote count: 2
has comment: http://stackoverflow.com/comment/40554358
upvote count: 40
has body: Here are some variations on Sotirios Delimanolis' answer, which was pretty good to begin with (+1). Consider the following: static &lt;X, Y, Z&gt; Map&lt;X, Z&gt; transform(Map&lt;? extends X, ? extends Y&gt; input, Function&lt;Y, Z&gt; function) { return input.keySet().stream() .collect(Collectors.toMap(Function.identity(), key -&gt; function.apply(input.get(key)))); } A couple points here. First is the use of wildcards in the generics; this makes the function somewhat more flexible. A wildcard would be necessary if, for example, you wanted the output map to have a key that's a superclass of the input map's key: Map&lt;String, String&gt; input = new HashMap&lt;String, String&gt;(); input.put("string1", "42"); input.put("string2", "41"); Map&lt;CharSequence, Integer&gt; output = transform(input, Integer::parseInt); (There is also an example for the map's values, but it's really contrived, and I admit that having the bounded wildcard for Y only helps in edge cases.) A second point is that instead of running the stream over the input map's entrySet, I ran it over the keySet. This makes the code a little cleaner, I think, at the cost of having to fetch values out of the map instead of from the map entry. Incidentally, I initially had key -&gt; key as the first argument to toMap() and this failed with a type inference error for some reason. Changing it to (X key) -&gt; key worked, as did Function.identity(). Still another variation is as follows: static &lt;X, Y, Z&gt; Map&lt;X, Z&gt; transform1(Map&lt;? extends X, ? extends Y&gt; input, Function&lt;Y, Z&gt; function) { Map&lt;X, Z&gt; result = new HashMap&lt;&gt;(); input.forEach((k, v) -&gt; result.put(k, function.apply(v))); return result; } This uses Map.forEach() instead of streams. This is even simpler, I think, because it dispenses with the collectors, which are somewhat clumsy to use with maps. The reason is that Map.forEach() gives the key and value as separate parameters, whereas the stream has only one value …
answers question: http://stackoverflow.com/q/25903137
score: 38
type: Answer

http://stackoverflow.com/a/25997099
upvote count: 1
score: 1
has body: I found the answer here. The problem is with CDI and JAX-RS annotations. All that I did then: made additional interface without annotations that would be implemented in the bean class and amend bean class. Also, the separate REST interface with annotations should be reflected in the switchyard.xml file: &lt;resteasy:interfaces&gt;your.interface.with.all.jax-rs.annotations&lt;/resteasy:interfaces&gt;
downvote count: 0
answers question: http://stackoverflow.com/q/25974926
type: Answer

http://stackoverflow.com/comment/40607648
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25921961
has text: i'm solved that, just a have a several controller with root mapping. Thx for answer.

http://stackoverflow.com/comment/40595210
comment on: http://stackoverflow.com/q/25931735
type: Comment
type: QuestionComment
has text: That depends on the implementation details of `pInfo.getMemberDetails`, can you share this?
score: 1

mergesort
tags question: http://stackoverflow.com/q/25882697
tag name: mergesort
type: Tag
tags question: http://stackoverflow.com/q/25943144
tags question: http://stackoverflow.com/q/26017357

http://stackoverflow.com/comment/40532981
type: QuestionComment
type: Comment
has text: What line does it crash at? Show the log please?
comment on: http://stackoverflow.com/q/25897486
score: 0

http://stackoverflow.com/comment/40535754
comment on: http://stackoverflow.com/q/25899015
type: Comment
has text: @kwikness [How to avoid Java Code in JSP-Files?](http://stackoverflow.com/q/3177733/1065197)
score: 0
type: QuestionComment

http://stackoverflow.com/q/26013922
upvote count: 2
tagged with: http://stackoverflow.com/tag/xml
has body: Hi all i have java object which i have to convert to xml. For example class like this package com.test.xml; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Customer { String name; int age; public String getName() { return name; } @XmlElement public void setName(String name) { this.name = name; } public int getAge() { return age; } @XmlElement public void setAge(int age) { this.age = age; } } and convert to xml package com.test.xml; import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; public class JAXBExample { public static void main(String[] args) { Customer customer = new Customer(); customer.setName("testName"); customer.setAge(25); try { File file = new File("C:\\testXml.xml"); JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(customer, file); jaxbMarshaller.marshal(customer, System.out); } catch (JAXBException e) { e.printStackTrace(); } } } this will create xml like this <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 25 testName and my question. how to create xml from Customer object like this? <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 25 testName
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26014046
score: 2
tagged with: java
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/26014046
answer count: 1
downvote count: 0
has title: create xml from java object using JAXB
favorite count: 0

http://stackoverflow.com/comment/40691734
type: Comment
comment on: http://stackoverflow.com/a/25985125
score: 0
type: AnswerComment
has text: In the implementation class.

http://stackoverflow.com/comment/40609987
has text: everything is working on my computer, i just dont get how to make it work on someone elses computer
comment on: http://stackoverflow.com/a/25912449
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40544067
type: Comment
comment on: http://stackoverflow.com/q/25903469
score: 0
has text: Thanks. Missed that.
type: QuestionComment

http://stackoverflow.com/a/25956306
type: Answer
has comment: http://stackoverflow.com/comment/40641824
has comment: http://stackoverflow.com/comment/40644499
score: 1
answers question: http://stackoverflow.com/q/25953056
upvote count: 1
has comment: http://stackoverflow.com/comment/40638026
has comment: http://stackoverflow.com/comment/40643963
has body: You can do something like : @RequestMapping(value = "/addProductPart", method = RequestMethod.POST, consumes = "application/json") @ResponseBody public String addProductPart(@RequestBody GetData obj){ System.out.println(obj.jObj.getString("key1")); } Here GetData is class that will receive data in it &amp; map incoming data in it. GetData class : public class GetData{ private JSONObject jObj; //getter-setter // if you are getting more than one element or array of json then : private JSONArray jArray(); // getter-setter } if you want JSonArray then you can make operation on it. It's related code tutorial is Here. Still some problem then post me. You can also use directly JSonObject in method Invocation but if you are getting more data then it's better to use Class &amp; pass it to there. One thing to keep in mind that the Name of received JSonObject &amp; the Name declared in class should be same. Some problem POST me.
downvote count: 0
has comment: http://stackoverflow.com/comment/40641582
has comment: http://stackoverflow.com/comment/40644327

http://stackoverflow.com/comment/97880739
score: 0
type: AnswerComment
has text: Also the first approach will change the caret for all instances of EditText in the application. How should one change the color only of a specific instance of EditText ?
type: Comment
comment on: http://stackoverflow.com/a/26543290

http://stackoverflow.com/a/27960715
score: 0
answers question: http://stackoverflow.com/q/25967241
type: Answer
has body: Spock has interaction listening via Mock: def "should send messages to all subscribers"() { given: def subscriber = Mock(Subscriber) when: publisher.send("hello") then: 1 * subscriber.receive("hello") } See the interaction based testing in the docs

http://stackoverflow.com/comment/40590367
comment on: http://stackoverflow.com/a/25928717
type: AnswerComment
score: 0
type: Comment
has text: Thank you very match for link! I'd put this file in recource directory, written in code System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver"); driver = new ChromeDriver(); and all test passed. Maybe you configurated this driver something better?

http://stackoverflow.com/q/25958783
type: Question
upvote count: 0
has body: I have a listView that uses an Adapter that i created myself. When the first row of the listView is pressed I have made it so it creates a new object from class called Ship that has 3 integer values. Below @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hangar); ListAdapter adapter = new HangarAdapter(this, ship); hangarList.setAdapter(adapter); hangarList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long l) { Intent sendListEvents = new Intent(); if(position == 0) { Ship ship1 = new Ship(); ship1.setAddAmount(50); ship1.setAddTime(5000); ship1.setAddSpend(1000); ship1.shipAdd(); } } } In my adapter i have a textView called TextView2 and I want to set the text of it to ship1's value called addSpend. How do i do that. if (position == 0) { theImageView.setImageResource(R.drawable.planet); TextView2.setText("This is where I want ship1's addSpend value to be displayed") }
score: -1
has title: how do i set the text of a TextView to an object's integer value thats in another class
tagged with: listview
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40645214
type: UnansweredQuestion
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25958850
downvote count: 1

http://stackoverflow.com/q/25984007
has title: how to solve this questions about NullPointerException
answer count: 2
tagged with: nullpointerexception
favorite count: 0
accepted answer: http://stackoverflow.com/a/25984033
has comment: http://stackoverflow.com/comment/40689199
has answer: http://stackoverflow.com/a/25984104
type: AnsweredQuestion
tagged with: java
has body: public static void main(String[] args) { Scanner input = new Scanner(System.in); int size = 5; Point2D.Double[] p; p = new Point2D.Double[size]; for(int i = 0; i &lt; size; i++) { System.out.println("Please enter x of vertice " + (i + 1) + ":"); p[i].x = input.nextDouble(); System.out.println("Please enter y of vertice " + (i + 1) + ":"); p[i].y = input.nextDouble(); } } I actually don't get what's going wrong with these codes. NullPointerException always happens at "p[i].x = input.nextDouble()". Any help will be appreciated.
possible better answer: http://stackoverflow.com/a/25984104
downvote count: 1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/25984033
score: -1

http://stackoverflow.com/q/25962164
has answer: http://stackoverflow.com/a/30465596
accepted answer: http://stackoverflow.com/a/30465596
tagged with: java
has body: I have various unit test classes in my system, and they all extend a centralized test class called AbstractContextTest. Said abstract superclass generally looks like this: @RunWith(SpringJUnit4ClassRunner.class) @TestExecutionListeners({DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class}) @ContextConfiguration(locations = {"/TestContext.xml"}) public class AbstractContextTest { // Various utility methods that would be useful in a unit test. ... } The important thing to note here is the @ContextConfiguration line. It uses the locations attribute to load the test Application Context stored in an XML file. It works by using a relative path, which allows me to do the following: I place my AbstractContextTest superclass in its own project. I configure my other projects to have my AbstractContextTest project as a test-level dependency. I place an identically-named TestContext.xml in each of my projects' test resources. When I run all my unit tests, each project uses its local TestContext.xml due to the relative pathing. All is right with the world. So now for the actual question: I wish to move on from the halcyon days of Spring XML Application Contexts into the brave new world of Spring JavaConfigs. Is there an equivalent to my relative path solution in this paradigm? If so, how do I pull it off?
tagged with: spring-java-config
tagged with: unit-testing
type: Question
possible better answer: http://stackoverflow.com/a/25962483
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40648983
has title: Spring Test - JavaConfig per Project
has answer: http://stackoverflow.com/a/25962483
has answer: http://stackoverflow.com/a/25962494
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/q/26031496
has comment: http://stackoverflow.com/comment/40775217
score: -2
has answer: http://stackoverflow.com/a/26031565
has comment: http://stackoverflow.com/comment/40775420
has comment: http://stackoverflow.com/comment/40775205
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/40775197
has title: Why getting getActionBar null in android
type: Question
upvote count: 0
linked to: http://stackoverflow.com/q/6867076
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/40775240
answer count: 1
duplicate of: http://stackoverflow.com/q/6867076
has comment: http://stackoverflow.com/comment/40775921
favorite count: 0
has comment: http://stackoverflow.com/comment/40775184
has body: I want to get instance of action bar but getting the value null and because of that my whole program is not running. My code where I have included this method is: When my code jumps to line where action bar is needed it gives me null pointer exception HomeTab.java: import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; public class HomeTab extends Activity implements OnItemClickListener{ MyCustomAdapter myCustomAdapter; Context context=HomeTab.this; //ImageView menuimage; String optionName[]=new String[] {"Alerts","Events","Newsletters","News","Parent Info","Logins","Parent Teacher Interviews","Flexi School LunchOrder","Contact US","Kool Content"}; //int image[]=new int[] {R.drawable.alert_small_icon,R.drawable.events,R.drawable.newsletter,R.drawable.newsletter,R.drawable.arrow_24,R.drawable.arrow_24,R.drawable.arrow_24,R.drawable.arrow_24,R.drawable.arrow_24,R.drawable.arrow_24}; int imageArrow[]=new int[]{R.drawable.right_arrow}; ArrayList&lt;ListModel&gt; mylist=new ArrayList&lt;ListModel&gt;(); // test for sliding drawer /* String[] menu; DrawerLayout dLayout; ListView dList; ArrayAdapter&lt;String&gt; adapter;*/ /* * code from leftslide * */ private DrawerLayout mDrawerLayout; public ListView DrawerList; private ActionBarDrawerToggle mDrawerToggle; // nav drawer title private CharSequence mDrawerTitle; // used to store app title private CharSequence mTitle; // slide menu items private String[] navMenuTitles; private TypedArray navMenuIcons; private ArrayList&lt;NavDrawerItem&gt; navDrawerItems; private NavDrawerListAdapter adapter; LayoutInflater inflater=null; // code upto left slide @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_view_layout); //menuimage=(ImageView)findViewById(R.id.menuimage); //new code below /*menuimage=(ImageView)findViewById(R.id.menuimage); adapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_lis…
type: UnansweredQuestion
tagged with: android
tagged with: android-actionbar

http://stackoverflow.com/q/25888007
has comment: http://stackoverflow.com/comment/40515283
tagged with: java
has answer: http://stackoverflow.com/a/25888074
has comment: http://stackoverflow.com/comment/40515187
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40515927
type: Question
tagged with: google-maps
has answer: http://stackoverflow.com/a/25888088
has comment: http://stackoverflow.com/comment/40516191
has comment: http://stackoverflow.com/comment/40516169
answer count: 3
has answer: http://stackoverflow.com/a/25888097
upvote count: 1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40516005
favorite count: 0
linked to: http://stackoverflow.com/q/2091465
downvote count: 5
type: UnansweredQuestion
score: -4
tagged with: android
has comment: http://stackoverflow.com/comment/40515211
has title: How to get the first value of Arraylist
has body: I am working on map v2. I wanted to convert latitude and longitude into the text address.So i used Geocoder class to locate the address. Now the problem is when i used List, it gives so many confusing locations. It might be the list of locations. I want to retrieve just the first location among them and pass that location to another activity. How can i do that? Please help.Its an emergency.Below is my code: try { Geocoder gcd = new Geocoder(this, Locale.getDefault()); List&lt;Address&gt; addresses = gcd.getFromLocation( dmylats, dmylong, 1); if (addresses.size() &gt; 0) Toast.makeText(this, "You are at "+addresses,Toast.LENGTH_LONG).show(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } I just want the first value among the List.

http://stackoverflow.com/q/25977437
tagged with: eclipse
answer count: 1
has title: Android Eclipse context cannot be resolved in return type
linked to: http://stackoverflow.com/q/23353173
has comment: http://stackoverflow.com/comment/40677459
type: UnansweredQuestion
tagged with: class
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/40677339
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/25977984
has body: I have problems understanding Context I write a program to control my light, but I need to check if he doesn't connect the wrong WiFi and then use a wrong IP. I try multiple options without a good solution. I look to a few earlier question about context whiteout success. If you need the full program I can send it to you, but I think this is enough code:) The exact problem is by getCurrentSsid(context) error: context cannot be resolved in return type //CLASS SENDCOMMAND public class SendCommand extends AsyncTask&lt;String, Integer, JSONArray&gt; { static boolean WifiSSID; public SendCommand(boolean wifi) { this.wifi = wifi; } //FUNCTION TO CHECK THE CURREN SSID public boolean getCurrentSsid(Context context) { ssid = null; ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (networkInfo.isConnected()) { final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); final WifiInfo connectionInfo = wifiManager.getConnectionInfo(); if (connectionInfo != null &amp;&amp; !TextUtils.isEmpty(connectionInfo.getSSID())) { ssid = connectionInfo.getSSID(); } } if (ssid =="Room#2") return true; else return false; } //wifiSSID = boolean getCurrentSsid(context); //send the command @Override protected JSONArray doInBackground(String... params) { // TODO Auto-generated method stub Log.d(tag, "Beginnen do in background"); Log.d(tag, "Wifi is " + wifi); HttpClient client = new DefaultHttpClient(); HttpGet get; if (wifi &amp;&amp; **getCurrentSsid(context)**){ //HERE HE GIVES A ERROR getCurrentSsid(context)
score: 0
tagged with: java

http://stackoverflow.com/q/25930944
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/25931769
has body: I have fxml and controller class. In controller class I have someAction() method and in fxml I set #someAction as onAction for some Button. Now I want to create button not in fxml but dynamically from java code as button = new Button(). I still load fxml and I still have this controller with someAction() method. How can I set someAction() as onAction for my button? From java code I found only setOnAction(EventHandler&lt;ActionEvent&gt; eh). Is there a way to specify onAction in fxml-like style, just telling method name in controller class?
has title: JavaFX dynamically add buttons
answer count: 1
tagged with: fxml

http://stackoverflow.com/comment/40636476
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25955445
has text: @AvinashRaj - ... which is probably impossible. Hence the futility of attempting to do this using regexes.

http://stackoverflow.com/q/25938573
tagged with: data-structures
answer count: 1
has comment: http://stackoverflow.com/comment/40607591
favorite count: 0
accepted answer: http://stackoverflow.com/a/25939266
has body: Write code that pushes 10 strings onto the stack (version 2), printing while it goes, then pops them off, printing while it removes. import java.math.*; public class StackTest { public static void main (String[] args){ Stack2 stk = new Stack2("Stack"); for(int i = 0; i &lt; 10; i++){ stk.push("Item: " + (i + 1)); System.out.println("Pushing: Item: " + (i + 1)); } System.out.println("\n" + stk.print()); for(int i = 0; i &lt; 10; i++){ System.out.println("Popping: " + stk.pop()); } System.out.println("\n" + stk.print()); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40607760
upvote count: 2
score: 0
tagged with: stack
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/40607689
type: Question
has comment: http://stackoverflow.com/comment/40608248
has answer: http://stackoverflow.com/a/25939266
has title: Can someone help me understand how this code works? It was an example in class and I want to learn more efficiently

http://stackoverflow.com/a/26012957
type: Answer
has body: Just change one thing, in second for loop j should go to (i+1) means j>=(i+1), public class Strings { public static void main (String[] args) { String var = " "; String data = "I like it when it rains hard"; String [] s = data.split(" "); for (int i = 0 ; i &lt;= s.length-1 ; i++) { //inner for (int j = s.length-1 ; j &gt;= i+1 ; j--) { //outer for ( int num = i ; num &lt;= j ; num++) { var += s[num] + " "; } System.out.println(var); var = " "; } } } } And you get same output as you wanted I like it when it rains hard I like it when it rains I like it when it I like it when I like it I like like it when it rains hard like it when it rains like it when it like it when like it it when it rains hard it when it rains it when it it when when it rains hard when it rains when it it rains hard it rains rains hard
score: 0
answers question: http://stackoverflow.com/q/26012285

http://stackoverflow.com/a/35603473
upvote count: 73
score: 73
has body: As said in this article you should use MockMvc when you want to test Server-side of application: Spring MVC Test builds on the mock request and response from spring-test and does not require a running servlet container. The main difference is that actual Spring MVC configuration is loaded through the TestContext framework and that the request is performed by actually invoking the DispatcherServlet and all the same Spring MVC infrastructure that is used at runtime. for example: @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration("servlet-context.xml") public class SampleTests { @Autowired private WebApplicationContext wac; private MockMvc mockMvc; @Before public void setup() { this.mockMvc = webAppContextSetup(this.wac).build(); } @Test public void getFoo() throws Exception { this.mockMvc.perform(get("/foo").accept("application/json")) .andExpect(status().isOk()) .andExpect(content().contentType("application/json")) .andExpect(jsonPath("$.name").value("Lee")); }} And RestTemplate you should use when you want to test Rest Client-side application: If you have code using the RestTemplate, you’ll probably want to test it and to that you can target a running server or mock the RestTemplate. The client-side REST test support offers a third alternative, which is to use the actual RestTemplate but configure it with a custom ClientHttpRequestFactory that checks expectations against actual requests and returns stub responses. example: RestTemplate restTemplate = new RestTemplate(); MockRestServiceServer mockServer = MockRestServiceServer.createServer(restTemplate); mockServer.expect(requestTo("/greeting")) .andRespond(withSuccess("Hello world", "text/plain")); // use RestTemplate ... mockServer.verify(); also read this example
answers question: http://stackoverflow.com/q/25901985
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/92089217
has comment: http://stackoverflow.com/comment/101753784
type: Answer
has comment: http://stackoverflow.com/comment/92109216
accepted answer of: http://stackoverflow.com/q/25901985

http://stackoverflow.com/q/25945439
tagged with: jpanel
has answer: http://stackoverflow.com/a/25945451
accepted answer: http://stackoverflow.com/a/25945451
has answer: http://stackoverflow.com/a/72115916
upvote count: 2
linked to: http://stackoverflow.com/q/7229226
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/40620239
has title: Setting JButton size
answer count: 4
score: 2
possible better answer: http://stackoverflow.com/a/25945472
downvote count: 0
linked to: http://stackoverflow.com/q/25945061
tagged with: java
tagged with: swing
has body: I'm trying to resize JButton to always be a certain size. I have 9 of these buttons. I understand from the API that it JButton inherits setSize(int a, int b) and setSize(Dimension d). I opted to use the second though I tried the other and it didn't fix my problem. Here is the code. // setup buttons reset = new JButton("Reset"); square1 = new JButton(); square2 = new JButton(); square3 = new JButton(); square4 = new JButton(); square5 = new JButton(); square6 = new JButton(); square7 = new JButton(); square8 = new JButton(); square9 = new JButton(); //set button size Dimension d = new Dimension(100,100); square1.setSize(d); square2.setSize(d); square3.setSize(d); square4.setSize(d); square5.setSize(d); square6.setSize(d); square7.setSize(d); square8.setSize(d); square9.setSize(d); I've tried several diferent dimensions and none of them make any difference. What am I missing? I'm using a gridLayout(3,3,5,5) for the the JPanel that the buttons are on. The dimensions for the JFrame are (400,425). Thanks for any help!
type: Question
tagged with: jbutton
has answer: http://stackoverflow.com/a/26452582
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25945472

http://stackoverflow.com/comment/40596984
score: 0
type: QuestionComment
has text: The values of e1 and e2 are null. Java is pass-by-value, and will pass only the value of a variable, when that variable is used as call parameter. That is the variable will never be reassigned inside the function, and the parameter name in the function will have nothing to do with any variable.
type: Comment
comment on: http://stackoverflow.com/q/25932730

http://stackoverflow.com/a/25958910
answers question: http://stackoverflow.com/q/25958857
has body: The java.lang package provides the functionality to convert a decimal number into a binary number. The method toBinaryString() comes in handy for such purpose. Bellow is the code: import java.lang.*; import java.io.*; public class DecimalToBinary{ public static void main(String args[]) throws IOException{ BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the decimal value:"); String hex = bf.readLine(); int i = Integer.parseInt(hex); String by = Integer.toBinaryString(i); System.out.println("Binary: " + by); } }
has comment: http://stackoverflow.com/comment/76194241
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/26027525
has answer: http://stackoverflow.com/a/26028080
tagged with: entity
answer count: 2
tagged with: sql
upvote count: 1
favorite count: 0
has body: I created a @OneToMany relationship with Entities. For instance, Member and Address. These two are joined by Mem_Addr table. When I deploy the application, the log shows: EntityBinder I org.hibernate.cfg.annotations.EntityBinder bindTable Bind entity Address on table ADDRESS But the table doesn't exist the in the database.. Not sure how this happens?!?! Secondly, the Hibernate query (from the Log) to pull members, which is expected to show Address Query as well. But the query does not have Address / Mem_addr tables included. Its just pulling Members alone, ignoring address, despite @OneToMany annotation. Any ideas? Does Hibernate intelligently recognizes non-existance of table and does not include that table in the query? Edit Updated for clarity.
linked to: http://stackoverflow.com/q/13047483
tagged with: logging
has answer: http://stackoverflow.com/a/26045717
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: hibernate
type: Question
has title: Hibernate Generated query - Non existent table
linked to: http://stackoverflow.com/q/26046275

http://stackoverflow.com/a/25881864
score: 0
type: Answer
has body: When you declare a variable inside a method, its scope is limited to that method. Your code declares local variables inside the calculate() method that do NOT exist once the method returns. These variables have the same names as your public class variables, which are never used (except c).
answers question: http://stackoverflow.com/q/25881809

http://stackoverflow.com/comment/40668967
type: Comment
type: QuestionComment
has text: The reference property 'texto' if for my class Comentario for variable private String texto;
comment on: http://stackoverflow.com/q/25893283
score: 0

constraint-programming
tags question: http://stackoverflow.com/q/25901648
type: Tag
tag name: constraint-programming

http://stackoverflow.com/q/25894363
linked to: http://stackoverflow.com/q/22424087
score: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25899868
tagged with: jhipster
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: Why so many validation errors on a jhipster built app when importing into STS?
type: Question
upvote count: 2
answer count: 2
tagged with: maven
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/29998037
has body: I was looking at What is the correct Eclipse setup for JHipster? and decided I have a similar question with enough differences to warrant posting a separate question. I am able to build and run a jhipster app using yo that seems to run ok (I choose defaults with the exception of the database - which is MySQL in both local and prod, plus websockets, and "y" to the CSS package). I am then able to import the maven project into STS 3.5 and run it ok from there as well. The only thing I'd like to figure out is why all of this seems to work even when there are so many DTD, JSON, XML and even one Java error reporting in STS for this project? Should I choose to ignore some of these validations in my STS project, or are these legitimate jhipster bugs? Errors include: Description Resource Path Location Type APT Problems (1 item) JSR250: CommonAnnotations for Java, 2.5: @PostConstruct methods must not throw checked exceptions. Application.java /pdbClient/src/main/java/com/staples/pdbc line 35 Annotation Problem DTD Problem (2 items) The declaration for the entity "ContentType" must end with '>'. strict.dtd /pdbClient/node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-svgo/node_modules/svgo/node_modules/sax/examples line 81 DTD Problem . . . JSON Problem (23 items) Object is not closed. bower.json /pdbClient/node_modules/bower/node_modules/bower-json/test/pkg-bower-json-malformed line 1 JSON Problem Unexpected token '/'. Expected '}', ','. broken.json /pdbClient/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/npmconf/node_modules/config-chain/test line 10 JSON Problem (etc.). . . Unexpected token '&lt;%'. Expected a string or '}'. _bower.json /pdbClient/node_modules/generator-jhipster/app/templates line 4 JSON Problem (etc.). . . XML Problem (30 items) The content of elements must consist of well-formed character data or markup. _pom.xml /pdbClient/node_modules/generator-jhipster/app/templates line 4 XML Problem The element…

http://stackoverflow.com/q/25890486
score: 6
linked to: http://stackoverflow.com/q/54706274
has title: Xlib: Adding a window to the save-set using XAddToChangeSet does not work from Java/JNI
has comment: http://stackoverflow.com/comment/96202537
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: I am getting stuck and don't know where to look further. I have a Java application and one of its functionality is to grab some specific windows (ie third party application windows) and host them within itself (with some extra frames, etc...) The whole thing works great, except when my Java application gets killed (or crashes). When this happens, the third party windows that were hosted are getting destroyed, most of the time crashing the third party application altogether. This feature is designed to work under Linux. The way the reparenting is done is a bit convoluted: A dedicated Java thread is created and calls a C shared library (a .so lib). This shared lib scans all the current windows and identifies the ones that need to be hosted when such a window is detected, it is reparented to the main Java application window using XReparentWindow the shared library enters an infinite loop (controled by an exit flag) and waits for the XEvent (using XNextEvent) in case a window that needs to be hosted gets displayed. I have written a dummy C program that uses most of the library code (without the JNI bit) to debug this issue using xclock as my hosted test application. I can reproduce the exact same behaviour: when killing the dummy program, the Xclock window disappears and soon after xclock crashes. Then I modify the shared library routines to use the XAddToSaveSet function. This works a treat with my sample program: the Xclock window gets properly restored and reparented to the ROOT window. Now doing the same thing with the Java application does not work: the hosted windows are not getting reparented to the ROOT window. I have monitored what is going on using gdb, xev and also xmon. The XAddToChangeSet is properly called, I can see the ChangeSet request going through xmon (and the window ID is correct), but when the Java application crashes the event DestroyWindow is sent to the hosted window, when I was expecting to see a RemapWindow event (like when using the sample C …
has answer: http://stackoverflow.com/a/25902382
type: Question
accepted answer: http://stackoverflow.com/a/25902382
tagged with: xlib
upvote count: 6
answer count: 1
tagged with: x11
favorite count: 0
tagged with: linux

http://stackoverflow.com/q/25949767
type: AnsweredQuestion
has body: This is the desired output: https://i.sstatic.net/H3xgw.jpg So basically, I'm using a GridView to generate all those 18 buttons and I am trying to add some TextViews on top of every Button, and 2 on the bottom side of the last buttons. This is my Adapter implementation: import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.TextView; /** * Created by pop on 9/15/2014. */ public class CustomGridAdapter extends BaseAdapter { private Context _context; private String[] _items; LayoutInflater _inflater; public CustomGridAdapter(Context context, String[] items) { this._context = context; this._items = items; _inflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return _items.length; } @Override public Object getItem(int position) { return _items[position]; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = _inflater.inflate(R.layout.screen_gridcell_time, null); } Button button = (Button) convertView.findViewById(R.id.calendar_day_gridcell); button.setText(_items[position]); return convertView; } } My gridcell: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:background="@android:color/transparent" android:padding="4dp"&gt; &lt;ToggleButton android:id="@+id/calendar_day_gridcell" android:layout_width="100dp" android:layout_height="40dp" android:layout_gravity="center" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="@color/wampWhite" android:background="@drawable/time_input_button_selector" and…
tagged with: java
score: 0
answer count: 2
tagged with: adapter
possible better answer: http://stackoverflow.com/a/25959034
has answer: http://stackoverflow.com/a/25950332
accepted answer: http://stackoverflow.com/a/25950332
tagged with: android
has title: Adding more elements to a GridView using adapters in Android
has answer: http://stackoverflow.com/a/25959034
type: Question

http://stackoverflow.com/comment/40633690
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25954035
score: 0
has text: http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#close()

http://stackoverflow.com/comment/40543092
comment on: http://stackoverflow.com/q/25903068
type: Comment
type: QuestionComment
score: 8
has text: Do what the error message tells you to do -- give your class a main method. And also, read a Java book, at least the first chapter, since you can't make this stuff up and expect it to work. Programming is an exercise in precision, and so you will have to learn the lingo and adhere to the rules, else the compiler will complain and the code will not function. So again, please follow your book, you won't regret doing this.

http://stackoverflow.com/q/25901623
tagged with: stream
tagged with: java
type: Question
answer count: 1
score: 0
has title: how to unmarshall objects to particular type by identifying its type form xml?
has body: I have a server and a client, server is basically a CEP(complex event processing system) which receives multiple streams of sensor data in the form of POJO(plain old java objects). Client generates this data and send it to server over LAN. I decided to create POJO of each type of sensor data, marshall it and send it to server from client. now problem is identifying which sensor type data received at server and unmarshalling to that type of object. Please someone help, thanks in advance :)
has answer: http://stackoverflow.com/a/25904078
type: UnansweredQuestion

http://stackoverflow.com/comment/40664057
comment on: http://stackoverflow.com/a/25970231
has text: Hi, Martin, if i create jtree with DefaultTreeModel, then sure i can get it back. But as i said i created the jtree with "top.add()" function, is this kind of "add" also working on an unseen DefaultTreeModel, and i can get it back?
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/40561984
type: Comment
has text: I have sources with Maven dependency, `artifactId = avSignatureV`. In project it is used like `import SignatureV.SignatureVerifier;`. The depenency is not resolved, but I have a whole compiled project.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25913490

http://stackoverflow.com/a/25921966
has body: Your approach will give the correct answer, but it's quite slow, since you are guaranteed to loop all the way through each array each time, giving O(n2) runtime. One way to make this much faster, while maintaining a similar approach would be to sort the bigger set. This allows you to do a binary search for each character in the smaller set, rather than having to iterate all the way through each time: int matchCounter = 0; Arrays.sort(biggest); for (char c : smallest) { if (Arrays.binarySearch(biggest, c) &gt;= 0) { matchCounter++; } } System.out.println(matchCounter); // 4
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25921739
answers question: http://stackoverflow.com/q/25921739
type: Answer

http://stackoverflow.com/comment/40650657
has text: Yeah, you're right; calling the new method from main rather than just calling it from another, more sketchy method works perfectly. Thanks for the help!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25963060

http://stackoverflow.com/comment/40607920
comment on: http://stackoverflow.com/a/25912449
type: Comment
has text: @ madhawa priyashanta your video is brilliant i am sure there are quite a lot of newbie java users that wouldnt know this!! many Thanks, I am still working on getting my file open on another computer
score: 0
type: AnswerComment

http://stackoverflow.com/a/26000827
has comment: http://stackoverflow.com/comment/40757541
type: Answer
has body: Glassfish 4.1 updated its CDI version to 1.2 (Glassfish 4.0 used CDI 1.1). As you don't give info on how your application is packaged, I'll give you all the points to check: Check that don't have a cdi-api.jar file in your war Check you don't have any weld related jar in your war as well Use version 1.2 of CDI Api to compile your code. Check on the site spec to download the file or change your Maven config like this javax.enterprise cdi-api 1.2 provided There are no change in the API between 1.1 and 1.2 but all the OSGi config has changed so you might encounter an issue with those changes.
has comment: http://stackoverflow.com/comment/44372895
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/25964497
answers question: http://stackoverflow.com/q/25964497
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40709008
score: 0
type: AnswerComment
type: Comment
has text: means i want to say i have used your code line but when i run the app this syntax public class xyz { public static void main(String args[]) { for(int i = 0; i < 2; i++) { for(int j = 2; j>= 0; j--) { if(i == j) break; System.out.println("i=" + i + " j="+j); } } } } is not display in textview.
comment on: http://stackoverflow.com/a/25994761

http://stackoverflow.com/comment/40499298
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25878210
has text: @user3002486: I *told* you what "too much code" means, and gave you a link to more helpful documentation. You shouldn't lop off code that's necessary in order to reproduce your problem; rather, you should trim your program to remove everything that's *not* needed to reproduce your problem.

http://stackoverflow.com/q/25878210
has comment: http://stackoverflow.com/comment/40498476
has comment: http://stackoverflow.com/comment/40499142
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40499040
has answer: http://stackoverflow.com/a/25878691
tagged with: java
has comment: http://stackoverflow.com/comment/40498415
has comment: http://stackoverflow.com/comment/40498562
has comment: http://stackoverflow.com/comment/40499105
type: Question
has comment: http://stackoverflow.com/comment/40498838
has comment: http://stackoverflow.com/comment/40498533
has body: I have 3 classes: administrator, salaried employee, and employee. Administrator extends from salaried employee and that extends from employee. Here are their default constructors: Employee: public class Employee { private String name; private Date hireDate; public Employee( ) { name = "No name"; hireDate = new Date("Jan", 1, 1000); //Just a placeholder. } /** Precondition: Neither theName nor theDate is null. */ public Employee(String theName, Date theDate) { if (theName == null || theDate == null) { System.out.println("Fatal Error creating employee."); System.exit(0); } name = theName; hireDate = new Date(theDate); } public Employee(Employee originalObject) { name = originalObject.name; hireDate = new Date(originalObject.hireDate); } } SalariedEmployee: public class SalariedEmployee extends Employee { private double salary; //annual public SalariedEmployee( ) { super( ); salary = 0; } /** Precondition: Neither theName nor theDate are null; theSalary is nonnegative. */ public SalariedEmployee(String theName, Date theDate, double theSalary) { super(theName, theDate); if (theSalary &gt;= 0) salary = theSalary; else { System.out.println("Fatal Error: Negative salary."); System.exit(0); } } public SalariedEmployee(SalariedEmployee originalObject ) { super(originalObject); salary = originalObject.salary; } } Administrator: //Create a test program that uses scanner so person can input values for the admin class. public class Administrator extends SalariedEmployee { private String title; private String responsibility; private String supervisor; //No argument Constructor public Administrator( ) { super( ); title = "No Title"; responsibility = "No Responsibility"; supervisor = "Dilbert"; } //3 argument constructor public Administrator(String theTitle, String theResponsibility, String theSupervisor) { super( ); if (theTitle == null || theResponsibility == null || theSupervisor == null) { System.out.println("Fatal Error creating employee."); System.exit(0); } title = theTitle;…
score: 0
has comment: http://stackoverflow.com/comment/40499238
has comment: http://stackoverflow.com/comment/40499194
answer count: 1
has comment: http://stackoverflow.com/comment/40499099
has comment: http://stackoverflow.com/comment/40498692
has comment: http://stackoverflow.com/comment/40498451
favorite count: 0
has title: Constructor Inheritance getting fatal error on new object
tagged with: constructor
has comment: http://stackoverflow.com/comment/40499687
upvote count: 2
has comment: http://stackoverflow.com/comment/40499298
downvote count: 2
accepted answer: http://stackoverflow.com/a/25878691

http://stackoverflow.com/comment/40742571
comment on: http://stackoverflow.com/q/26013840
type: Comment
type: QuestionComment
score: 5
has text: Replace <= in for loop with <.Refresh your array concepts.

http://stackoverflow.com/comment/40611341
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25936217
score: 0
has text: and before you ask, here is the lowest-level API-function which is forcibly used by ALL the windows-binaries in existence. Well ... one may use special kernel-functions instead but thats another story and doesnt apply to most developers. http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx Yes, even the JVM uses it. No, there is no "bypass" of this function. Yes, even OpenFile transparently calls this function even though its name would suggest otherwise. Yes, i can prove that but lets not push SO-boundaries here.

http://stackoverflow.com/a/26005362
upvote count: 0
has body: assuming the labels between "&lt;" &amp; ">" has to match and the numbers in between are identical use this pattern ^\d+\s&lt;([A-Z]+)&gt;\s(\d+\s)(\2)+&lt;\/(\1)&gt;$ Demo or if numbers in the middle do not have to be identical and or optional: ^\d+\s&lt;([A-Z]+)&gt;\s(\d+\s)*&lt;\/(\1)&gt;$
answers question: http://stackoverflow.com/q/26005150
type: Answer
downvote count: 1
score: -1

http://stackoverflow.com/q/25873678
type: AnsweredQuestion
has title: ListView not navigating to other activities
tagged with: android-intent
has answer: http://stackoverflow.com/a/25874573
has comment: http://stackoverflow.com/comment/40528402
type: Question
accepted answer: http://stackoverflow.com/a/25873796
tagged with: android-layout
tagged with: java
possible better answer: http://stackoverflow.com/a/25874573
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40528151
has answer: http://stackoverflow.com/a/25873780
has comment: http://stackoverflow.com/comment/40489688
has answer: http://stackoverflow.com/a/25873796
has comment: http://stackoverflow.com/comment/40528232
tagged with: android
has body: I'm trying to get my list view to navigate to different activities based on a specific item that has been tapped. I know that the code is what's need but I don't know what I need to change my to package com.apptacularapps.exitsexpertlondonlite; import android.app.ActionBar; import android.app.ListActivity; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.text.Html; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import java.util.ArrayList; public class WC_line extends ListActivity { ArrayList&lt;Item&gt; items = new ArrayList&lt;Item&gt;(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); items.add(new EntryItem("Bank", "Fare zone 1")); items.add(new EntryItem("Waterloo", "Fare zone 1")); EntryAdapter adapter = new EntryAdapter(this, items); setListAdapter(adapter); } @Override public void onListItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long id){ //When clicked, go to specific activity if (position == 0) { //code specific to first list item Intent myIntent = new Intent(view.getContext(), activity_1.class); startActivityForResult(myIntent, 0); } }; } XML @Override error package com.apptacularapps.exitsexpertlondonlite; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import java.util.ArrayList; public class WC_line extends ListActivity { ArrayList&lt;Item&gt; items = new ArrayList&lt;Item&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ListView list = getListView(); setContentView(R.layout.activity_wc_line); items.add(new EntryItem("Bank", "Fare zone 1")); items.add(new EntryItem("Waterloo", "Fare zone 1")); EntryAdapter adapter = new EntryAdapter(this, items); …
has comment: http://stackoverflow.com/comment/40489687
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40489806

http://stackoverflow.com/comment/40515283
type: Comment
comment on: http://stackoverflow.com/q/25888007
has text: And please be clear as to which value you want? First or last?
score: 0
type: QuestionComment

http://stackoverflow.com/a/25956657
upvote count: 1
has body: you need to change MainMenuActivity's base class from Activity to ActivityGroup, as follows: public class MainMenuActivity extends ActivityGroup { ... } ActivityGroup will take care of an instance of LocalActivityManager. So you don't need to create it. After the base class is changed, just call getLocalActivityManager() function defined in the base class to get that instance. Call tabHost's setup function like this: tabHost.setup(this.getLocalActivityManager());
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25956586
answers question: http://stackoverflow.com/q/25956586
type: Answer

http://stackoverflow.com/q/26027990
tagged with: maven
score: 2
tagged with: java
has body: I got a short question, for a while I'm trying to get my application building with maven and running into small hickups. To get started I updated it from: Grails 1.3.7 -> 2.0 -> 2.1 -> 2.3.8 using the standard BuildConfig.groovy, which works fine and my app behaves as it should. Now after executing: grails create-pom mycompany and adjusting the pom to reflect the reality a bit more, I keep running into the following error: [context.ContextLoader] [ERROR] [16:00:24] [Context initialization failed] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Lgrails/plugin/searchable/SearchableService; at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:733) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:233) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1214) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:455) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90) at org.eclipse.jetty.server.Server.doStart(Server.java:261) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) at org.grails.jetty.JettyServer.startServer(JettyServer.groovy:134) at org.grails.jetty.JettyServer.start(JettyServer.groovy:99) at _GrailsRun$_run_closure1.doCall(_GrailsRun.groovy:60) at RunApp$_run_closure1.doCall(RunApp.groovy:33) at org.grails.launcher.GrailsLauncher.launch(GrailsLauncher.java:144) at org.grails.maven.plugin.tools.ForkedGrailsRuntime.main(ForkedGrailsRuntime.java:168) Caused by: java.lang.NoClassDefFoundError: Lgrails/plugin/sea…
type: Question
has answer: http://stackoverflow.com/a/26028027
tagged with: grails
answer count: 2
has title: Grails 2.3.8 Searchable Plugin and Maven
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26047106

http://stackoverflow.com/comment/40627978
has text: Did you notice the change? @user2697241
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25950616
type: AnswerComment

http://stackoverflow.com/comment/40708805
type: AnswerComment
has text: X and Y are in pixels. As I said in the question I already knew how to calculate the distance between points. In the example above I calculated the X and Y for the second point and then calculate the distance between the middle point (which I had already) and the new point (x,y).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25975537

http://stackoverflow.com/comment/40588858
comment on: http://stackoverflow.com/a/25928023
has text: @atf `12:32:08` is time. What is your expected out put?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/58910811
score: 0
type: Comment
has text: (Examples are from the link)
comment on: http://stackoverflow.com/a/35613453
type: AnswerComment

http://stackoverflow.com/comment/40592994
type: AnswerComment
comment on: http://stackoverflow.com/a/25929381
score: 0
type: Comment
has text: @Feroc the problem is that [you can't instantiate a new instance of an enum via reflection](http://stackoverflow.com/questions/9614282/how-to-create-an-instance-of-enum-using-reflection-in-java) so I'm not sure if mockito can work around that limitation...

http://stackoverflow.com/comment/40634639
type: QuestionComment
comment on: http://stackoverflow.com/q/25946128
has text: @MadProgrammer One of us is confused, and I'm not sure who. My point was that this 'update label using *long running task*' was more for `SwingWorker`..
score: 0
type: Comment

http://stackoverflow.com/a/26105357
has body: Without a snippet there are several guesses to make, but this situation seems familiar to me. Try adding a renderer to your JTree that performs an updateUI() on the rendering component before returning it: tree.setCellRenderer(new DefaultTreeRenderer() { public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); // You can do more changes here ((JComponent) c).updateUI(); return c; }}); About the updating, if "emulating" means implementing it and does what's supposed to do, that's correct. As long as it implements TreeModel and the methods do what's supposed, JTree should do the rest. The truncation might be related to the fact that trees and tables do not lay their "components" out but use renderers instead to paint them in faked containers. And, by the way, you can have a look at EventListenerList for a proper collection of event listeners.
has comment: http://stackoverflow.com/comment/40935082
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40967408
answers question: http://stackoverflow.com/q/26003531

http://stackoverflow.com/q/26022699
tagged with: user-interface
answer count: 1
has answer: http://stackoverflow.com/a/26022904
has body: I am trying to code a memory visualizer that will update a graph with current memory statistics and have a numerical representation just to the side of it. I have an update method that runs in a thread and should update every second. The issue is that none of it updates on the GUI, and in fact I believe the code stops after one iteration. I believe it has to do with some of the setText() calls because if I comment them out, then at least the graph will update. Here is my intialize method @Override public void initialize(URL arg0, ResourceBundle arg1) { assert memUsage_lineChart != null : "fx:id=\"memUsage_lineChart\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_totalMem != null : "fx:id=\"text_totalMem\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_usedMem != null : "fx:id=\"text_usedMem\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_availableMem != null : "fx:id=\"text_availableMem\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_percentageUsed != null : "fx:id=\"text_percentageUsed\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_totalRuntime != null : "fx:id=\"text_totalRuntime\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_threadsUsed != null : "fx:id=\"text_threadsUsed\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_version != null : "fx:id=\"text_version\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_timeAtMaxMem != null : "fx:id=\"text_timeAtMaxMem\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_maxMemReached != null : "fx:id=\"text_maxMemReached\" was not injected: check your FXML file 'MemoryVisualization.fxml'."; assert text_timeOfLastAssociation != null : "fx:id=\"text_timeOfLastAssociation\" was not injected: check your FXML file 'MemoryVisua…
type: AnsweredQuestion
tagged with: java
tagged with: javafx
type: Question
has title: JavaFx Text fields are not updating on GUI
score: 0
accepted answer: http://stackoverflow.com/a/26022904

http://stackoverflow.com/a/25973035
downvote count: 0
upvote count: 55
answers question: http://stackoverflow.com/q/25972910
type: Answer
has body: From the source: To extract only certain files from a jar file, supply their filenames: C:\Java&gt; jar xf myFile.jar foo bar Using wildcards is a shell thing, and you should not expect it to work when extracting from a JAR file (which, as you've realized, is the case). What you can do, is supply a list of the files you want to extract, via the @ modifier: jar xf my.jar @myfiles.lst where myfiles.lst would be: com/my/MyClass.java com/my/MySecondClass.java This file could easily be created automatically with creative use of jar tvf, awk and your desired extraction pattern. I'll leave that as an exercise and/or another SO question :-) Or you could use unzip - a JAR file is basically a zip-file. Cheers,
has comment: http://stackoverflow.com/comment/40668524
score: 55

http://stackoverflow.com/comment/40540089
comment on: http://stackoverflow.com/q/25901393
has text: You appear to have answered your own question: "If they wanted an animal object, why not just do this? `Animal pig0 = new Pig()`"
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25883975
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25883866
has body: Just remove the android:onClick attribute from Button from your xml layout &lt;Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/calculate" /&gt; Updated I found the issue what you doing // Loan Term processing int[] termGroup = {180, 240, 360}; int selectedTerm = loanTerm.getCheckedRadioButtonId(); int selectedTermIndex = 0; noOfLoanMonth = termGroup[selectedTerm]; Here is 3 line you getting error at last line. In termGroup[] is starting from 0 index to 1,2 now loanTerm.getCheckedRadioButtonId(); will giving you RadioButton reference ID and it may be something like 392032489 etc which is generated in R.java file. You need to get which position of RadioButton is selected like this way. switch(selectedTerm){ case R.id.radiobtn1: selectedTermIndex = 0; break; case R.id.radiobtn2: selectedTermIndex = 1; break; case R.id.radiobtn3: selectedTermIndex = 2; break; } Now use selectedTermIndex instead of selectedTerm noOfLoanMonth = termGroup[selectedTermIndex]; Hope this will be work for you
has comment: http://stackoverflow.com/comment/40508364

http-kit
tag name: http-kit
tags question: http://stackoverflow.com/q/26016141
type: Tag

http://stackoverflow.com/a/26054804
accepted answer of: http://stackoverflow.com/q/26001713
answers question: http://stackoverflow.com/q/26001713
upvote count: 4
has body: It's easy with Powermockito framework and whenNew(...) method. Example for your test as follows: @Test public void testMethod() throws Exception { DependentClass dependentClass = PowerMockito.mock(DependentClass.class); PowerMockito.whenNew(DependentClass.class).withNoArguments().thenReturn(dependentClass); Service service = new Service(); service.method(); } Hope it helps
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/40940172

http://stackoverflow.com/a/25963240
has comment: http://stackoverflow.com/comment/40684338
has comment: http://stackoverflow.com/comment/40711369
answers question: http://stackoverflow.com/q/25962311
downvote count: 0
has comment: http://stackoverflow.com/comment/40763580
type: Answer
has body: try this to finish an activity Intent intent = new Intent(); intent.putExtra(EXTRA, value); setResult(RESULT_OK, output); finish(); and this for getting the result in the previous activity @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(data.getExtras().containsKey(EXTRA)){ // do stuff with data from finished activity String bla = data.getStringExtra(EXTRA) } } EDIT: read comments! need to use startActivityForResult
score: 1
has comment: http://stackoverflow.com/comment/40781174
has comment: http://stackoverflow.com/comment/40684800
upvote count: 1
has comment: http://stackoverflow.com/comment/40711196
has comment: http://stackoverflow.com/comment/40744471

http://stackoverflow.com/comment/40752822
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25983425
score: 0
has text: `reset` works with `mark`, but you need to check `isMarkSupported` first.

http://stackoverflow.com/a/25984163
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25964864
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25964864
has body: The official documentation of Hibernate indicates to use the backtick marks for these kinds of issues. http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch05.html#mapping-quotedidentifiers There is also some previous post in stackoverflow: Hibernate: use backticks for MySQL but not for HSQL How do I put backticks in a column name called key for hibernate
type: AcceptedAnswer

http://stackoverflow.com/comment/40780757
score: 0
type: Comment
type: QuestionComment
has text: Thanks for your answer. That looked really promising, and it may have brought me closer to the solution, though it does not work yet at this moment.
comment on: http://stackoverflow.com/q/26017485

http://stackoverflow.com/q/26024717
has body: Please forgive me if my question seems pretty noobish. This is my first question over here. I am having a simple query in my mind. Java language has been implemented using C and C++. My question is In C language,the formatting behaviour of C is undefined for using different modifiers than the given datatype. int c=10; printf("%f",c); // unspecified behaviour Whereas in Java, if we use the similar concept to print the number using different format specifier, we get an IllegalFormatConversionExceptoion. Exception Detail :- Exception in thread "main" java.util.IllegalFormatConversionException: f != java.lang.Integer My question is :- Why so difference between Java and C though Java is derived from C! Please clear my doubt. I'll be thankful to you geniuses...
score: 1
tagged with: java
tagged with: format-specifiers
possible better answer: http://stackoverflow.com/a/26024964
type: Question
type: AnsweredQuestion
tagged with: format
has comment: http://stackoverflow.com/comment/40762923
has comment: http://stackoverflow.com/comment/40763775
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/40763140
has comment: http://stackoverflow.com/comment/40763033
has comment: http://stackoverflow.com/comment/40763163
upvote count: 2
answer count: 2
has title: Inconsistency in relationship between Java and C
downvote count: 1
has comment: http://stackoverflow.com/comment/40763323
accepted answer: http://stackoverflow.com/a/26024766
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/26024766
has answer: http://stackoverflow.com/a/26024964

http://stackoverflow.com/comment/40736792
has text: Force corresponding left join when sorting the hostName.
type: AnswerComment
comment on: http://stackoverflow.com/a/26009418
score: 0
type: Comment

http://stackoverflow.com/a/25950093
type: Answer
answers question: http://stackoverflow.com/q/25945344
has body: as per oracle flexible architecture we put pfile in $ORACLE_BASE/admin/database_name/pfile/ and spfile is present in $ORACLE_HOME/dbs
score: 0

http://stackoverflow.com/comment/40753203
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26019567
has text: But don't I fix this by making the new temp class and iterating over that?

http://stackoverflow.com/a/26035187
has body: The cause of the problem is the use of File api for reading HDFS files. If you create a File object with a non-existent path, the listFiles method returns null. As your input directory in HDFS (I assume), it's non-existent for the local filesystem, the NPE is comming from : in.listFiles().length Use the following to extract the number of files in HDFS directories : FileSystem fs = FileSystem.get(new Configuration()); int number_of_companies = fs.listStatus(new Path(arg[0])).length;
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26033999
accepted answer of: http://stackoverflow.com/q/26033999

http://stackoverflow.com/a/25929030
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25928950
has body: Adding getter methods is one way... public final class ReturningValues { private final String value; private final int index; public ReturningValues( String value, int index ) { this.value = value; this.index = index; } public String getString() { return value; } public String getInteger() { return index; } } Another way would be to change the visibility of the attributes to public. public final class ReturningValues { public final String value; public final int index; public ReturningValues( String value, int index ) { this.value = value; this.index = index; } }
type: Answer
answers question: http://stackoverflow.com/q/25928950
score: 1
upvote count: 1

http://stackoverflow.com/comment/40753568
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26019460
score: 0
has text: In your first example there are no Spring configuration and has nothing to do with my issue (how will the mock get injected into the context?). The wrapper does not help if context has to have a ThirdPartyService instance. In the second.. I know stubs, but not sure that will help (I want mocks to change their behaviour for the sake of the test). Also, in this example profile is obsolote, @Primary alone will do the trick if stubs are in test scope (and why wouldn't they be?).

http://stackoverflow.com/a/25973041
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25972829
score: 1
accepted answer of: http://stackoverflow.com/q/25972829
has body: (?![^)()]*\)),|\((?=,)|(?&lt;=,)\) You can try this. See demo: http://regex101.com/r/kM7rT8/2 You will have to join the last three contents of list to get the second match.
upvote count: 1
has comment: http://stackoverflow.com/comment/40669948
has comment: http://stackoverflow.com/comment/40669738
type: AcceptedAnswer

http://stackoverflow.com/comment/40611080
type: Comment
has text: A better place to ask this is the RTI Community Forum at http://community.rti.com/
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25936369

http://stackoverflow.com/q/25927782
answer count: 1
has title: Fluent Rest configuration in Camel 2.14.0
favorite count: 0
tagged with: rest
tagged with: dsl
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26111336
tagged with: java
has body: I am using the new rest component from 2.14.0 in Camel, and using the following configuration: DefaultCamelContext context = new DefaultCamelContext(); RestConfiguration rc = new RestConfiguration(); rc.setComponent("spark-rest"); rc.setPort(9091); context.setRestConfiguration(rc); In the rest-dsl page, there are references showing a way to configure rest with the fluent dsl, like: restConfiguration() .component("restlet") .host("localhost") .port(portNum) .bindingMode(RestBindingMode.auto); But I cannot seem to find where the proper placeholder to add this to. In short, the camel documentation shows a way to use the fluent DSL to configure the Camel context, but I cannot find where/how to do it.
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40595169
tagged with: apache-camel
accepted answer: http://stackoverflow.com/a/26111336
score: 0

pointers
tags question: http://stackoverflow.com/q/25921371
tags question: http://stackoverflow.com/q/25923071
type: Tag
tags question: http://stackoverflow.com/q/25892659
tag name: pointers

http://stackoverflow.com/a/26013889
answers question: http://stackoverflow.com/q/26013593
has body: int[] array = new int[256]; String str = "sdfdagfvdsgfrewfwqafasfdfa"; for (int i = 0; i &lt; str.length(); i++) { array[str.charAt(i)]++; } for (int i = 'a'; i &lt;= 'z'; i++) { if (array[i] &gt; 0) { System.out.println((char) i + ":" + array[i]); } }
score: 0
type: Answer

http://stackoverflow.com/comment/40734593
score: 0
type: AnswerComment
type: Comment
has text: To the best of my knowledge, amqmdnet.dll doesn't work without the MQ client installed. If you know a way to make it work, please let me know. I don't care if it is unsupported.
comment on: http://stackoverflow.com/a/26001593

http://stackoverflow.com/comment/40710428
has text: Have you already seen [this](http://stackoverflow.com/a/19731784/3364187) answer?
comment on: http://stackoverflow.com/q/25995706
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40731012
score: 0
type: AnswerComment
has text: Thanks for the tutorial
type: Comment
comment on: http://stackoverflow.com/a/26005725

http://stackoverflow.com/a/25940072
has body: you can make two separate method for start and end like below - public void start() { System.out.println("Start"); OtherExample.start(); } public void end() { OtherExample.end(); System.out.println("End"); } than call in your method call - public void f(){ start(); AnotherExample.funct1(); //DIFFERENT CODE LINE end(); } same call with other methods too.
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25939699
upvote count: 1

http://stackoverflow.com/comment/40641945
score: 0
has text: I want the complete thread dump of the program.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25950279

http://stackoverflow.com/comment/40678179
has text: erad Yes my manifest include that permission. @blackbelt and RichieHH this is what the stacktrace print: GC_FOR_ALLOC freed some Kb of memory and it returns how much ms after going in pause. What does it mean?
score: 0
comment on: http://stackoverflow.com/q/25978061
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40698325
comment on: http://stackoverflow.com/q/25980314
score: 0
has text: @Little Child: You hit the point! Awww... I can't believe I spent ours searching. This solution is really the egg of Columbus!
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40493669
has text: @GuyFlavell ok... don't really understand you guys, especially the approval of the second answer that is pretty much equivalent to mine :) as far as creating the new `Random` each time, I realize that is not efficient
type: AnswerComment
comment on: http://stackoverflow.com/a/25875745
type: Comment
score: 0

http://stackoverflow.com/comment/46126368
type: Comment
score: 0
type: AnswerComment
has text: How did you update your okhttp usage in 1.3.0 ? What are you using when you can't access Request or Response classes ?
comment on: http://stackoverflow.com/a/25980566

http://stackoverflow.com/q/26003470
upvote count: 0
tagged with: salesforce
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26005496
has body: I had geocoded around 40k address three months ago using google geocode api. http://maps.googleapis.com/maps/api/geocode/json Due to limitation on the number of requests per day I had processed 2500 records every day. Out of 40k records 10k records were processed with location type APPROXIMATE. But today if I process the same 10k records again the location type is changed to ROOFTOP with a different lat and long. There were no changes in the records which had ‘ROOFTOP’ and RANGE_INTERPOLATED I.e. If I process any ROOFTOP record now – There is no change in lat, long and location type. Couldn't understand why there is change in APPROXIMATE location type records. Please guide me. Thanks, Indy
tagged with: java
downvote count: 2
type: Question
has title: Google GeoCode Co-ordinate vary over a period of time
has answer: http://stackoverflow.com/a/26005495
tagged with: google-maps
score: -2
tagged with: google-maps-api-3
answer count: 2

http://stackoverflow.com/comment/40547558
comment on: http://stackoverflow.com/q/25905699
has text: also [this](http://stackoverflow.com/questions/15315368/java-reflection-get-all-private-fields) one
score: 0
type: Comment
type: QuestionComment

gridbaglayout
tags question: http://stackoverflow.com/q/25882715
tags question: http://stackoverflow.com/q/25942348
type: Tag
tag name: gridbaglayout
tags question: http://stackoverflow.com/q/25894638
tags question: http://stackoverflow.com/q/25957796

http://stackoverflow.com/comment/40732886
has text: @ChrisHayes Yes, thanks. That's what I ment.
comment on: http://stackoverflow.com/q/26008173
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40739890
comment on: http://stackoverflow.com/q/26012224
type: Comment
has text: http://en.wikipedia.org/wiki/Point_in_polygon ; https://github.com/maxogden/geojson-js-utils; EDIT: even better, https://github.com/isterin/geo-utils (works on lat/lon)
type: QuestionComment
score: 0

http://stackoverflow.com/q/25917885
tagged with: java
tagged with: log4j2
type: Question
has body: I was using log4j2 and it was logging statements for me with no issues. I might have made some changes (moved from info to debug and back) but its quite possibly I might have messed up the config in some other fashion. I am copying my config file below (I have not moved any log4j2 and slf4j jar files from my project). Any thoughts? <?xml version="1.0" encoding="UTF-8"?> <RollingRandomAccessFile name="RollingRandomAccessFile" fileName="logs/test.log" immediateFlush="false" append="false" filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz"> %d %p %c{1.} [%t] %m %ex%n <TimeBasedTriggeringPolicy /> <SizeBasedTriggeringPolicy size="500 MB"/> </RollingRandomAccessFile> <AppenderRef ref="RollingRandomAccessFile"/> <AppenderRef ref="RollingRandomAccessFile"/>
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has title: issue with my log4j2 setup
downvote count: 0
has answer: http://stackoverflow.com/a/25918268
accepted answer: http://stackoverflow.com/a/25918268
score: 1

http://stackoverflow.com/comment/40602425
score: 0
type: Comment
type: QuestionComment
has text: have u checked any permission related issues? if server is linux?
comment on: http://stackoverflow.com/q/25935711

http://stackoverflow.com/a/69909366
answers question: http://stackoverflow.com/q/26015943
score: 0
type: Answer
has body: Please try this to edit or replace the word in document public class UpdateDocument { public static void main(String[] args) throws IOException { UpdateDocument obj = new UpdateDocument(); obj.updateDocument( "c:\\test\\template.docx", "c:\\test\\output.docx", "Piyush"); } private void updateDocument(String input, String output, String name) throws IOException { try (XWPFDocument doc = new XWPFDocument( Files.newInputStream(Paths.get(input))) ) { List<XWPFParagraph> xwpfParagraphList = doc.getParagraphs(); //Iterate over paragraph list and check for the replaceable text in each paragraph for (XWPFParagraph xwpfParagraph : xwpfParagraphList) { for (XWPFRun xwpfRun : xwpfParagraph.getRuns()) { String docText = xwpfRun.getText(0); //replacement and setting position docText = docText.replace("${name}", name); xwpfRun.setText(docText, 0); } } // save the docs try (FileOutputStream out = new FileOutputStream(output)) { doc.write(out); } } } }

http://stackoverflow.com/comment/40553715
has text: Java or whatever client you are using. I'm not sure ES does have this option, because you need just the words out of a field that can be an entire phrase or sentence. ES will match the field and will show you (with highlighting) which words (tokens) from that field matched. I don't think it can take out only the tokens that matched and, even more, getting a distinct out of them.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25906975

http://stackoverflow.com/q/25892107
possible better answer: http://stackoverflow.com/a/25892193
has answer: http://stackoverflow.com/a/25892193
answer count: 7
has answer: http://stackoverflow.com/a/25892262
tagged with: initialization
has answer: http://stackoverflow.com/a/25892223
tagged with: constructor
has answer: http://stackoverflow.com/a/25892160
has answer: http://stackoverflow.com/a/25892162
type: AnsweredQuestion
has title: why the class contructor never called?
tagged with: java
type: Question
has body: I'm confused with following code, package test; public class Test { FooC fooC = new FooC(); public static void main(String[] args) { System.out.println("started"); Test t = new Test(); } public class FooA { public int[] mData; public FooA() { System.out.println("aa"); mData = new int[32]; } } public class FooB { public FooA[] mFooA; public FooB() { System.out.println("bb"); mFooA = new FooA[12]; } } public class FooC { public FooB mFooB; public FooC() { System.out.println("cc"); mFooB = new FooB(); } } } when running, the output is: started cc bb why the FooA constructor never called? I'm a little new to java, any help means a lot, thanks!
accepted answer: http://stackoverflow.com/a/25892162
has answer: http://stackoverflow.com/a/25892129
has answer: http://stackoverflow.com/a/25892933
score: 0

http://stackoverflow.com/a/25905986
answers question: http://stackoverflow.com/q/25905662
type: Answer
has body: Append this to your while loop while(choice!=2 &amp;&amp; loop != 4) OR Change if (loop == 3) to if (loop == 4)
score: 0

http://stackoverflow.com/comment/40596598
has text: yes juneyoung may be point was to point out this only ..that it cannot be done
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25908751
score: 0

http://stackoverflow.com/comment/40566575
has text: I just fixed a caching problem in my app. I am pretty sure you have the same issue. Review the JPA caching - helps a lot.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25915321

http://stackoverflow.com/comment/40790261
has text: @MarkRotteveel In my answer I said if getConnection is not done properly it is going to return null because most likely of a connection error, it looks like his string is not appropriate as the parameter is not done right, but it also could be he doesn't have a jar file, it is pretty much like the link you provided to him
comment on: http://stackoverflow.com/a/26025175
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25880127
type: Question
has body: I would like to create a toggle button that when pressed has about a 1 second delay and toggles off. Any help would be appreciated. public void onToggleClicked(View view) { // Is the toggle on? boolean on = ((ToggleButton) view).isChecked(); if (on) { // Relay On } else { // Relay Off } }
has answer: http://stackoverflow.com/a/25880437
score: 0
answer count: 1
tagged with: button
type: UnansweredQuestion
tagged with: android
has title: Android Toggle Button with timed delay off
tagged with: java

http://stackoverflow.com/q/26028051
accepted answer: http://stackoverflow.com/a/26065360
answer count: 1
has comment: http://stackoverflow.com/comment/40769929
has comment: http://stackoverflow.com/comment/40769908
score: 0
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/40769950
has title: Trying to send an array to a method that would split each element using String.split()
has body: I have created an array that takes each line of a txt file and stores it in each index. Now, I need to split each of them using String.split(). I have a method that would correctly do the split operation, but I need to create a method that will store each element of my array in a string to pass it through to that method. The fact that each element of the array is being stored from an external txt file makes it even trickier. Any suggestions as to how to do this? Here is all of my code: //store each line into an array import java.io.*; import java.util.*; public class InfixToPostfix { private ObjectStack operator; public InfixToPostfix() { operator = new ObjectStack(); } /** * method takes each expression from infix.txt and stores them in a string array * @param none * @return none */ public String getInfix() { //declare new filestream FileInputStream in = null; try { in = new FileInputStream("infix.txt"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } //declare a reader BufferedReader br = new BufferedReader(new InputStreamReader(in)); //declare string array to store elements in String[] list = new String[10]; try { do { for (int i = 0; i &lt; list.length; i++){ try { list[i] = br.readLine(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } while (br.readLine() != null); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { in.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return (Arrays.toString(list)); } //and the method that would perform the split public static void parseArray(String entries) { String delims = "[ ]+"; String[] tokens = entries.split(delims); } here is the txt file: 8 + 4 * 2 - 6 7 * 2 - 4 * 3 + 2 * 5 2 * 3 * 4 - 8 + 9 / 3 / 3 5 + 7 * 4 - 6 4 * ( 3 + 2 * 4 ) - 7 ( 5 + 7 ) / ( 9 - 5 ) 3 * ( 5 * ( 5 - 2 ) ) - 9 ( ( 5 * ( 4 + 2 ) - ( 8 + 8 ) / 2 ) - 9 ) ^ 3 ( ( 5 + 5 * ( 6 - 2 ) + 4…
tagged with: split
tagged with: arrays
has comment: http://stackoverflow.com/comment/40769374
has comment: http://stackoverflow.com/comment/40769835
tagged with: string
has comment: http://stackoverflow.com/comment/40769451
has comment: http://stackoverflow.com/comment/40770082
has comment: http://stackoverflow.com/comment/40769376
has answer: http://stackoverflow.com/a/26065360
has comment: http://stackoverflow.com/comment/40770032
has comment: http://stackoverflow.com/comment/40769534
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40769476
has comment: http://stackoverflow.com/comment/40770024
favorite count: 0
has comment: http://stackoverflow.com/comment/40769516
has comment: http://stackoverflow.com/comment/40769882
has comment: http://stackoverflow.com/comment/40769959
has comment: http://stackoverflow.com/comment/40769598
has comment: http://stackoverflow.com/comment/40769867
has comment: http://stackoverflow.com/comment/40769429
upvote count: 1

http://stackoverflow.com/q/25983802
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
answer count: 0
tagged with: java
has body: I've tested the connection in google chrome browser, its connecting and disconnecting ok, but why firefox is not closing the connection after it is closed? I've tried to add this part of code: $(window).on('beforeunload', function(){ ws.close(); }); but it didn't helped, are there any other hacks to solve this? also I've tried in the server side to put this: byte d = bytes[0]; //first byte if(d == 0x8) { System.out.println("DISCONNECT"); } but not helped, any other hacks?
type: Question
score: 3
tagged with: javascript
upvote count: 3
tagged with: websocket
tagged with: jquery
has title: Firefox Websocket connection not closing after the tab or browser is closed
favorite count: 0

http://stackoverflow.com/q/26003339
has comment: http://stackoverflow.com/comment/40723882
has title: Java - Use Users input in code
tagged with: input
favorite count: 0
upvote count: 0
duplicate of: http://stackoverflow.com/q/5287538
type: UnansweredQuestion
downvote count: 8
score: -8
has body: I am trying to build a program that talks to the user and I want it to know as much as possible. For that I need an ability to use what the user types in my programs code and not just in variables in a way that it is fully implemanted in to the code Or if there is now way, you know of just Tell me and I will accept it.
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5287538
has answer: http://stackoverflow.com/a/26003411
answer count: 1

http://stackoverflow.com/a/25925254
downvote count: 0
has body: The problem with your code is that the method onClickListener() is executed by an external thread, which is different from the thread you created (the one actually holding the lock on mSync). So when it gets to notify() it complains about not having the lock. You can accomplish the same with a Semaphore initialized with 0. Your code would look something like this: class LoopTask implements Runnable { private Semaphore s = new Semaphore(0); @Override public void run() { mLeftText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { doSomething(); s.release(); } }); for (int i = 0; i &lt; 10; i++) { try { s.acquire(); } catch (InterruptedException ex) { ex.printStackTrace(); } } } } There is a difference among semaphores and notify/wait, though: when you call notify() and there is no thread blocked on wait(), that call is lost, it doesn't accumulate so the next call to wait() doesn't block. With semaphores, if you call release() once, then the next call to acquire() will not block. I hope this helps.
score: 1
has comment: http://stackoverflow.com/comment/40584737
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40590568
answers question: http://stackoverflow.com/q/25925041

http://stackoverflow.com/a/34391318
answers question: http://stackoverflow.com/q/25945613
score: 0
type: Answer
has body: FragmentManager fm=getFragmentManager(); fm.beginTransaction().replace(R.layout.fragment_blue, (Fragment)new FragmentGreen()).commit(); getActivity().getActionBar().setTitle("Home");

http://stackoverflow.com/comment/40613447
type: AnswerComment
has text: Don't think this will work--the argument of `flatMap` has to be a function that turns a `List<String>` into a `Stream<String>`. See the [javadoc](http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#flatMap-java.util.function.Function-).
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25941558

http://stackoverflow.com/comment/40585191
has text: Ahh ok. I thought using this conversion was giving correct results only when sorting. Many thanks, I can see the light now ;)
comment on: http://stackoverflow.com/a/25926085
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40530187
type: AnswerComment
comment on: http://stackoverflow.com/a/25894818
score: 0
type: Comment
has text: Thank you. Problem solved. By the way, what I'm trying to do is just retrieve the records that are on jrs1 and jrs2. I hope this is the right way to go.

http://stackoverflow.com/comment/105976311
type: AnswerComment
comment on: http://stackoverflow.com/a/25912472
has text: Effective January 15, 2020, The Central Repository no longer supports insecure communication over plain HTTP and requires that all requests to the repository are encrypted over HTTPS.
type: Comment
score: 14

http://stackoverflow.com/a/25950124
score: 1
has comment: http://stackoverflow.com/comment/40626945
has comment: http://stackoverflow.com/comment/40627032
upvote count: 1
answers question: http://stackoverflow.com/q/25950075
has body: There is a fairly substantial bug in your code, this if(((Birth)list.get(i)).compareTo(((Birth)list.get(i + 1)))&gt;0); { Birth birth = (Birth)list.get(i); list.set( i, (Birth)list.get( i + 1)); list.set(i + 1, birth); } Does not work, because your if body is a single semi-colon. Then you have an anonymous block. Change it to, if(((Birth)list.get(i)).compareTo(((Birth)list.get(k)))&gt;0) // &lt;-- no semicolon { Birth birth = (Birth)list.get(i); list.set( i, (Birth)list.get(k)); list.set(k, birth); } Next, k starts at 1 so that i can start at 0 (it's a nested loop for a sort). Next, the size of the List is what controls the range of k. Next the instructions in your if body are to swap the element at i and the element at k if the element at i is greater then the element at k. Finally, this for(int i = 0; i &lt; list.size() - k; i++) { Should probably be for(int i = 0; i &lt; list.size(); i++) { if (i == k) continue;
type: Answer
downvote count: 0

http://stackoverflow.com/q/25909511
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25909786
accepted answer: http://stackoverflow.com/a/25909786
has body: i'm developing an system application for android. I found a problem during the application update. I installed V1.0 but when install the new version(V1.1) it replace the old one without errors,but if the phone is rebooted or powered off the application came back to 1.0 Do you have any suggestion to fix this issue?
has title: Android override application after reboot
score: 0
answer count: 1
tagged with: android
tagged with: apk
type: AnsweredQuestion

http://stackoverflow.com/q/25979664
has comment: http://stackoverflow.com/comment/40680949
favorite count: 0
tagged with: equals
has body: I ran into this problem. This is my code: String answer; System.out.println("Choose a day"); answer = tastatur.nextLine(); if(svar.equals("saturday")) System.out.println("Saturday"); I want to use the answer in the if statement.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40681068
has comment: http://stackoverflow.com/comment/40680993
has comment: http://stackoverflow.com/comment/40680960
has comment: http://stackoverflow.com/comment/40680744
has comment: http://stackoverflow.com/comment/40681026
has comment: http://stackoverflow.com/comment/40680905
has comment: http://stackoverflow.com/comment/40681153
has comment: http://stackoverflow.com/comment/40681090
has comment: http://stackoverflow.com/comment/40680772
has comment: http://stackoverflow.com/comment/40681687
has comment: http://stackoverflow.com/comment/40680750
has comment: http://stackoverflow.com/comment/40680975
tagged with: java
has comment: http://stackoverflow.com/comment/40681004
has comment: http://stackoverflow.com/comment/40680840
downvote count: 7
has comment: http://stackoverflow.com/comment/40680943
type: Question
has comment: http://stackoverflow.com/comment/40680935
has comment: http://stackoverflow.com/comment/40681113
has answer: http://stackoverflow.com/a/25979733
has title: Using answer in if
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40681091
has comment: http://stackoverflow.com/comment/40680864
has comment: http://stackoverflow.com/comment/40680953
has comment: http://stackoverflow.com/comment/40680994
has comment: http://stackoverflow.com/comment/40681145
has comment: http://stackoverflow.com/comment/40681228
has comment: http://stackoverflow.com/comment/40680971
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40681047
score: -7
tagged with: string

http://stackoverflow.com/q/26024742
has comment: http://stackoverflow.com/comment/40778109
score: 3
tagged with: spring-boot
answer count: 0
tagged with: cxf
has comment: http://stackoverflow.com/comment/40800246
upvote count: 3
tagged with: java
type: Question
has body: I have a stand alone app running with Spring Boot. It registers a CXF servlet for Soap endpoints at the root of the app (/). I have also added CXF jaxrs programatically via @Configuration @EnableAutoConfiguration @ComponentScan public class Application { /** * register cxf SOAP web services with spring boot * @return */ @Bean public ServletRegistrationBean servletRegistrationBean() { return new ServletRegistrationBean(new CXFServlet(), "/*"); } public static void main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class, args); // register cxf SOAP REST services with spring boot JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean(); factory.setProviders(Arrays.asList(new JacksonJsonProvider())); factory.setResourceClasses(ConfigureSoapResponseServiceImpl.class); factory.setAddress("/rest"); factory.create(); } } So far this works for registering all my jaxws and jaxrs services. However I'm not able to inject a service class into a rest endpoint. I assume this is because I'm setting it up programmatically with the JAXRSServerFactoryBean. @Consumes("application/json") @Produces("application/json") @Path("/config") public interface ConfigureSoapResponseService { @GET @Path("/") public List<String> getAllOperations(@QueryParam("wsdlLocation") String wsdlLocation); } @Service public class ConfigureSoapResponseServiceImpl implements ConfigureSoapResponseService { @Autowired public WsdlInspectionService wsdlInspectionService; @Override public List<String> getAllOperations(String wsdlLocation) { return wsdlInspectionService.getWsdlOperations(wsdlLocation); } @PostConstruct public void init() { SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); } } @Component("wsdlInspectionService") public class WsdlInspectionServiceImpl implements WsdlInspectionService { public List<String> getWsdlOperations(String wsdlLocation) { // ... } } I tried using the @PostConstruct annotation in the above code and by adding <bean class="or…
has title: Not able to inject spring service class when using spring boot and JAXRSServerFactoryBean
downvote count: 0
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/40791448
favorite count: 0
linked to: http://stackoverflow.com/q/24002089
has comment: http://stackoverflow.com/comment/40800387
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40788635
tagged with: spring

http://stackoverflow.com/comment/40761102
score: 0
type: AnswerComment
type: Comment
has text: I'm not sure, but I'm afraid that you missed the point with *"If you remove the entry from the cache and then..."* as the removal happens automatically. I don't know if a Guava cache calls the `RemovalListener` immediately. Anyway, your last solution seems to cover everything.
comment on: http://stackoverflow.com/a/26011908

http://stackoverflow.com/a/35064636
score: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25988851
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25988851
has body: One of the issue, I found with error com.sun.jersey.api.core.ScanningResourceConfig init INFO: No provider classes found. is using Lambda expressions(Java 8) in Rest service class. Jersey fails to scan the annotations, if Lambdas are used in the package specified in web.xml file below: com.sun.jersey.config.property.packages com.duo.test Solution for this problem is to remove Lambda in any class in the package specified. NOTE: This may be only a problem with Jersey 1.x, I have not tried using Jersey 2.x yet. Removing Lambda has helped me work around the issue temporarily.
type: Answer
upvote count: 3

http://stackoverflow.com/comment/40811246
score: 0
has text: @jpw Are you sure it could be a error with the input ?
comment on: http://stackoverflow.com/q/25884842
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40517804
has text: That depends. What do you want the code to do? And why did you write the if/else statement this way?
type: AnswerComment
comment on: http://stackoverflow.com/a/25889376
score: 0
type: Comment

calendar
tags question: http://stackoverflow.com/q/25997498
tags question: http://stackoverflow.com/q/25917641
tags question: http://stackoverflow.com/q/25980330
tags question: http://stackoverflow.com/q/25954218
tags question: http://stackoverflow.com/q/25890072
tags question: http://stackoverflow.com/q/25933444
tags question: http://stackoverflow.com/q/25900542
tags question: http://stackoverflow.com/q/25963720
tag name: calendar
tags question: http://stackoverflow.com/q/25956457
tags question: http://stackoverflow.com/q/25951985
type: Tag

http://stackoverflow.com/q/25891361
has body: I have an Android application that communicates with another java application. For the data encryption i use the javax.crypto library to encrypt and decrypt the data with a pre-shared key. According to this question it's possible to get the source code from an APK file. So if somebody is able to read the source code of my application, he's also able to read/manipulate the encrypted data. It's probably true, so is there a way to prevent this (additional measures, other security method)? Don't know if it have extra value but here is my encryption code: private static String IV = "AAAAAAAAAAAAAAAA"; private static String ENCRYPTION_KEY = "0123456789abcdef"; Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); SecretKeySpec key = new SecretKeySpec(ENCRYPTION_KEY.getBytes("UTF-8"), "AES"); cipher.init(Cipher.ENCRYPT_MODE, key,new IvParameterSpec(IV.getBytes("UTF-8"))); return cipher.doFinal(input.getBytes("UTF-8")); EDIT: Communication is send and recieving by NFC. My main issue is, if someone has the key he's able to read and write (abused) information to the other side (the NFC reader)
has title: Is a pre-shared key safe between Android and another java application?
score: 2
has comment: http://stackoverflow.com/comment/40521878
type: AnsweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/40522234
type: Question
accepted answer: http://stackoverflow.com/a/25910824
has comment: http://stackoverflow.com/comment/40523210
tagged with: java
has comment: http://stackoverflow.com/comment/40522381
has answer: http://stackoverflow.com/a/25910824
upvote count: 2
linked to: http://stackoverflow.com/q/3593420
has comment: http://stackoverflow.com/comment/40524937
has comment: http://stackoverflow.com/comment/40521987
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40523326
favorite count: 0
tagged with: nfc
has comment: http://stackoverflow.com/comment/40522951
has comment: http://stackoverflow.com/comment/40523580
tagged with: android

http://stackoverflow.com/comment/40542135
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25902487
has text: so we have already knew that you want to do this, but you said you have some diffuclty for your delimiters ? what is issue regarding to that? how many file are they? please explain more so we can help you :)
score: 0

http://stackoverflow.com/comment/40688701
has text: Short answer: NEVER.
score: 7
comment on: http://stackoverflow.com/q/25983848
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40693057
has text: completely agree should be working fine this
comment on: http://stackoverflow.com/q/25985956
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26022037
linked to: http://stackoverflow.com/q/3069382
tagged with: timeout
has answer: http://stackoverflow.com/a/26022354
answer count: 1
downvote count: 0
tagged with: connection
favorite count: 0
tagged with: apache-httpclient-4.x
tagged with: sockets
has body: The Apache HttpClient framework allows you to specify a connection timeout and a socket timeout, like so: final HttpParams httpParams = new BasicHttpParams(); if (connectionTimeout &gt; 0) { HttpConnectionParams.setConnectionTimeout(httpParams, connectionTimeout); } if (socketTimeout &gt; 0) { HttpConnectionParams.setSoTimeout(httpParams, socketTimeout); } HttpClient client = new DefaultHttpClient(httpParams); I would like to fine-tune my connection timeouts. This question explains the difference between the settings nicely, but provides no help for debugging the exceptions that get thrown. My question is, what exception gets thrown for each type of timeout? I have a java.net.SocketTimeoutException; is this from a connection timeout or a socket timeout? I suspect it's the latter, especially since the message says "Read timed out". What exception will be thrown for a connection timeout? TimeoutException? ConnectException? Why aren't the relationships between timeout settings and exceptions thrown captured in the Apache Http Docs? The direct parent classes for SocketTimeoutException are InterruptedIoException and IOException; the former has only the SocketTimeoutException for a subclass, but the IOException has many subclasses. Is there another reference that covers what all flavors of exceptions one can expect to receive from an HttpClient execute method? It only declares that it can throw an IOException, which is really very broad.
accepted answer: http://stackoverflow.com/a/26022354
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: Is there any way to distinguish a connection timeout from a socket timeout?
type: Question

http://stackoverflow.com/comment/40774072
type: Comment
has text: well i'm glad i could provide help, but maybe you *might* consider *sometimes* to have a look at those hints from @MadProgrammer - thats really worth considering ^^ but for me i'm happy i could help you out a litte and wish you good luck on your project!!!
comment on: http://stackoverflow.com/a/25967850
type: AnswerComment
score: 0

http://stackoverflow.com/q/25924871
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25924967
tagged with: java
accepted answer: http://stackoverflow.com/a/25924910
has title: Condensing basic code using || operator with a string
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/40583057
favorite count: 0
answer count: 3
linked to: http://stackoverflow.com/q/338206
score: 3
has comment: http://stackoverflow.com/comment/40583320
has answer: http://stackoverflow.com/a/25924910
has body: I'm quite new to java programming. I was unable to find any information relating to the use of the || operator with strings. I was wondering if there was a more efficient way to do this code in particular that was still easily readable. I tried making a simple calculator as a way to familiarize myself with IfThenElse statements. import java.util.Scanner; public class SimpleCalculator { public static void main(String[] args){ Scanner input=new Scanner(System.in); double first; double second; String option; while(true){ System.out.println("What function would you like to calculate?"); option=input.next(); if(option.equals("add") || option.equals("+")){ System.out.println("First number"); first=input.nextDouble(); System.out.println("Second number"); second=input.nextDouble(); double add=first+second; System.out.println(add); } else if(option.equals("subtract") || option.equals("-")) { System.out.println("First number"); first=input.nextDouble(); System.out.println("Second number"); second=input.nextDouble(); double subtract=first-second; System.out.println(subtract); } else if(option.equals("multiply") ||option.equals("*")) { System.out.println("First number"); first=input.nextDouble(); System.out.println("Second number"); second=input.nextDouble(); double multiply=first*second; System.out.println(multiply); } else if(option.equals("divide") || option.equals("/")) { System.out.println("First number"); first=input.nextDouble(); System.out.println("Second number"); second=input.nextDouble(); double divide=first/second; System.out.println(divide); } else if(option.equals("end")){ System.exit(0); } } } } For the most part I am wondering about the if requirements, which I have tested and they do work, but it seems a bit clunky to me. However, any critique would be greatly appreciated.
has answer: http://stackoverflow.com/a/25925380
upvote count: 3
has answer: http://stackoverflow.com/a/25924967

http://stackoverflow.com/q/25932857
has comment: http://stackoverflow.com/comment/40598362
tagged with: package-design
tagged with: package
has title: Can we apply the REP, CRP, CCP, etc. principles to Java packages as well as to JARs?
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/40602314
tagged with: java
type: Question
has body: Uncle Bob's Principles of OOD (http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod) describes: The five principles of class design The six principles of package design (The Release Reuse Equivalency Principle, The Common Closure Principle, etc.) The article states that: In this context a package is a binary deliverable like a .jar file, or a dll as opposed to a namespace like a Java package or a C++ namespace. Does it mean that the 6 "package principles" are not applicable to Java packages (which are defined with the keyword package) at all? Does that mean it would be a mistake to apply them in this manner? If so, could you point out to where such namespace-package principles can be found?
answer count: 1
has answer: http://stackoverflow.com/a/35424763
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40575267
type: AnswerComment
comment on: http://stackoverflow.com/a/25920018
type: Comment
has text: check this [link](http://stackoverflow.com/questions/12524322/what-if-main-method-is-inside-non-public-class-of-java-file)
score: 0

http://stackoverflow.com/q/25934793
tagged with: digital-signature
type: Question
tagged with: java
score: 0
tagged with: digital-certificate
answer count: 1
has answer: http://stackoverflow.com/a/25950687
tagged with: security
type: UnansweredQuestion
has title: How to renew security certificates in java control panel in java 6
has body: When I'm looking on the java control panel, the security certificate has been expired. Os is Windows server 2008. I'm getting the 'signjar certificate has expired' warning during the java application installation. Is this warning is related to the security certificate expiry? How can I renew this security certificate?

http://stackoverflow.com/comment/40692902
type: QuestionComment
comment on: http://stackoverflow.com/q/25986060
has text: I'll emulate it again and observe LogCat.
score: 0
type: Comment

http://stackoverflow.com/comment/40700993
score: 0
type: Comment
type: QuestionComment
has text: to posted question and with code maybe search for Mutable/AbstractComboBoxModel .
comment on: http://stackoverflow.com/q/25990632

http://stackoverflow.com/a/25880565
has comment: http://stackoverflow.com/comment/40503206
has comment: http://stackoverflow.com/comment/40503122
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25880084
answers question: http://stackoverflow.com/q/25880084
type: Answer
has comment: http://stackoverflow.com/comment/40503841
has comment: http://stackoverflow.com/comment/40503335
downvote count: 0
has body: Your pseudocode looks more like local search than recursion/backtracking. The logical return would be void, since local search cannot prove the absence of a solution, so failure is indicated by running forever. (The coloring itself, if found, is returned via the global variables.) Recursion/backtracking would be more like this. boolean extend-coloring(partial-coloring): if every vertex has a color, then return true let v be a vertex without a color for each color c, if v has no neighbors of color c, apply color c to v in partial-coloring if extend-coloring(partial-coloring), then return true remove color c from v return false The root invocation is extend-coloring(empty-coloring), where empty-coloring assigns no vertex a color. The return value indicates whether the attempt to extend the partial coloring succeeded.
score: 1
has comment: http://stackoverflow.com/comment/40504890

http://stackoverflow.com/comment/40673446
type: QuestionComment
has text: You can use a Set, look here: http://stackoverflow.com/questions/14887976/sortable-java-collection-without-duplicates
score: 2
comment on: http://stackoverflow.com/q/25975669
type: Comment

http://stackoverflow.com/tag/xls
tags question: http://stackoverflow.com/q/25927652
type: Tag
tag name: xls
tags question: http://stackoverflow.com/q/25913974

http://stackoverflow.com/comment/40671056
comment on: http://stackoverflow.com/a/25973451
type: Comment
has text: yes. StackOverflow scrubbed the problem characters away. An Outlook Email also seemed to work for me.#
score: 0
type: AnswerComment

http://stackoverflow.com/a/25989596
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25989541
has comment: http://stackoverflow.com/comment/40699135
has body: Looks like you want to left-pad with spaces, so perhaps you want: String.format("%3d", yourInteger); For example: int[] values = { 500, 4, 11, 234 }; for (int v : values) { System.out.println(String.format("%3d", v)); } Output: 500 4 11 234
score: 19
upvote count: 19
accepted answer of: http://stackoverflow.com/q/25989541
has comment: http://stackoverflow.com/comment/40698991
has comment: http://stackoverflow.com/comment/40698942

http://stackoverflow.com/q/25951019
has comment: http://stackoverflow.com/comment/40628050
has comment: http://stackoverflow.com/comment/40628297
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/61110347
downvote count: 0
has body: A very simple problem. I try to run a very simple demo to created and display a Window Frame from Eclipse, and nothing happens. No errors, no window, the code runs to completion. I added breakpoints and made sure the code runs as expected. The code is straight from Java tutorials (FrameDemo), I just renamed the package to fit where I placed it (other code from this package runs fine): package ui; import java.awt.*; import javax.swing.*; /* FrameDemo.java requires no other files. */ public class FrameDemo { /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("FrameDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel emptyLabel = new JLabel(""); emptyLabel.setPreferredSize(new Dimension(175, 100)); frame.getContentPane().add(emptyLabel, BorderLayout.CENTER); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } My setup (Kepler SR2): eclipse.buildId=4.3.2.M20140221-1700 java.version=1.8.0_05 java.vendor=Oracle Corporation BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US Framework arguments: -product org.eclipse.epp.package.java.product -keyring /Users/steve/.eclipse_keyring -showlocation Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.java.product -keyring /Users/steve/.eclipse_keyring -showlocation I also checked Configuration -> error logs; still nothing, no errors. I tried other similar demos, same results. Any help would be appreciated as I have been stuck on this for over a day.
has comment: http://stackoverflow.com/comment/40629170
tagged with: macos
favorite count: 0
has comment: http://stackoverflow.com/comment/40628361
type: Question
answer count: 2
tagged with: swing
upvote count: 13
has title: Java JFrame Window not appearing when run from Eclipse
has answer: http://stackoverflow.com/a/25951800
tagged with: java
tagged with: eclipse
tagged with: jfreechart
has comment: http://stackoverflow.com/comment/40629003
has comment: http://stackoverflow.com/comment/40628011
has comment: http://stackoverflow.com/comment/40628295
has answer: http://stackoverflow.com/a/61110347
score: 13
has comment: http://stackoverflow.com/comment/40629144
has comment: http://stackoverflow.com/comment/40628303
accepted answer: http://stackoverflow.com/a/25951800

http://stackoverflow.com/a/25934061
has body: LabeledPoint is of the format (double, Vectors(double[])) where first parameter is label and second is a Vector of features (only non-negative real values). But for your case it does not match. Which means you have to find a way to convert your data to real values. TFIDF seems to be one way. You might be interested to read this example for better understanding.
accepted answer of: http://stackoverflow.com/q/25908536
answers question: http://stackoverflow.com/q/25908536
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25919345
has body: Am new to hibernate. Am trying to call a oracle stored procedure through Hibernate. Can I get some steps to follow to call a procedure through Hibernate. Thanks in advance.
favorite count: 0
tagged with: oracle-database
tagged with: hibernate-mapping
has comment: http://stackoverflow.com/comment/40573274
has answer: http://stackoverflow.com/a/25919466
score: -1
linked to: http://stackoverflow.com/q/21934310
type: UnansweredQuestion
has title: Calling Oracle Stored Procedure using Hibernate?
linked to: http://stackoverflow.com/q/14335939
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/14335939
has comment: http://stackoverflow.com/comment/40573232
tagged with: java
tagged with: hibernate
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/40666630
type: QuestionComment
score: 0
has text: *grml* i didn't read your comment @MadProgrammer - would have saved me lots of work ^^ again: very precise and very correct!
comment on: http://stackoverflow.com/q/25970137
type: Comment

http://stackoverflow.com/q/25894686
type: Question
has body: I'm developing a java web application that uses spring like application container. Now while I'm was using the transaction support to spring, I noticed that the time processing of the my annotated method is doubled. Try to descibe the method in a better way: @Service public class MyServiceImpl implements MyService{ @Autowired UtilService utilService; @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void loadContracts(File fileToProcess,UtilDTO dto){ List&lt;MyObject&gt; objects = utilService.readSomethings("xxx","yyy") //I modify Them //I save or update them } } @Service public class UtilServiceImpl implements UtilService{ @PersistenceContext EntityManager entityManager; public List&lt;MyObject&gt; readSomethings(String p1,String p2){ String queryString = "from MyObject o where o.param1 = :param1 " + " and o.param2 = :param2 "; Query q = entityManager.createQuery(queryString); q.setParameter("param1", p1); q.setParameter("param2", p2); return q.getResultList(); } } For example: The method readSomething is too late while If I remove the annotation its time processing improves. Why is there this difference?
tagged with: spring-transactions
has answer: http://stackoverflow.com/a/25894793
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40528554
favorite count: 0
tagged with: spring
has title: @Transactional and Time taken for execution
has comment: http://stackoverflow.com/comment/40527667
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40557840
score: 1
has comment: http://stackoverflow.com/comment/40528680
tagged with: java
has comment: http://stackoverflow.com/comment/40527611
upvote count: 1

http://stackoverflow.com/comment/40574236
type: QuestionComment
type: Comment
has text: I am not doing a equality check on the values (test 123, testOne,456), but rather on the fields name and id
score: 0
comment on: http://stackoverflow.com/q/25919707

http://stackoverflow.com/comment/40583057
type: QuestionComment
comment on: http://stackoverflow.com/q/25924871
score: 0
has text: Seems fine to me. `"add" or "+"` seems to work for me..
type: Comment

http://stackoverflow.com/q/25940571
favorite count: 0
type: Question
answer count: 2
has body: I am trying to run a test with JUnit and Mockito against a spring REST webservice I am building. I came across a bug when trying to run the JUnit test and can't find any information on the problem. The stacktrace is listing the error line as the .andDo(print()) though I got that line directly from a spring.io tutorial http://spring.io/guides/tutorials/rest/3/ Test class code: public class TestSuite { MockMvc mockMvc; @Mock RestController controller; @Before public void setup(){ MockitoAnnotations.initMocks(this); this.mockMvc = standaloneSetup(controller) .setMessageConverters(new MappingJackson2HttpMessageConverter()).build(); } @Test public void testREST() throws Exception { when(controller.getThing(any(Integer.class))).thenReturn(TestFixture.getREST(1)); this.mockMvc.perform(get("/{number}", String.valueOf(number)) .accept(MediaType.APPLICATION_JSON)) .andDo(print()) .andExpect(status().isNotFound()); }} Stacktrace: java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStarted()Z at org.springframework.test.web.servlet.result.PrintingResultHandler.printAsyncResult(PrintingResultHandler.java:131) at org.springframework.test.web.servlet.result.PrintingResultHandler.handle(PrintingResultHandler.java:80) at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:155) at org.company.test.TestSuite.testREST(TestSuite.java:53)`
tagged with: spring
has comment: http://stackoverflow.com/comment/40612457
upvote count: 6
tagged with: spring-test
tagged with: java
has answer: http://stackoverflow.com/a/25953843
has answer: http://stackoverflow.com/a/53185889
tagged with: mockito
score: 6
possible better answer: http://stackoverflow.com/a/53185889
has title: java.lang.NoSuchMethodError: javaxservlet.http.HttpServletRequest.isAsyncStarted()Z
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25953843
tagged with: junit
downvote count: 0
linked to: http://stackoverflow.com/q/23759690

http://stackoverflow.com/q/25984671
has comment: http://stackoverflow.com/comment/40690345
accepted answer: http://stackoverflow.com/a/25984705
has answer: http://stackoverflow.com/a/25984711
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/25984711
tagged with: jpanel
score: -1
answer count: 2
tagged with: thread-sleep
upvote count: 0
tagged with: paintcomponent
has title: Why isn't my JFrame object animating as I would expect?
favorite count: 0
has body: I'm trying to animate a circle as per a Head First Java exercise. The original exercise calls for using an internal "MyDrawPanel" class within the "AnimatedBall" class, but I'm trying to do an external MyDrawPanel class. I have no errors, but there also is no animation. I'm assuming it has something to do with me passing values to the MyDrawPanel constructor that don't update when I run my for loop, but I'd like to know why this is. AnimatedBall2.java: import javax.swing.JFrame; public class AnimatedBall2 { JFrame frame = new JFrame(); int height = 300; int width = 300; int x = 70; int y = 70; public static void main(String[] args){ AnimatedBall2 gui = new AnimatedBall2(); gui.go(); } public void go(){ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); MyDrawPanel panel = new MyDrawPanel(x, y, height, width); frame.getContentPane().add(panel); frame.setSize(height,width); frame.setVisible(true); for(int i = 0; i &lt; 100; i++){ x++; y++; panel.repaint(); try{ Thread.sleep(50); } catch(Exception ex){} } } } MyDrawPanel.java: import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; public class MyDrawPanel extends JPanel{ int x; int y; int height; int width; public MyDrawPanel(int x1, int y1, int z1, int z2){ x = x1; y = y1; height = z1; width = z2; } public void paintComponent(Graphics g){ g.setColor(Color.white); g.fillRect(0, 0, height, width); g.setColor(Color.orange); g.fillOval(x, y, 100, 100); } }
tagged with: swing
has answer: http://stackoverflow.com/a/25984705
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/55181391
answers question: http://stackoverflow.com/q/25917613
score: 0
type: Answer
has body: I agree on that the framework pushes you to do something not at all elegant, and I don't dirty my fingers writting such code. So my approach is this. 1) An Interface: public interface IAnswerable { Object getAnswer(); } 2) The actor: @Override public void onReceive(Object message) throws Throwable { IAnswerable iAnswerable = (IAnswerable) message; getSender().tell(iAnswerable.getAnswer(), getSelf()); } 3) Classes that I use as messages: public class MyClass implements IAnswerable { @Override public Object getAnswer() { // Whatever you need to do here return null; } } This is a raw approach but you get the idea. It's elegant and readable, and it prevents the actor of getting to big. Hope it helps ;)

http://stackoverflow.com/q/25935952
has answer: http://stackoverflow.com/a/25961786
type: Question
tagged with: stanford-nlp
has title: stanford core NLP RNNCoreAnnotations node vector
has comment: http://stackoverflow.com/comment/40650893
accepted answer: http://stackoverflow.com/a/25961786
answer count: 1
has body: What does the: public static SimpleMatrix getNodeVector(Tree tree) of the RNNCoreAnnotations class return exactly? It is a vector of 25 decimal values, but what do they represent?
downvote count: 0
has comment: http://stackoverflow.com/comment/40603092
favorite count: 0
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java

http://stackoverflow.com/a/25943743
has body: Update: The Server constructor is how you configure the thread pool, unfortunately, you cannot configure the Server constructor from within jetty-maven-plugin. That is out of scope for the jetty-maven-plugin. The ThreadPool in Jetty 9 is now setup in the Constructor of the Server instance. Using XML, you can reconfigure it, it's even documented in the jetty.xml itself. Feel free to change it, just be aware that bound thread pools are known to cause problems if the limit is too small. Here's a handy napkin formula. Max Threads = (((number of cpu cores) * 4) * (connector count)) + (max concurrent requests) In practice, most values under 400 are going to cause you problems on even mildly busy servers. Don't take this statement as meaning 400 is a good starting point, that would be grossly improper of you, you need to test, and monitor, and keep adjusting until you find a happy value for your server. (Don't forget to test for load spikes, and what happens when your databases fail) Thinking that you need to set an upper bounds for performance is a form of premature optimization. Its true that the QueuedThreadPool that Jetty uses is unbound, but it also cleans itself up and removes threads from the pool over time, allowing the server to handle sudden loads and back off when the load subsides. If its memory or other resources you are concerned about, know that the default Jetty installation runs fine on even Android 2.3 (Gingerbread) (note: Jetty 7 w/QTP), Android 4.4 (Jetty 9), and Raspberry Pi (Jetty 7 thru 9). Lastly, how to set your accept queue size. Configure your ServerConnector (usually found in the etc/jetty-http.xml) 40 The default value is 0, and relates to the backlog parameter in the ServerSocketChannel.bind(SocketAddress,int) call at the lowest levels.
has comment: http://stackoverflow.com/comment/40686690
upvote count: 3
has comment: http://stackoverflow.com/comment/40686306
has comment: http://stackoverflow.com/comment/40685978
has comment: http://stackoverflow.com/comment/41470306
downvote count: 0
has comment: http://stackoverflow.com/comment/40686273
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25938529
answers question: http://stackoverflow.com/q/25938529
type: Answer

http://stackoverflow.com/comment/40736478
comment on: http://stackoverflow.com/q/26009229
has text: @Y.Prithvi that among other things. Preparing a full answer right now.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40624850
comment on: http://stackoverflow.com/a/25948822
type: AnswerComment
has text: Thanks I look forward for that it looks promising
score: 0
type: Comment

http://stackoverflow.com/comment/40627420
score: 0
type: AnswerComment
has text: You consider `\n` to be a line separator and this makes sense. As I'm using git which complains about missing `\n` on the last line, I stick with its definition. I tried to count lines using `/usr/bin/wc -l` and it claims that `a\nb` is a single line. ;) Yet another possibility.
type: Comment
comment on: http://stackoverflow.com/a/25944073

http://stackoverflow.com/comment/40658582
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25935907
has text: I have modified the question. Could you please check it and reply for that. Thanks in advance.

http://stackoverflow.com/comment/91103249
comment on: http://stackoverflow.com/a/51522887
has text: Any way I can apply this change to all the cursor drawables from my app?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/95782037
comment on: http://stackoverflow.com/a/25988761
type: Comment
has text: @njzk2 I like to use Integer::valueOf in such cases ;)
score: 0
type: AnswerComment

http://stackoverflow.com/q/25875160
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40492464
has title: null pointer exception from my code from the while loop
has answer: http://stackoverflow.com/a/25875320
has comment: http://stackoverflow.com/comment/40492545
has comment: http://stackoverflow.com/comment/40492447
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25875524
has body: I decleared free block like private DoublyLinkedList freeblock = new DoublyLinkedList(); and I initialize the freeblock in the constructor. freeblock.add(new DoublyLinkedList.Node(null, null, 0, initBlockSize)); inside of one of method of my class, (below is part of my method.) I get null pointer exception. I think the while loop has a problem. Can anyone help me to solve this problem? symptom: java.lang.NullPointerException at LinearMemPool.enlarge(LinearMemPool.java:220) private void enlarge(int addSize) { DoublyLinkedList.Node node = freeblock.head; while (node.next != null) { node = node.next; } }
has comment: http://stackoverflow.com/comment/40492475
has answer: http://stackoverflow.com/a/25875283
has comment: http://stackoverflow.com/comment/40495543
tagged with: nullpointerexception
answer count: 3
type: Question
has comment: http://stackoverflow.com/comment/40492405
has comment: http://stackoverflow.com/comment/40492351

http://stackoverflow.com/q/25892700
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40524890
has comment: http://stackoverflow.com/comment/41108657
accepted answer: http://stackoverflow.com/a/26096336
has comment: http://stackoverflow.com/comment/40523803
type: AnsweredQuestion
score: 7
tagged with: java
has body: It seems that whenever I update an existing document in the index (same behavior for delete / add), it can't be found with a TermQuery. Here's a short snippet: iw = new IndexWriter(directory, config); Document doc = new Document(); doc.add(new StringField("string", "a", Store.YES)); doc.add(new IntField("int", 1, Store.YES)); iw.addDocument(doc); Query query = new TermQuery(new Term("string","a")); Document[] hits = search(query); doc = hits[0]; print(doc); doc.removeField("int"); doc.add(new IntField("int", 2, Store.YES)); iw.updateDocument(new Term("string","a"), doc); hits = search(query); System.out.println(hits.length); System.out.println("_________________"); for(Document hit : search(new MatchAllDocsQuery())){ print(hit); } This produces the following console output: stored,indexed,tokenized,omitNorms,indexOptions=DOCS_ONLY&lt;string:a&gt; stored&lt;int:1&gt; ________________ 0 _________________ stored,indexed,tokenized,omitNorms,indexOptions=DOCS_ONLY&lt;string:a&gt; stored&lt;int:2&gt; ________________ It seems that after the update, the document (rather the new document) in the index and gets returned by the MatchAllDocsQuery, but can't be found by a TermQuery. Full sample code available at http://pastebin.com/sP2Vav9v Also, this only happens (second search not working) when the StringField value contains special characters (e.g. file:/F:/).
upvote count: 7
possible better answer: http://stackoverflow.com/a/26080078
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40970016
has title: Lucene can't find documents after update
has answer: http://stackoverflow.com/a/26080078
tagged with: lucene
has answer: http://stackoverflow.com/a/26096336

web-scraping
tags question: http://stackoverflow.com/q/25882767
tags question: http://stackoverflow.com/q/25913989
tag name: web-scraping
tags question: http://stackoverflow.com/q/25887770
type: Tag

http://stackoverflow.com/comment/40770717
type: QuestionComment
score: 2
has text: [Bobby Tables' mom](http://xkcd.com/327/) would like to have a word with you.
comment on: http://stackoverflow.com/q/26028839
type: Comment

http://stackoverflow.com/comment/40657253
type: QuestionComment
comment on: http://stackoverflow.com/q/25966734
score: 0
has text: I am getting Enter the length: 2 Enter the Width: 3 * * * * * * Enter the length:
type: Comment

http://stackoverflow.com/q/25975368
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/25975472
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/25975450
tagged with: grouping
has answer: http://stackoverflow.com/a/25975450
has title: How to group some objects by certain field in Java?
has comment: http://stackoverflow.com/comment/40672750
has answer: http://stackoverflow.com/a/25987454
has comment: http://stackoverflow.com/comment/40672630
has answer: http://stackoverflow.com/a/25975472
type: AnsweredQuestion
has body: I've been trying to group of facets by translated value, but what I always get is only one last object on the List (no dataset). Here is what I tried: HashMap&lt;String, List&lt;Facet&gt;&gt; map = new HashMap&lt;&gt;(); for (Facet facet : getFacets()) { map.put(facet.getTranslatedValue(), new ArrayList&lt;com.schneider.gss.model.Facet&gt;()); map.get(facet.getTranslatedValue()).add(facet); } Can you suggest anything?
tagged with: java
type: Question

gmail
type: Tag
tags question: http://stackoverflow.com/q/25900906
tags question: http://stackoverflow.com/q/25907249
tag name: gmail
tags question: http://stackoverflow.com/q/25938662

http://stackoverflow.com/a/52210808
answers question: http://stackoverflow.com/q/25889221
has body: Here is the code to calculate the CRC public class CRCITUUtil { private static int[] crcItuTable = { 0X0000, 0X1189, 0X2312, 0X329B, 0X4624, 0X57AD, 0X6536, 0X74BF, 0X8C48, 0X9DC1, 0XAF5A, 0XBED3, 0XCA6C, 0XDBE5, 0XE97E, 0XF8F7, 0X1081, 0X0108, 0X3393, 0X221A, 0X56A5, 0X472C, 0X75B7, 0X643E, 0X9CC9, 0X8D40, 0XBFDB, 0XAE52, 0XDAED, 0XCB64, 0XF9FF, 0XE876, 0X2102, 0X308B, 0X0210, 0X1399, 0X6726, 0X76AF, 0X4434, 0X55BD, 0XAD4A, 0XBCC3, 0X8E58, 0X9FD1, 0XEB6E, 0XFAE7, 0XC87C, 0XD9F5, 0X3183, 0X200A, 0X1291, 0X0318, 0X77A7, 0X662E, 0X54B5, 0X453C, 0XBDCB, 0XAC42, 0X9ED9, 0X8F50, 0XFBEF, 0XEA66, 0XD8FD, 0XC974, 0X4204, 0X538D, 0X6116, 0X709F, 0X0420, 0X15A9, 0X2732, 0X36BB, 0XCE4C, 0XDFC5, 0XED5E, 0XFCD7, 0X8868, 0X99E1, 0XAB7A, 0XBAF3, 0X5285, 0X430C, 0X7197, 0X601E, 0X14A1, 0X0528, 0X37B3, 0X263A, 0XDECD, 0XCF44, 0XFDDF, 0XEC56, 0X98E9, 0X8960, 0XBBFB, 0XAA72, 0X6306, 0X728F, 0X4014, 0X519D, 0X2522, 0X34AB, 0X0630, 0X17B9, 0XEF4E, 0XFEC7, 0XCC5C, 0XDDD5, 0XA96A, 0XB8E3, 0X8A78, 0X9BF1, 0X7387, 0X620E, 0X5095, 0X411C, 0X35A3, 0X242A, 0X16B1, 0X0738, 0XFFCF, 0XEE46, 0XDCDD, 0XCD54, 0XB9EB, 0XA862, 0X9AF9, 0X8B70, 0X8408, 0X9581, 0XA71A, 0XB693, 0XC22C, 0XD3A5, 0XE13E, 0XF0B7, 0X0840, 0X19C9, 0X2B52, 0X3ADB, 0X4E64, 0X5FED, 0X6D76, 0X7CFF, 0X9489, 0X8500, 0XB79B, 0XA612, 0XD2AD, 0XC324, 0XF1BF, 0XE036, 0X18C1, 0X0948, 0X3BD3, 0X2A5A, 0X5EE5, 0X4F6C, 0X7DF7, 0X6C7E, 0XA50A, 0XB483, 0X8618, 0X9791, 0XE32E, 0XF2A7, 0XC03C, 0XD1B5, 0X2942, 0X38CB, 0X0A50, 0X1BD9, 0X6F66, 0X7EEF, 0X4C74, 0X5DFD, 0XB58B, 0XA402, 0X9699, 0X8710, 0XF3AF, 0XE226, 0XD0BD, 0XC134, 0X39C3, 0X284A, 0X1AD1, 0X0B58, 0X7FE7, 0X6E6E, 0X5CF5, 0X4D7C, 0XC60C, 0XD785, 0XE51E, 0XF497, 0X8028, 0X91A1, 0XA33A, 0XB2B3, 0X4A44, 0X5BCD, 0X6956, 0X78DF, 0X0C60, 0X1DE9, 0X2F72, 0X3EFB, 0XD68D, 0XC704, 0XF59F, 0XE416, 0X90A9, 0X8120, 0XB3BB, 0XA232, 0X5AC5, 0X4B4C, 0X79D7, 0X685E, 0X1CE1, 0X0D68, 0X3FF3, 0X2E7A, 0XE70E, 0XF687, 0XC41C, 0XD595, 0XA12A, 0XB0A3, 0X8238, 0X93B1, 0X6B46, 0X7ACF, 0X4854, 0X59DD, 0X2D62, 0X3…
type: Answer
score: 0

http://stackoverflow.com/comment/40571428
has text: The code does the following: your pay doubles every day. The recursive method computePay return pay in cents for a given day.
comment on: http://stackoverflow.com/a/25918262
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25881409
answers question: http://stackoverflow.com/q/25881355
has body: We can start with the identity you've given 'a' = 0, that means we can just subtract 'a' from any given character. That is something like, String plaintext = "sallywenttotheseashoretocollectseashellsxx"; char[] letterArray = plaintext.toCharArray(); int[] array = new int[letterArray.length]; for (int i = 0; i &lt; letterArray.length; i++) { array[i] = letterArray[i] - 'a'; } System.out.println(Arrays.toString(array)); Output is (formatted for this post) [18, 0, 11, 11, 24, 22, 4, 13, 19, 19, 14, 19, 7, 4, 18, 4, 0, 18, 7, 14, 17, 4, 19, 14, 2, 14, 11, 11, 4, 2, 19, 18, 4, 0, 18, 7, 4, 11, 11, 18, 23, 23]
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/40527668
type: Comment
type: QuestionComment
has text: Do you mean that S may contain more (or less) than 3 arrays?
comment on: http://stackoverflow.com/q/25894477
score: 0

http://stackoverflow.com/a/25920856
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25920330
upvote count: 2
has body: You need to understand basic overriding Rules in java : 0).private, static and final method can not be overridden A overriden method cannot : 1) reduces access of overriden method i.e.if overridden method declared in parent class is defined with access modifier public than overriding method can not be package private or protected 2). throw broder checked Exception For example if overridden method throws FileNotFoundException then overriding method can not throw java.lang.IOException

http://stackoverflow.com/comment/40619840
has text: In a nutshell: *every* class has an "is-a" relationship with itself.
type: AnswerComment
comment on: http://stackoverflow.com/a/25945413
score: 0
type: Comment

http://stackoverflow.com/comment/40796488
comment on: http://stackoverflow.com/q/26018252
score: 0
has text: @VinceEmigh, this indeed solved the problem. thank you!
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40531029
score: 0
type: Comment
has text: What you are using at the client end? can you just provide some client code also,from where you are making request to this service?
comment on: http://stackoverflow.com/a/25890581
type: AnswerComment

http://stackoverflow.com/a/29247420
type: Answer
score: 0
has body: You asked your question many months ago, but I will make some comments anyway. From what I read, it seems to me that (as of March 2015...) the ingest protocol to use is AMQP data flow and scaling should be managed by Apache Storm or Spark for resilience, use some sort of message queue - e.g. RabbitMQ, Kafka, Azure EventHubs, AWS Kinesis I'm pretty sure you can use all these technologies from the Java ecosystem.
answers question: http://stackoverflow.com/q/25878073

http://stackoverflow.com/comment/40720890
comment on: http://stackoverflow.com/a/26001684
type: AnswerComment
has text: I appreciate your effort to help but I now get this error: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method readLine() is undefined for the type InputStream at Code.game.main(game.java:9)
score: 0
type: Comment

http://stackoverflow.com/q/26028341
has title: How to use spring @Lookup annotation?
has answer: http://stackoverflow.com/a/49964939
possible better answer: http://stackoverflow.com/a/35501476
favorite count: 0
answer count: 3
linked to: http://stackoverflow.com/q/3891997
upvote count: 18
downvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/35501476
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26034662
has body: I need to get prototype class from singleton. I found that method injection is the way to go, but I don't really know how to use spring @Lookup annotation. I'm new to dependency-injection, and I chose to go with annotation configuration, so I would like to continue in that direction. I found out that @Lookup annotation was added only recently (https://spring.io/blog/2014/09/04/spring-framework-4-1-ga-is-here), but I cannot find anywhere how to use it. So, here is simplified example Configuration class: @Configuration @Lazy public class ApplicationConfiguration implements ApplicationConfigurationInterface { @Bean public MyClass1 myClass1() { return new ContentHolderTabPaneController(); } @Bean @Scope("prototype") public MyClass2 myClass2() { return new SidebarQuickMenuController(); } } And here is class example: public class MyClass1 { doSomething() { myClass2(); } //I want this method to return MyClass2 prototype public MyClass2 myClass2(){ } } How do I do that with @Lookup annotation?
tagged with: java
score: 17
type: Question
has answer: http://stackoverflow.com/a/26034662
tagged with: dependency-injection

http://stackoverflow.com/q/25968334
has body: I'm debugging with eclipse an Android app but I can not see the value of Global Static Variables. public class Example{ private static int variable; public void someFunct(){ //some code int aux = variable; // some code } } I can check the value if assign to a local variable the global variable value, but I can't see the global variable while debugging. How can I solve it?
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/40660186
has title: Debug global variable in eclipse - Java/Android
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25968514
has comment: http://stackoverflow.com/comment/40660265
tagged with: android
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25968514
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40660257

http://stackoverflow.com/comment/130263121
type: Comment
type: AnswerComment
has text: 1. please wrap code in code block. 2. it's usually not good practice to modify input. always better to create a new object
comment on: http://stackoverflow.com/a/48721070
score: 0

http://stackoverflow.com/comment/40732043
has text: Hi Sarkar, I got "Can't find address for server xxx.com: Non-existent domain" when using nslookup command.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25992586

http://stackoverflow.com/comment/40735040
type: Comment
comment on: http://stackoverflow.com/a/26008988
score: 0
has text: @NirrajSingh try this req.getParameter("id"); too.
type: AnswerComment

http://stackoverflow.com/comment/40495166
type: Comment
has text: Firstly 6 10 15 are not prime ... Secondly it doesn't stop at five it completes the entire loop till 60 as given in the example but it doesn't print those number as we have isPrime && integer % num == 0 to ensure that the num printed has to be prime and has to divide the integer with an remainder of 0. otherwise it won't be printed.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25876328

http://stackoverflow.com/comment/40681113
type: Comment
has text: Main purpose to help asker secondary purpose to help others
comment on: http://stackoverflow.com/q/25979664
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40691514
type: QuestionComment
has text: Where is your [SSCCE](http://sscce.org/) demonstrating your problem? You were also asked for a `SSCCE` in your last question. If you want people to give you examples, then post a proper SSCCE so we can make changes. Don't expect us to write the entire code!!!
comment on: http://stackoverflow.com/q/25982306
score: 1
type: Comment

http://stackoverflow.com/comment/40508317
type: QuestionComment
type: Comment
score: 0
has text: What is and how do you create `serializedObject`?
comment on: http://stackoverflow.com/q/25883984

http://stackoverflow.com/a/25986252
has comment: http://stackoverflow.com/comment/40693658
score: 2
upvote count: 2
has body: yout can't call getLayoutInflater() directly , you need to call it on an instance of the LayoutInflater class. try this LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); homeworkView = inflater.inflate(R.layout.add_homework, null); you can replace context with "this" if you are calling this inan activity
accepted answer of: http://stackoverflow.com/q/25986199
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40693620
answers question: http://stackoverflow.com/q/25986199
type: Answer

http://stackoverflow.com/comment/40640588
type: QuestionComment
comment on: http://stackoverflow.com/q/25956217
has text: I don't understand what you think modifying a class to add methods and fields has to do with security.
score: 1
type: Comment

http://stackoverflow.com/q/25918556
tagged with: java
accepted answer: http://stackoverflow.com/a/34334070
score: 27
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/25918673
has answer: http://stackoverflow.com/a/50760302
tagged with: jsessionid
has answer: http://stackoverflow.com/a/25918673
has answer: http://stackoverflow.com/a/42240245
has comment: http://stackoverflow.com/comment/101165190
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/101468355
has comment: http://stackoverflow.com/comment/40571620
linked to: http://stackoverflow.com/q/877064
upvote count: 28
type: Question
has title: Spring boot configure custom jsessionid for embedded server
tagged with: spring-boot
has body: I want to configure my servlet context, such as setting a custom jsessionId key (see Changing cookie JSESSIONID name) I believe I can use the SpringBootServletInitializer when running a WAR file, manipulating the servletContext in onStartup(). However, when I run on an embedded application server, using new SpringApplicationBuilder().run(), I don't know the best place to manipulate the servlet context.
has answer: http://stackoverflow.com/a/34334070

http://stackoverflow.com/comment/40649028
type: AnswerComment
score: 0
has text: I agree with your note on why the tutorials don't show this, but the GUI building code probably works just by accident, because it typically doesn't get JIT-optimized. Otherwise you can expect at least some memory visibility issue.
type: Comment
comment on: http://stackoverflow.com/a/25959854

http://stackoverflow.com/q/25975263
type: Question
has answer: http://stackoverflow.com/a/25975384
has comment: http://stackoverflow.com/comment/40672415
tagged with: regex
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/40672383
answer count: 3
has answer: http://stackoverflow.com/a/25975621
upvote count: 1
has body: I have the following text file "Zanesville,OH" +39.93830 -82.00830 84ZC PMNQ "Zaragoza,Spain" +41.66670 -1.05000 GWC7 PXB0 "Zurich,Switzerland" +47.36670 +8.53330 HP9Z QVT0 "Zwickau,Germany" +50.70000 +12.50000 J17H RFH0 Now i want the values in each line. there are many spaces between values. i know that regex can be used to get the values. but i am unable to make one. the code that i am using to read file is this File file = new File("C:\\Users\\user\\Desktop\\files\\cities.txt"); if (file.exists()) { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line = ""; while ((line = br.readLine())!= null) { String token[] =line.split(" "); } } Can anyone tell me how can i get the values??
downvote count: 1
has comment: http://stackoverflow.com/comment/40672324
has comment: http://stackoverflow.com/comment/40672442
has comment: http://stackoverflow.com/comment/40672446
tagged with: java
has comment: http://stackoverflow.com/comment/40672315
has answer: http://stackoverflow.com/a/25975918
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25975621
has title: Spliting a string on the basis of regex
has comment: http://stackoverflow.com/comment/40673340
possible better answer: http://stackoverflow.com/a/25975384

http://stackoverflow.com/q/25907326
type: Question
answer count: 2
score: 5
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27343337
has comment: http://stackoverflow.com/comment/71390531
tagged with: keystore
tagged with: android
tagged with: csr
linked to: http://stackoverflow.com/q/13639514
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/63160989
linked to: http://stackoverflow.com/q/37850134
upvote count: 5
tagged with: java
tagged with: certificate
has title: What is the best way to generate Certificate Signing Request using AndroidKeyStoreProvider?
has body: I read this article. It says how to generate a KeyPair, however it doesn't specify how to generate a Certificate Signing Request based on the generated keys. From my research, to generate a CSR in Java, the samples from the web usually use the package sun.* or the BouncyCastle library. It seems like there isn't a way to generate a CSR with the standard java.security API. I read this and it seems to say the same thing. Do I have no choice but to use BouncyCastle? It is hard to imagine that Android Developers don't consider this kind of usage. By the way, the article also mentions that: Generating a new PrivateKey requires that you also specify the initial X.509 attributes that the self-signed certificate will have. You can replace the certificate at a later time with a certificate signed by a Certificate Authority Suppose I finally get a certificate signed by a Certificate Authority. What exactly should I do to "replace the certificate at a later time"?

http://stackoverflow.com/q/25927242
type: UnansweredQuestion
has body: I have some memory dumps (.DMP and .raw windows memory files). I want to print the hexadecimal values of the memory dump's content by reading the memory dump. Because i want to search through a particular hexadecimal header and footer and grab the content. I am suppose to grab the content with using regular expressions and i have no idea about how to get the hexadecimal value by reading the memory dump. I am doing some experiment in file carving. SO please give you creative ideas and codes that i can use to implement this task.
tagged with: regex
has comment: http://stackoverflow.com/comment/40587383
answer count: 0
tagged with: java
type: Question
has title: How to print the hexadecimal values of a given dmp file content
score: 0
tagged with: hex
has comment: http://stackoverflow.com/comment/40587796

http://stackoverflow.com/a/25890101
has body: The algorithm works, because checker becomes a bitmap that tells what characters were met. I think I will explain with an example. Let's say our string is 'bedb'. We start with checker = 0. Then 'b' comes. val == 1 because 'b' - 'a' == 1. (1 &lt;&lt; val) as you said is represented as 10 in binary. checker | 10 = 00 | 10 = 10 It means that we met a b (there is a 1 in the second place from right) and did not meet an a. Then e comes. val == 4. (1 &lt;&lt; val) is 10000 in binary. checker | 10000 = 10 | 10000 = 10010 Good. Now we know we met an e and a b. After d comes checker is 11010. Then b comes. (1 &lt;&lt; val) is 10. And here (checker &amp; (1 &lt;&lt; val)) is no longer zero. 11010 &amp; 10 is 10. So the method returns false, because it found a character it met before.
answers question: http://stackoverflow.com/q/25889628
downvote count: 0
type: Answer
score: 4
upvote count: 4

http://stackoverflow.com/comment/118944654
type: Comment
has text: I think if you create a new final instance of the class, this is the best solution for this kind of problem.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/33672834

http://stackoverflow.com/comment/40578707
type: QuestionComment
has text: Consider adding a java-8 tag because it's probably being more closely monitored by the core Java team. You can also do some actual measurements with `jmh`.
comment on: http://stackoverflow.com/q/25921761
score: 0
type: Comment

http://stackoverflow.com/comment/40539929
has text: @Constantin, `Didn't realize there was an entire Nimbus section.` - check out [UIManager Defaults](http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/) and change the Look and Feel to Nimbus. The "System Colors" and "Miscellaneous" items contain the base colors used by Nimbus.
comment on: http://stackoverflow.com/q/25897037
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/40699914
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25989744
has text: @zabri By convention it would have to *return a potato*. It is quite obvious.

http://stackoverflow.com/comment/40562217
score: 0
comment on: http://stackoverflow.com/a/25893354
type: AnswerComment
has text: If I pick a date an click OK on the datePickerPopUp the method onDatePicked is beeing called. So here is the date I have and I need to use. But how can I get it out of there? So back to the MainActivity, where I need it...
type: Comment

http://stackoverflow.com/q/25964754
favorite count: 0
has body: This is my first time using a BigDecimal and I am having some troubles with it. Here is my code: import java.math.BigDecimal; public class Test { public static void main(String[] args) { BigDecimal pi = new BigDecimal(4); boolean plus = false; for (int i = 3; i &lt; 1000000; i += 2) { if (plus) { pi.add(new BigDecimal(4).divide(new BigDecimal(i), 2, BigDecimal.ROUND_HALF_UP)); } else { pi.subtract(new BigDecimal(4).divide(new BigDecimal(i), 2, BigDecimal.ROUND_HALF_UP)); } plus = !plus; } System.out.println(pi); } } Why doesn't it calculate PI like it should but instead it gives me and answer of 4?
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/25964774
has comment: http://stackoverflow.com/comment/40654101
type: Question
score: 1
has answer: http://stackoverflow.com/a/25964774
tagged with: java
tagged with: bigdecimal
tagged with: pi
has comment: http://stackoverflow.com/comment/40653543
has title: Calculating PI with BigDecimal
upvote count: 1
answer count: 1

http://stackoverflow.com/q/25887688
accepted answer: http://stackoverflow.com/a/25888423
has comment: http://stackoverflow.com/comment/41345214
score: 2
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
has title: How to use custom Spring scope with unit tests (SpringJUnit4ClassRunner)
tagged with: spring
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25888423
type: Question
tagged with: junit4
has comment: http://stackoverflow.com/comment/41351262
has body: I am using JUnit tests with Spring configuration defined in a class annotated with @Configuration in my JUnit Test. The tests looks like this: @ContextConfiguration(classes = MyConfiguration.class}) @RunWith(SpringJUnit4ClassRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class SomeIntegrationTest { @Autowired private MyConfiguration myConfiguration; @Test public void someTest() throws Exception { myConfiguration.myBean(); } } In MyConfiguration, I would like to use Spring scope SimpleThreadScope: @Configuration public class MyConfiguration { @Bean @Scope("thread") public MyBean myBean() { return new MyBean(); } } When I run the test, the scope is not registered, though. I get java.lang.IllegalStateException: Failed to load ApplicationContext ... Caused by: java.lang.IllegalStateException: No Scope registered for scope 'thread' I am aware how a custom scope can be registered programatically: context.getBeanFactory().registerScope("thread", new SimpleThreadScope()); and I would like to avoid using XML Spring configuration. Is there any way, how can I register the custom scope in the unit test?

http://stackoverflow.com/a/25945403
has body: An array of a certain size of reference type will take same size in memory no matter what types of objects it holds. This is because the memory holds only the references (pointers) and that's it and not the memory for the array items which is assigned when those objects are created. The heap will then hold new objects as they're created and assigned to the array. So, the following arrays will all take up the same size: new Integer[10] new BigInteger[10] new String[10] new Object[10] Note that to the compiler, an array of a non-constrained generic type translates to an array of Object. Also note that arrays of primitives likely have a different memory footprint. ..... Again, this is just the memory for the array itself, not the items it references -- and this is a very important point in all of this, probably the most important point for understanding this.
answers question: http://stackoverflow.com/q/25945397
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25945397
type: Answer
upvote count: 7
score: 7

http://stackoverflow.com/comment/40661645
type: QuestionComment
comment on: http://stackoverflow.com/q/25968769
type: Comment
score: 0
has text: thanks @EJP, I just paste more code to the code quote, It's a post operation. please review it again..

http://stackoverflow.com/q/25889354
tagged with: mysql
has comment: http://stackoverflow.com/comment/40518020
has comment: http://stackoverflow.com/comment/40517574
has comment: http://stackoverflow.com/comment/40518253
type: Question
has comment: http://stackoverflow.com/comment/40518215
has title: Connecting Java App to my online database JDBC MySql
answer count: 1
has comment: http://stackoverflow.com/comment/40518087
score: 0
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40518701
has answer: http://stackoverflow.com/a/25890540
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23604128
has body: I am trying to fetch data from my Online database, but following error is coming. However it is working fine for my local database. Java Code import javax.swing.JFrame; import javax.swing.JLabel; import java.sql.*; import javax.swing.JOptionPane; public class BankingSystem extends JFrame { public static void main(String[] args) throws Exception { int ur=0; int PIN; String ID; int userSelection=0; Boolean pinCorrect = false; int amountDeposite; int amountWithdraw; int updateResult; Boolean isExit=false; Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://mysql11.000webhost.com/a46854323_javaapp"; String user = "a46854323_javaapp"; String pass="password"; Connection con = DriverManager.getConnection(url,user,pass); Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); } } and I get the following error: ` Exception in thread "main" java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.SocketException: java.net.ConnectException: Connection timed out: connect java.net.SocketException MESSAGE: java.net.ConnectException: Connection timed out: connect STACKTRACE: java.net.SocketException: java.net.ConnectException: Connection timed out: connect at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:143) at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:225) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1805) at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:452) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at BankingSystem.main(BankingSystem.java:22) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1875) at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:452) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411) at java.sql.DriverManager.getConnection(Unknown Source) a…
tagged with: java

http://stackoverflow.com/comment/40643265
has text: The only unsigned type in Java is `char`. Its size is equal to `uint16_t` in C, which is often the same as `unsigned short`.
score: 2
comment on: http://stackoverflow.com/q/25959367
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26012123
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26012186
tagged with: object
has answer: http://stackoverflow.com/a/26012194
tagged with: arrays
possible better answer: http://stackoverflow.com/a/26012168
score: -1
tagged with: sorting
has answer: http://stackoverflow.com/a/26012168
upvote count: 0
has title: ArrayIndexOutOfBoundsException when sorting array
has answer: http://stackoverflow.com/a/26012251
favorite count: 0
has answer: http://stackoverflow.com/a/26012186
answer count: 5
linked to: http://stackoverflow.com/q/5554734
has answer: http://stackoverflow.com/a/26012219
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/5554734
has comment: http://stackoverflow.com/comment/40739919
tagged with: java
has body: I just want to sort the array of numbers by the sort method. But unfortunately it throws an error: java.lang.ArrayIndexOutOfBoundsException:10 at Search.sort(Search.java:30) at Search.main(Search.java:67) Here is my code: import java.util.Scanner; public class Search { public Search() { System.out.println("inside a constructer"); } public int[] sort(int x[]) { for (int i = 0; i &lt; x.length - 1; i++) for (int j = 1; j &lt; x.length; j++) { int temp; if (x[i] &gt; x[j]) { temp = x[i]; x[i] = x[j]; x[j] = x[i]; } } return x; } public static void main(String[] args) { // System.out.println("fgdg"+num); int num[] = new int[10]; Scanner sc = new Scanner(System.in); System.out.println("Eneter the 10 integers:"); for (int i = 0; i &lt; 10; i++) { System.out.println("Enter the " + (i + 1) + " number:"); num[i] = sc.nextInt(); } System.out.println("before sorting:"); for (int m = 0; m &lt;= num.length; m++) System.out.println(num[m]); Search obj = new Search(); int x1[] = obj.sort(num); System.out.println("sorted:"); for (int k = 0; k &lt;= x1.length; k++) System.out.println(x1[k]); } }

http://stackoverflow.com/q/26032439
tagged with: foreign-collection
tagged with: ormlite
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
has title: ORMLite Android and ForeignCollection the bind value at index 1 is null
downvote count: 0
has body: I have a problems with organizing many-to-many relations with ORMLite, which I cannot overcome. I have a users and want to establish friendship relations between them, so I user the following code: I have class User.java: public class User { @DatabaseField(id = true, columnName = "_id") public long id; @ForeignCollectionField(columnName = COLUMN_FRIENDS, foreignFieldName = "user") public ForeignCollection&lt;UserFriendship&gt; friends; } Then I try to build many-to-many relations between users with UserFriendship @DatabaseTable public class UserFriendship { public static final String USER_1_FIELD_NAME = "user"; public static final String USER_2_FIELD_NAME = "friend"; @DatabaseField(columnName = USER_1_FIELD_NAME, foreign = true, uniqueCombo = true) public User user; public User friend; @DatabaseField(columnName = BaseColumns._ID, generatedId = true) private long id; } I have created a simple test to check everything is OK: public testUserFriendship() { User user = weClient.getEntityFactory().createUser(); user.id = 101; user.nickName = "user"; User friend = weClient.getEntityFactory().createUser(); friend.id = 102; friend.nickName = "user2"; user.friends.add(new UserFriendship(user, friend)); dao.getUserDAO().createOrUpdate(user); dao.getUserDAO().createOrUpdate(friend); User user2; user2 = dao.getUserDAO().queryForId(user.id); assertEquals(user.friends.size(), user2.friends.size()); } The test return the error and here is a backtrace: java.lang.IllegalArgumentException: the bind value at index 1 is null 09-25 10:39:26.509 8101-8114/? W/System.err﹕ at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:164) 09-25 10:39:26.509 8101-8114/? W/System.err﹕ at android.database.sqlite.SQLiteProgram.bindAllArgsAsStrings(SQLiteProgram.java:200) 09-25 10:39:26.509 8101-8114/? W/System.err﹕ at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47) 09-25 10:39:26.509 8101-8114/? W/System.err﹕ at android.database.sqlite.SQLiteDat…
has comment: http://stackoverflow.com/comment/40839563
tagged with: android

http://stackoverflow.com/q/25946545
score: 0
answer count: 1
has body: I was wondering if it was possible to drag the text from a JLabel, out of the java application onto a pdf form for example. If it is possible, could you point me in the right direction please?
tagged with: drag-and-drop
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41069741
tagged with: java
tagged with: swing
has title: Drag and drop text from a JLabel outside the java application onto a pdf form
has answer: http://stackoverflow.com/a/25949069
type: Question
has comment: http://stackoverflow.com/comment/41087578

http://stackoverflow.com/q/25896841
accepted answer: http://stackoverflow.com/a/25897206
linked to: http://stackoverflow.com/q/10367698
answer count: 1
duplicate of: http://stackoverflow.com/q/10367698
tagged with: sockets
has comment: http://stackoverflow.com/comment/40531922
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: file-transfer
has answer: http://stackoverflow.com/a/25897206
has title: Sending multiple files over java sockets
has body: I have a problem when sending files using sockets. The problem is that on the target host, the files I send are copied to the contents of the first file (including the file name and content of the other files) and not as separate files. For my test case I send only two files. Local host: public void sendFilesToServer(List&lt;String&gt; compFiles) throws IOException { Socket client = new Socket("127.0.0.1", 5000); BufferedInputStream bis = null; BufferedOutputStream bos = null; int in; byte[] byteArray; DataOutputStream dos = new DataOutputStream( client.getOutputStream()); //numero de archivos a enviar dos.writeInt(2); dos.flush(); bos = new BufferedOutputStream(client.getOutputStream()); for(String file : compFiles){ // Fichero a transferir final String filename = file; try { final File localFile = new File(filename); bis = new BufferedInputStream(new FileInputStream(localFile)); dos.writeUTF(localFile.getName()); dos.flush(); byteArray = new byte[8192]; while ((in = bis.read(byteArray)) != -1) { bos.write(byteArray, 0, in); } bos.flush(); } catch (Exception e) { System.err.println(e); } } dos.close(); bos.close(); client.close(); } target host: public void escucha(int puerto) throws IOException { ServerSocket server = null; Socket connection; BufferedInputStream bis; BufferedOutputStream bos; byte[] receivedData; int in; String file; try { server = new ServerSocket(puerto); while (true) { connection = server.accept(); receivedData = new byte[1024]; DataInputStream dis = new DataInputStream( connection.getInputStream()); // recibimos la cantidad de ficheros que recibiremos int q = dis.readInt(); for (int i = 0; i &lt; q; i++) { bis = new BufferedInputStream(connection.getInputStream()); file = dis.readUTF(); file = "C:\\targetFolder" + File.separator + file.substring(file.indexOf('\\') + 1, file.length()); bos = new BufferedOutputStream(new FileOutputStream(file)); while ((in = bis.read(receivedData)) != -1) { bos.write(receivedData, 0, in); } bos.flush(); } dis.cl…
score: 0

http://stackoverflow.com/q/25936671
score: -1
accepted answer: http://stackoverflow.com/a/25936732
tagged with: jagged-arrays
has comment: http://stackoverflow.com/comment/40604046
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25936732
favorite count: 0
type: AnsweredQuestion
upvote count: 0
tagged with: java
has body: Here is my jagged array which works perfectly fine during initialization: int a[][]=new int[5][]; for(int i=0;i&lt;5;i++) { for(int j=0;j&lt;=i;j++) { a[i]=new int[i+1]; a[i][j]=j+1; System.out.print(a[i][j]); } System.out.println(""); } Gives me desired output : 1 12 123 1234 12345 But printing the same Array with loop just gives absurd output: for(int i=0;i&lt;5;i++) { for(int j=0;j&lt;=i;j++) { System.out.print(a[i][j]); } System.out.println(""); } Gives: 1 02 003 0004 00005 I cannot draw any conclusion. What's wrong with the code?
type: Question
has title: Jagged array weird behaviour
tagged with: arrays

http://stackoverflow.com/comment/40536904
score: 0
has text: Seems that in your binding file missing some '/'... but can you add your xsd? in order to help you better.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25894994

http://stackoverflow.com/comment/40716101
type: Comment
comment on: http://stackoverflow.com/q/25982306
score: 0
type: QuestionComment
has text: @camickr I have put my all of the code with everything you asked. Hope this makes sense now. Any help would be greatly appreciated. Let me update my previous question as well. Thanks for your time.

aop
tags question: http://stackoverflow.com/q/25959049
tags question: http://stackoverflow.com/q/25992277
tag name: aop
tags question: http://stackoverflow.com/q/26025941
type: Tag
tags question: http://stackoverflow.com/q/25905167

http://stackoverflow.com/comment/40609787
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25939699
has text: I would look into the [Template Method Pattern](http://en.wikipedia.org/wiki/Template_method_pattern).

http://stackoverflow.com/a/25896573
has comment: http://stackoverflow.com/comment/40572490
upvote count: 1
has comment: http://stackoverflow.com/comment/40556745
accepted answer of: http://stackoverflow.com/q/25876926
has comment: http://stackoverflow.com/comment/40570428
has comment: http://stackoverflow.com/comment/40572744
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25876926
downvote count: 0
has comment: http://stackoverflow.com/comment/40567953
type: Answer
has body: This is beacause 10.0.2.2 is the address of localhost when using the emulator. If you want to try it on your device and all your computer and device are connected to the local network, try changing the server address to http://local-network-ip:port/_ah/api. When launching the appengine application set the host address to 0.0.0.0 to make it accessible to other machines on the network.
has comment: http://stackoverflow.com/comment/40571872
score: 1

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/25915984

numberformatexception
tags question: http://stackoverflow.com/q/25951508
tags question: http://stackoverflow.com/q/25959246
tags question: http://stackoverflow.com/q/25999498
tags question: http://stackoverflow.com/q/26011563
tag name: numberformatexception
tags question: http://stackoverflow.com/q/25889403
type: Tag
tags question: http://stackoverflow.com/q/25961581
tags question: http://stackoverflow.com/q/25956196

http://stackoverflow.com/q/25999429
type: Question
has answer: http://stackoverflow.com/a/26012291
has title: XML in string format to org.w3c.dom.Document in Java
has answer: http://stackoverflow.com/a/26003247
tagged with: saml
tagged with: java
tagged with: dom
answer count: 2
score: 0
has body: I am trying to convert a samlResponse in string format to org.w3c.dom.Document to validate it. But it yields null even though I have used couple of different ways. One way is as below: Here even the inputStream is null. BasicParserPool bpp = new BasicParserPool(); bpp.setNamespaceAware(true); Document doc= bpp.parse(new ByteArrayInputStream(samlResponse.getBytes())); Element responseElement = doc.getDocumentElement(); where the string samlResponse is as below (just a snippet): String samlResponse = "&lt;saml2p:Response xmlns:saml2p=\"urn:oasis:names:tc:SAML:2.0:protocol\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" Version=\"2.0\"&gt; &lt;saml2:Issuer etc etc Any thoughts where I am going wrong?
has comment: http://stackoverflow.com/comment/40724359
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40724377

http://stackoverflow.com/q/26023683
type: Question
has answer: http://stackoverflow.com/a/26024934
score: 0
answer count: 1
has title: How not show "Root WebApplicationContext: initialization started" in file log4j
has comment: http://stackoverflow.com/comment/40793023
tagged with: log4j
has body: I want to avoid Root WebApplicationContext: initialization started message in File for Log4J. How can I do this?
tagged with: spring
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/25935780
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40605812
answers question: http://stackoverflow.com/q/25935430
has comment: http://stackoverflow.com/comment/40604778
accepted answer of: http://stackoverflow.com/q/25935430
has body: How is your Part referenced in your ProductPart? should be Something like ProductPart{ @ManyToOne private Part part; } guess so change .add(Restrictions.eq("part", cPartId)) to .add(Restrictions.eq("part.part", cPartId)) Edit: ProductPart productPart = (ProductPart) sessionFactory .getCurrentSession() .createCriteria(ProductPart.class) .add(Restrictions.eq("part.part", cPartId)) .add(Restrictions.eq("product", productId)).uniqueResult();//here similarly access your Product's @Id //something like product.productId
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40602584
has comment: http://stackoverflow.com/comment/40604041
has comment: http://stackoverflow.com/comment/40604950
type: Answer
has comment: http://stackoverflow.com/comment/40605598
has comment: http://stackoverflow.com/comment/40605448
has comment: http://stackoverflow.com/comment/40605244

http://stackoverflow.com/comment/40777251
type: AnswerComment
comment on: http://stackoverflow.com/a/26020687
type: Comment
has text: I solved it with: double diff = 180+Math.toDegrees(radian); if(radian<0){ angle = 180+diff; }
score: 0

http://stackoverflow.com/a/50400498
answers question: http://stackoverflow.com/q/26005981
downvote count: 0
score: 1
has body: I had similar problem but with Java based configuration. I solved it using org.springframework.integration.expression.ValueExpression Here is part of my config ParameterizedTypeReference&lt;List&lt;String&gt;&gt; reference = new ParameterizedTypeReference&lt;List&lt;String&gt;&gt;() {}; httpRequestExecutingMessageHandler.setExpectedResponseTypeExpression(new ValueExpression(reference));
upvote count: 1
type: Answer

http://stackoverflow.com/a/25994873
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/40715661
score: 1
answers question: http://stackoverflow.com/q/25994424
has body: If I am understanding you correctly, you are talking about java based spring configuration. We are also using Java based configuration, but are still using the web.xml. You have to add your Java configuration file as a context param in the web.xml like so: contextConfigLocation com.spring.AppConfig So, you can still add your filters as you did above. Alternatively, if you are using the WebApplicationInitializer to configure the ServletContext, you can do the following: public class WebAppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) throws ServletException { container.addFilter("fooFilter", FooFilter.class); } } EDIT: Answer to question in comment - Bearing in mind I have never done this before, but from looking at the docs for ServletContext and FilterRegistration, I would suggest trying this to get the filter mapped to a specific URL: container.getFilterRegistration("fooFilter") .addMappingForUrlPatterns(DispatcherType.REQUEST, true, "/secured/");

http://stackoverflow.com/comment/40651268
type: QuestionComment
comment on: http://stackoverflow.com/q/25963325
has text: I would suggest that in you're tick method of the Animation class, when you reach the end of the animation (ie the index exceeded the number of frames), you need to reset the index and raise a flag so as not to either continue changing frames or painting the frames (depending on your needs), you would then need away for the animation class to know when it should start again though
score: 0
type: Comment

http://stackoverflow.com/q/25988017
has comment: http://stackoverflow.com/comment/61156697
accepted answer: http://stackoverflow.com/a/26011685
linked to: http://stackoverflow.com/q/6542118
has title: Compatibility issue with latest version of Selenium Webdriver and PhantomJs
tagged with: maven
linked to: http://stackoverflow.com/q/36706663
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
has body: I am trying to run my webdriver test cases using ghostdriver (Phantomjs).I have a maven project ,OS - WIN8, Coding - JAVA 1.7 , Framework : testng6.8.7+maven3 and currently using the latest version of Selenium Webdriver i.e dependency in pom.xml file . org.seleniumhq.selenium selenium-java 2.43.1 I have tried few PhantomJs dependencies into the pom.xml file But its not compatible with latest version of Wendriver. com.github.klieber phantomjs 1.9.2 I'm not able to import **import org.openqa.selenium.phantomjs.PhantomJSDriver; import org.openqa.selenium.phantomjs.PhantomJSDriverService;** But using phantomJs version 1.0.4 , I'm able to import but that's giving error java.lang.NoClassDefFoundError: org/openqa/selenium/HasInputDevices So what phantomjs version can i use that would be compatible with latest version of Selenium WebDriver.
tagged with: selenium
type: Question
tagged with: phantomjs
has comment: http://stackoverflow.com/comment/40701270
score: 0
has answer: http://stackoverflow.com/a/26011685
answer count: 1

http://stackoverflow.com/comment/40741297
type: AnswerComment
type: Comment
score: 0
has text: oh damn. That was a foolish mistake. Im in a hurry. So couldnt check it. Sorry. Thanks
comment on: http://stackoverflow.com/a/26013020

http://stackoverflow.com/q/25983132
has title: maximum subsequence product special cases
tagged with: java
type: Question
tagged with: algorithm
has answer: http://stackoverflow.com/a/25995554
score: 0
tagged with: product
tagged with: max
answer count: 1
has body: I'm attempting to write a maximum subsequence product program that is based off of the recursive solution to the maximum subsequence sum program (that is, it will follow the same format). It works so far on all cases except those where the result should be '0,' to indicate that there are no products within the sequence that are positive. For my five sequences below, it works on all but the last one: sequence1 = new int[]{-2, 5, 4, 4}; sequence2 = new int[]{6, 5, 0, -3, -5, -3, 7}; sequence3 = new int[]{0, -1, 1, 5, 0, -3, -4}; sequence4 = new int[]{0, 3, 3}; sequence5 = new int[]{0, -3, 3}; And here is the recursive method, where a is the sequence, p1 is a[0] initially and p2 is a[last index]: public static int msp3(int[] a, int p1, int p2) { if (p1 == p2) { if (a[p1] != 0) { maxprod = a[p1]; } else { maxprod = 0; } } else { int m = (p1 + p2) / 2; int L = msp3(a, p1, m); int R = msp3(a, m + 1, p2); int prodlt = 1, prodrt = 1, PL = 0, PR = 0; int checkForSplit = 0; for (int i = m; i &gt;= p1; i--) { if (a[i] != 0) { prodlt = prodlt * a[i]; if (prodlt &gt; PL) { PL = prodlt; } } else { if (i == m) { prodlt = 1; checkForSplit = 1; } } } for (int i = m + 1; i &lt;= p2; i++) { if (a[i] != 0) { prodrt = prodrt * a[i]; if (prodrt &gt; PR) { PR = prodrt; } } else { if (i == m + 1) { prodrt = 1; checkForSplit = 1; } } } if (checkForSplit == 0) { maxprod = max3(L, R, PL * PR); } else { maxprod = max3(L, R, PL); maxprod = max(maxprod, PR); } } return maxprod; } A note about 'checkForSplit,' the value is 0 unless a[i] == 0, and we are checking the leftmost or rightmost index in the current subsequence, in which case it is set to 1. This triggers a different calculation of 'max3' where PL is not multiplied by PR, the logic being that if either PL or PR is a 0, it is possible that the other of the two is not, in which case they should not be multiplied. As I said, this algorithm works for all but the 5th sequence. Any ideas?
type: UnansweredQuestion
tagged with: subsequence

http://stackoverflow.com/q/25946093
has body: I have a PDF xfa form that I am filling out with iText. I am unable to fill certain fields as they become enabled in the form only after clicking on a certain button within the form. This button actually calls a webservice that returns data. The data is used to fill up other fields which I am not bothered with. But only after clicking this button the fields that I am trying to fill out with XML data become enabled (non read only). I can't change the form. So I am guessing the only way I can fill out these fields by merging the XML data is by clicking this button. Is there a way I can click this button using Itext and then merge the pdf with the xml data I am sending it?
score: 0
tagged with: http://stackoverflow.com/tag/pdf
answer count: 0
type: UnansweredQuestion
has title: Programmatically click a button on a PDF XFA form using itext
tagged with: itext
has comment: http://stackoverflow.com/comment/40620943
has comment: http://stackoverflow.com/comment/40620863
type: Question
tagged with: java

http://stackoverflow.com/q/26002083
score: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7106775
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40721661
answer count: 1
has answer: http://stackoverflow.com/a/26002223
type: UnansweredQuestion
has title: java download file does not work in file size is more than 8K?
has comment: http://stackoverflow.com/comment/40748526
has comment: http://stackoverflow.com/comment/40721830
has comment: http://stackoverflow.com/comment/40721658
has body: i try to download a pdf file from url using the code below. It works fine when the file size is under 8k and if the file is up to 8k, it downloads the pdf file but the file is not readable. Code InputStream in = new BufferedInputStream(url.openStream()); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int n = 0; while (-1!=(n=in.read(buf))) { out.write(buf, 0, n); } out.close(); in.close(); byte[] response = out.toByteArray(); FileOutputStream fos = new FileOutputStream(new File("C:\\temp\\TEST.pdf")); fos.write(response); fos.close(); System.out.println("Download Finished");
downvote count: 0

http://stackoverflow.com/q/25905844
downvote count: 6
has comment: http://stackoverflow.com/comment/40547996
has body: D2L does not know how to present student names to the instructors who need to find these names for grade entry. The form is first name, a full middle name, last name, a comma, and an email address, which makes the middle name appear as the last name. The developers of D2L never learned the proper technique for presenting names. Write a Java program to help change this mess by placing the last name first, followed by a comma, the first name, and the middle initial followed by a period. Your dialog should look exactly like this for the given input (the email address must not be in the new name representation): Enter a name like D2L shows them: Casey Carter, Cartwright, ccc@email.arizona.edu Output:- Cartwright, Casey C. I'm not really sure how to even start this. Can someone give me some hints so I can get it rolling?
answer count: 1
has comment: http://stackoverflow.com/comment/40547949
tagged with: object
score: -6
tagged with: java
has comment: http://stackoverflow.com/comment/40547834
accepted answer: http://stackoverflow.com/a/25906146
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has title: Rearranging an inputted string
type: Question
has comment: http://stackoverflow.com/comment/40548182
has answer: http://stackoverflow.com/a/25906146

http://stackoverflow.com/q/25882237
has title: java https client throws "Received fatal alert: handshake_failure" with JDK 1.5 but works on JDK1.6
has answer: http://stackoverflow.com/a/25884041
tagged with: client
score: 0
tagged with: java
tagged with: https
type: Question
has body: I am runnning a simple java httpsclient. It gives handshake_failure error when compiled and running with jdk1.5 . But works fine with jdk1.6 . I cannot upgrade my code to jdk 1.6. Is there anyway I can get this working with jdk 1.5
tagged with: java-5
has answer: http://stackoverflow.com/a/50637754
answer count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6353849

apache-curator
tags question: http://stackoverflow.com/q/25997291
tag name: apache-curator
tags question: http://stackoverflow.com/q/25999381
type: Tag

http://stackoverflow.com/comment/40771639
comment on: http://stackoverflow.com/q/26029333
score: 0
type: Comment
type: QuestionComment
has text: I've removed the useless stacktrace. Figured I'd provide it just in case I was asked for a stacktrace.

http://stackoverflow.com/a/38090520
has body: I know this is a touch redundant but I don't have voting or comment rights yet so this is the only method for me to communicate. Digital Ocean is a solid choice. I am paying 5$ a month for a VM with 512 Mb Ram and 20 gigs of storage (which for my use is just fine.) I am still working on my first proper deploy but as stated above there are tons of tutorials to guide you through it. I have no prior command line experience but I've managed to get the server running, Created an SSH key, uploaded my landing page and have gotten a test project using Spark as the embedded server up and functional in a matter of a few hours. The Droplets are easily scalable from what I've seen. I'm still having trouble deploying an Rest based app with Postgres as the DB but it seems more to do with the ports in play than anything else. Keep getting 404s.
answers question: http://stackoverflow.com/q/25891645
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/40699548
type: Comment
type: AnswerComment
has text: Commented above, but in reply to your answer as well: the getter and setter add nothing to the class: the values aren't modified by either setter or getter, so all that results is extra bulk in the code that uses these values. It's a very primitive data-type that is used often; I'd prefer consistent access to the variables, and making it public while leaving the setter is just messy.
comment on: http://stackoverflow.com/a/25989982
score: 0

http://stackoverflow.com/q/26026561
has answer: http://stackoverflow.com/a/72426009
tagged with: java
has comment: http://stackoverflow.com/comment/40766701
has title: Parsing unicode 'Vulgar Fractions' into double in Java
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/40766742
answer count: 3
has comment: http://stackoverflow.com/comment/40766580
downvote count: 0
has answer: http://stackoverflow.com/a/26039424
score: 4
tagged with: unicode
has answer: http://stackoverflow.com/a/26027558
favorite count: 0
has body: I am scraping some data of a web site and parts of it include fractions in unicode e.g. 6' 5¼". I have successfully used the regex (\\d)' (\\d{1,2}([\\xbc-\\xbe])?)\" to extract each part of the String. This gives me two strings, one is "6" and the other is "5¼". The troublesome part is the bit that contains the unicode vulgar fractions. Obviously it does not parse correctly using Double.parseDouble. I have looked everywhere for examples for Java but have been unable to find any, how would I go about getting ¼ out as 0.25? If it makes it easier I can split the regex up again so it returns the fraction part seperately so I get three strings out instead of two.
tagged with: regex
has comment: http://stackoverflow.com/comment/40767094
has comment: http://stackoverflow.com/comment/40766746
type: UnansweredQuestion
tagged with: double

http://stackoverflow.com/q/25942251
has answer: http://stackoverflow.com/a/25942303
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/25942274
tagged with: if-statement
has title: Can I stop my program from printing repetitive information
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/40614840
tagged with: system.out
has answer: http://stackoverflow.com/a/25942321
possible better answer: http://stackoverflow.com/a/25942274
has answer: http://stackoverflow.com/a/25942284
accepted answer: http://stackoverflow.com/a/25942284
answer count: 4
type: AnsweredQuestion
tagged with: java
has body: I am trying to fix up my project to find and tell me which students are trying to register with another name so I programmed my code to search my arraylist and find those with same id number as follows, but is it possible to change or add something so that it does not print out the same information twice Example test case Student ID 103 is repeating the class as names Mark Wall and Stacy Gwee Student ID 103 is repeating the class as names Stacy Gwee and Mark Wall for(int n = 0; n&lt;studentList.size(); n++) { for(int m = 0; m&lt;studentList.size(); m++) { if(studentList.get(n).getId().equals(studentList.get(m).getId()) &amp;&amp; !studentList.get(n).getName().equals(studentList.get(m).getName())) { System.out.println("Student ID " + studentList.get(n).getId() + " is repeating the class as names " + studentList.get(n).getName() + " and " + studentList.get(m).getName()); } } }

http://stackoverflow.com/comment/40702910
has text: Yes, you are safe. You shouldn't mix transactions on the same database, why would you need such a thing? If there are 2 different databases use 2 SessionFactory(s).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25991097
type: Comment

http://stackoverflow.com/a/25924874
has body: public class Student { private String name; private String id; private int numOfCredits; public Student(String name, String id) { this.name = name; this.id = id; } public String getName() { return name; } public int getNumOfCredits() { return numOfCredits; } public void setNumOfCredits(int numOfCredits) { this.numOfCredits = numOfCredits; } }
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/25924690
type: Answer
upvote count: 0

http://stackoverflow.com/q/26018988
downvote count: 1
has body: How to call servlet from JSP which is present inside a subpackage? The servlet is present inside Source Packages" folder. Name of servlet is: servlets.io.registration.servlet1.java Now i want to call this servlet from JSP page, &lt;form name="admin-form" action="/*Path of servlet goes here*/"&gt; But this is not working.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40754079
score: -1
has answer: http://stackoverflow.com/a/26019109
tagged with: servlets
has title: How to call servlet from JSP which is in a subpackage
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26019253
upvote count: 0
tagged with: java

http://stackoverflow.com/a/26025537
downvote count: 0
score: 4
type: Answer
has body: You're using YYYY instead of yyyy. That means "week year", to be used in conjunction with "week of year". Just change YYYY to yyyy in both of your SimpleDateFormat constructors and you'll get output of: calString Sat Sep 27 00:00:00 EDT 2014 month 8 day 27 format date20140927 Note that month is 8 rather than 9 because months in java.util.Calendar are 0-based.
answers question: http://stackoverflow.com/q/26025477
upvote count: 4

http://stackoverflow.com/comment/40528610
type: QuestionComment
has text: Is `filePathArray` the same length as `result`? You are using the same index `j` in both `filePathArray[j]` and `result[j]`.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25894909

http://stackoverflow.com/a/25945819
type: Answer
answers question: http://stackoverflow.com/q/25945662
has body: String stringToBeWrapped = "A'B'C'D"; OMElement elementWhichNeedsCData = ....; TextImpl omText = (TextImpl) bodyElement.getOMFactory().createOMText(stringToBeWrapped); omText.setType(XMLStreamConstants.CDATA); elementWhichNeedsCData.addChild(omText); from http://axis.8716.n7.nabble.com/Problem-with-CDATA-tags-in-SOAP-message-td39617.html
score: 0

http://stackoverflow.com/comment/40525679
has text: this whole question is pointless. use UTF-8 and you have no endian issues.
comment on: http://stackoverflow.com/q/25876632
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25988078
downvote count: 0
has body: As explained in the documentation: Stubbing void methods with exceptions doThrow(new RuntimeException()).when(mockedList).clear(); //following throws RuntimeException: mockedList.clear();
type: Answer
accepted answer of: http://stackoverflow.com/q/25988012
score: 3
answers question: http://stackoverflow.com/q/25988012
has comment: http://stackoverflow.com/comment/106203307
upvote count: 3
has comment: http://stackoverflow.com/comment/86232939
type: AcceptedAnswer

http://stackoverflow.com/a/25922578
score: 1
answers question: http://stackoverflow.com/q/25915648
downvote count: 0
type: Answer
upvote count: 1
has body: To use CSS with XSL FO you would need something that processes CSS into XSL FO. You can look at the link below which is not Apache FOP but uses RenderX XEP behind the scenes. It allows for XML and/or HTML with CSS internal and external, leveraging XSL FO technology to format content. http://www.cloudformatter.com/CSS2Pdf

http://stackoverflow.com/a/35765960
downvote count: 0
has comment: http://stackoverflow.com/comment/99770948
has comment: http://stackoverflow.com/comment/77322332
upvote count: 28
type: Answer
has body: This was fixed in Spring Boot 1.2. The security chain now defaults to order 0. It can also be set via properties: security.filter-order=0 # Security filter chain order. https://github.com/spring-projects/spring-boot/issues/1640
score: 28
answers question: http://stackoverflow.com/q/25957879

http://stackoverflow.com/comment/40681291
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25979884
type: QuestionComment
has text: You can only cast an object to a type that it actually is. If you create an instance of `Task`, then it is a `Task`, but not a `TaskHelper`. You need to change the code that constructs a new `Task` to construct a new `TaskHelper` instead, assuming that is within your control.

http://stackoverflow.com/q/25875883
tagged with: concurrency
has comment: http://stackoverflow.com/comment/40494949
score: 0
answer count: 1
has title: Class structure for future multi-threading
has answer: http://stackoverflow.com/a/25876689
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40494572
tagged with: java
tagged with: multithreading
has body: I have an algorithm that runs on a large problem set. It reads the problem instance, then runs the algorithm on that problem read from the file. The solution space can be partitioned (can be split into disjoint sets that cover the entire space). That is, the algorithm can take advantage of concurrency/multi-threading. It isn't doing any concurrent processing at the moment. However, for the latter enhancements, i'm trying to make the class structured for this. One thing i'm doing is: keeping the field members &amp; methods that read the problem, and have no affect or are affected by the solution instances as static &amp; the rest of the members-- the field variables specific to each solution space &amp; methods that run on solution spaces as non-static. Is the anything more I should do for future concurrency at this point? TIA.
has comment: http://stackoverflow.com/comment/40493991
type: Question
tagged with: algorithm
tagged with: data-structures

http://stackoverflow.com/a/26204991
score: -1
has comment: http://stackoverflow.com/comment/41096684
type: Answer
answers question: http://stackoverflow.com/q/26031973
downvote count: 1
upvote count: 0
has body: nm.cancel(uniqueID); where nm is your object of NotoficationManager

http://stackoverflow.com/a/25944280
has body: T is a type variable in both your class EntityTest and in ClientServerComparator. But it's a variable and that means that it doesn't denote the same type in your two classes. You could have called T by another name like Z in ClientServerComparator and it would not change anything about the meaning of your code. So, to invoke the compare method on two objects of type variable T, you first need to cast your object to ClientServerComparator&lt;T&gt; instead of ClientServerComparator&lt;?&gt;. In the latter case, it doesn't know what the type is (&lt;?&gt;) so you cannot invoke any methods with arguments of the generic type [you can only invoke methods that return the generic type] If you cast to (ClientServerComparator&lt;T&gt;) you will get a warning from the compiler about an "unchecked cast". This is because in Java, generics are only compile-time type-safe. At runtime, the actual value of type variable T is not known anymore. So technically it is possible that you have a class Foo that implements ClientServerComparator&lt;Bar&gt;. If you know that you don't ever have this in your code, you can suppress that compiler warning with the @SuppressWarnings("unchecked") annotation. Like this: @SuppressWarnings("unchecked") public void testPutObject(Client client, T obj) throws UnExpectedStatusException { T entity = testGetObject(client, entityLocation, l); if (entity instanceof ClientServerComparator) { if (false == ((ClientServerComparator&lt;T&gt;) entity).compare(entity, obj)) { throw new UnExpectedStatusException(); } } }
answers question: http://stackoverflow.com/q/25943858
score: 0
type: Answer

http://stackoverflow.com/comment/40546089
type: QuestionComment
has text: I think this is a good starting point: http://php.net/manual/en/ref.ldap.php#99347
comment on: http://stackoverflow.com/q/25895491
score: 0
type: Comment

http://stackoverflow.com/a/25990723
type: AcceptedAnswer
downvote count: 0
has body: An arrow shows which column is currently sorted. If you put arrows on all columns, how will a user tell which column is currently used for sorting? I think it defeats the purpose of the arrow.
type: Answer
has comment: http://stackoverflow.com/comment/51324400
answers question: http://stackoverflow.com/q/25990682
has comment: http://stackoverflow.com/comment/40702235
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25990682
score: 1
has comment: http://stackoverflow.com/comment/40702308
has comment: http://stackoverflow.com/comment/40701273

http://stackoverflow.com/q/25937226
type: Question
score: 2
has answer: http://stackoverflow.com/a/25937881
favorite count: 0
tagged with: regex
answer count: 4
has comment: http://stackoverflow.com/comment/40608435
has answer: http://stackoverflow.com/a/25937653
upvote count: 3
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/25938432
tagged with: java
has body: I want to extract names from the following input using regular expression. Student Names: Name1 Name2 Name3 Parent Names: Name1 Name2 Name3 I am using the following method to match the data and I am not supposed to modify the method. I have to come up with regular expression that works with this method. public void parseName(String patternRegX){ Pattern patternDomainStatus = Pattern.compile(patternRegX); Matcher matcherName = patternName.matcher(inputString); List&lt;String&gt; tmp=new ArrayList&lt;String&gt;(); while (matcherName.find()){ if (!matcherName.group(2).isEmpty()) tmp.add(matcherName.group(2)); } } I came up with a regular expression that could get me the desired result, but the problem I found was that grouping doesn't work inside square brackets([]). private String studentRegX="(Student Names:\n[ +(\S+)\n]+\n)"; I am using the following regular expression now, but that is getting me only the last name in each set. private String studentRegX="Student Names:\\n( +(\\S+)\\n)+\\n"; private String parentRegX="Parent Names:\\n( +(\\S+)\\n)+\\n"; Thank you in advance for the help.
has title: Regular expression to extract sub string in groups
has answer: http://stackoverflow.com/a/25939881

post
tags question: http://stackoverflow.com/q/25972777
tags question: http://stackoverflow.com/q/25875531
tag name: post
tags question: http://stackoverflow.com/q/25875551
type: Tag
tags question: http://stackoverflow.com/q/25908457
tags question: http://stackoverflow.com/q/25958590
tags question: http://stackoverflow.com/q/25971287
tags question: http://stackoverflow.com/q/25940952

http://stackoverflow.com/comment/40522838
comment on: http://stackoverflow.com/a/25892193
type: AnswerComment
has text: I forgot to add *your* second statement. It makes the answer clearer. :). +1
score: 0
type: Comment

http://stackoverflow.com/a/25942972
answers question: http://stackoverflow.com/q/25942910
has comment: http://stackoverflow.com/comment/40635422
has comment: http://stackoverflow.com/comment/40635660
has comment: http://stackoverflow.com/comment/131111700
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: That's just integers with a radix of 20 (base 20). Remember the difference between the value (an abstract concept) and its representation. You care about representation only on input and output. When you input values they will be represented in base-20, and you want to output them in base-20. As long as that interface is satisfied, how the numbers are represented inside your code shouldn't matter, so you should use the most convenient representation for the range you need to cover (int, long or BigInteger). Java already has all the necessary infrastructure to deal with this. Check out the Integer.parseInt(String value, int radix) for input. For output there's Integer.toString(int value, int radix)
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25942910
has comment: http://stackoverflow.com/comment/40635815

http://stackoverflow.com/q/26022518
has answer: http://stackoverflow.com/a/26022571
tagged with: java
has body: I am new to Generics and am having an issue. Consider the following code: public class A {} public class B extends A {} public &lt;T extends A&gt; T getB() { A test = new B(); Class&lt;B&gt; clazz = B.class; if (clazz.isInstance(test)) { return (T)test; } return null; } This generates an Unchecked cast warning. on the return (T)test; line. but clearly I am checking the type with the if (clazz.isInstance(test)) line. Is there a way to do a "checked cast"? I'm not looking to just suppress the warning but actually implement a checked cast. Unfortunately I can't find information on how to perform a checked cast.
score: 14
tagged with: casting
type: AnsweredQuestion
downvote count: 0
tagged with: generics
accepted answer: http://stackoverflow.com/a/26022571
favorite count: 0
type: Question
has title: How to perform a checked cast?
upvote count: 14
answer count: 1

http://stackoverflow.com/q/26029634
tagged with: class
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/26029674
has answer: http://stackoverflow.com/a/26029661
tagged with: static
linked to: http://stackoverflow.com/q/14744746
answer count: 3
has title: Java: Cannot make static reference to non static method
possible better answer: http://stackoverflow.com/a/26029661
has answer: http://stackoverflow.com/a/26029710
duplicate of: http://stackoverflow.com/q/14744746
favorite count: 0
tagged with: compiler-errors
has body: I have this class that I'm trying to use to find the number of vowels and number of consonants in a string. import java.lang.String; public class vowelsAndConsonantsClass { private int vowels; private int consonants; public vowelsAndConsonantsClass(int vwls, int cons) { vowels = vwls; consonants = cons; } public void numberOfVowels(String str) { int vwls = 0; for(int i=0; i&gt;str.length(); i++) { if(str.charAt(i) == 'a' || str.charAt(i) == 'e' || str.charAt(i) == 'i' || str.charAt(i) == 'o' || str.charAt(i) == 'u' || str.charAt(i) == 'y'); vwls++; } }//end numberOfVowels public void numberOfConsonants(String str) { int cons = 0; for(int i=0; i&gt;=str.length(); i++) { if(str.charAt(i) != 'a' || str.charAt(i) != 'e' || str.charAt(i) != 'i' || str.charAt(i) != 'o' || str.charAt(i) != 'u' || str.charAt(i) != 'y'); cons++; } }//end numberOfConsonants public int getNumberOfVowels() { return vowels; } public int getNumberOfConsonants() { return consonants; } }//end class I'm trying to use this test input when I get the error. I will comment the line it is on. import java.util.Scanner; import java.lang.String; public class testVowelsAndConsonants { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int choice; System.out.println("Please enter a string."); String str = keyboard.nextLine(); choice = menu(keyboard); Character.toLowerCase(choice); switch(choice) { case 'a': System.out.println(vowelsAndConsonantsClass.getNumberOfVowels());//ERROR ON THIS LINE break; case 'b': break; case 'c': break; case 'd': break; case 'e':System.exit(0); } } public static int menu(Scanner keyboard) { int choice; System.out.println("Enter a to count the number of vowels in the string.\n"+ "Enter b to count the number of consonants in the string.\n"+ "Enter c to count both the vowels and consonants in the string.\n"+ "Enter d to enter another string.\n"+ "Enter e to Exit.\n"); do { choice = keyboard.nextInt(); } while(choice&lt;1||choice&gt;6); return choice; …
accepted answer: http://stackoverflow.com/a/26029710
tagged with: error-handling
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1

http://stackoverflow.com/q/25961142
answer count: 1
has comment: http://stackoverflow.com/comment/40678746
type: UnansweredQuestion
tagged with: sockets
tagged with: model-view-controller
has answer: http://stackoverflow.com/a/25961285
tagged with: java
tagged with: multithreading
has body: Someone can help me, im making a chat app by java , it have multi server and multi client, MVC code structure, and it have database. So many example of java about chat client-server on google but dont have Multil server and make links between them. Can some give me a guide to make Multil server and links between them. some example about MVC and JDBC Thanks you Sorry for my english.
type: Question
tagged with: database
score: 0
has title: How to create MultiSever and create links between them
has comment: http://stackoverflow.com/comment/40646900

http://stackoverflow.com/a/26030582
type: Answer
has comment: http://stackoverflow.com/comment/40777652
accepted answer of: http://stackoverflow.com/q/26028606
score: 0
answers question: http://stackoverflow.com/q/26028606
has body: It sounds like you want your message exchange to be more reliable. Consider introducing some handshaking or some mechanism to prevent the client from exiting prematurely. Also it doesn't look like the client is closing the socket correctly. I would try to model this simple use case more closely to the netty echo example to make sure you have your bases covered.
type: AcceptedAnswer

http://stackoverflow.com/comment/40571872
has text: Should I put : `String LOCAL_APP_ENGINE_SERVER_URL = "http://192.168.0.3:8888";` `String LOCAL_APP_ENGINE_SERVER_URL_FOR_ANDROID = "http://192.168.0.3:8888";` In the CloudEndpointUtils.java of my android app ?
type: Comment
comment on: http://stackoverflow.com/a/25896573
score: 0
type: AnswerComment

http://stackoverflow.com/a/26011903
answers question: http://stackoverflow.com/q/26011497
score: 0
type: Answer
has body: Okay, the method you're trying to implement is impossible. Well, at least for me. I don't know how to solve it. But anyways, I'll try to explain why you're getting the error: The operator + is undefined for the argument type(s) T, T This simply means, What does a + do with a type T? Well, it makes sense when we try to do something like: Calculadora&lt;Integer&gt; c = new Calculadora&lt;Integer&gt;(); Because Integer can be cast to int and the compiler knows exactly how to add int with int right? But since T can be of any type, what if we do something like: Calculadora&lt;Cat&gt; c = new Calculadora&lt;Cat&gt;(); Clearly, we don't know how the hell you will add a Cat with another Cat. That's why the compiler is giving you that error, it's telling you, I don't know how to add this Type together. I can only add numbers and Strings. Hope this'll help. :) EDIT 2: Well, the way I see it, if you really need to do something like that, you're going to have to change your class and method declaration a bit, something like: //Limit only the Generics to subtypes of Number class Calculadora&lt;T extends Number&gt; { //Return a specific type (Can be Double, Float, Long, etc.) Integer suma(T a, T b) { //Change this based on your return type (Can be double, float, long, etc.) int sum = 0; if (a instanceof Number &amp;&amp; b instanceof Number) { //Change this accordingly too (Can be doubleValue(), floatValue(), longValue(), etc.) sum = a.intValue() + b.intValue(); } return sum; } } This is only for Integer. You can change this to any subtype of Number if you want.

http://stackoverflow.com/comment/40773593
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26030039
has text: @Code-Apprentice I see... Yeah what I'm doing now seems to cause resource leakage. How would I go about doing that?
score: 0

http://stackoverflow.com/comment/40520078
type: QuestionComment
comment on: http://stackoverflow.com/q/25890673
has text: so...you hust want to split the result Strings again on " "?
score: 0
type: Comment

http://stackoverflow.com/q/25966381
has answer: http://stackoverflow.com/a/25966671
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25967582
has body: I am using zip4j to extract zip files in Android. I want to read a file from the zip file without saving it somewhere. I have got it working but it adds extra characters towards the end of the file. The extra characters are part of the file earlier. is = zipFile.getInputStream(fileHeader); InputStreamReader isr = new InputStreamReader(is, "UTF-8"); ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); char[] buffer = new char[BUFF_SIZE]; while (isr.read(buffer, 0, buffer.length) != -1) { String ans = new String(buffer); //strUnzipped += new String(buffer); strUnzipped += ans; list.add(ans); } I have used the list to see where the extra characters are inserted. It's inserted at the last line. and the extra text if from the previous line. In a way, it's more like the buffer did not get cleared and it replaced only part of the buffer.
tagged with: http://stackoverflow.com/tag/zip
has title: Java: Read InputStreamReader to String - Adding extra characters
type: Question
tagged with: java

http://stackoverflow.com/a/25874145
has body: The narrowing primitive conversion of a long to an int discards all but the lower order 32 bits of the original number, so you don't get Integer.MAX_VALUE. The JLS, Section 5.1.3, states: A narrowing conversion of a signed integer to an integral type T simply discards all but the n lowest order bits, where n is the number of bits used to represent type T. In addition to a possible loss of information about the magnitude of the numeric value, this may cause the sign of the resulting value to differ from the sign of the input value. This is in contrast to a primitive narrowing conversion from a floating-point type to an int, which may result in Integer.MAX_VALUE if the original value was too big. double l2 = 999999999999999999.0; System.out.println((int) l2); This prints: 2147483647
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25874098
score: 3
answers question: http://stackoverflow.com/q/25874098
downvote count: 1
upvote count: 4

http://stackoverflow.com/comment/40500962
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25878979
has text: @ajb you're right i want it to be idx = idx + 1

refactoring
tags question: http://stackoverflow.com/q/25916833
tags question: http://stackoverflow.com/q/25889377
type: Tag
tag name: refactoring
tags question: http://stackoverflow.com/q/25963553
tags question: http://stackoverflow.com/q/26003104

http://stackoverflow.com/q/25913497
has comment: http://stackoverflow.com/comment/40563802
favorite count: 0
has comment: http://stackoverflow.com/comment/40592559
has comment: http://stackoverflow.com/comment/40562941
tagged with: memory-leaks
score: 2
upvote count: 2
type: AnsweredQuestion
has body: I run client code inside my application, much like a WebServer deploys/undeploys WebApps. So I created a custom ClassLoader that gets discarded to get rid of the client code. However, this doesn't work properly. When executing and analyzing with Elipse Memory Analyzer, I can see that the objects and the classloader are never garbage collected: Somehow the problem seems to be related to the ThreadPoolExecutor, which implements a finalize() method. It was mentioned elsewhere, that finalizer methods are evil and can cause OutOfMemoryErrors, because Finalizer thread runs with lower priority. However, when analyzing the application and thread stack with VisualVM, the Finalizer thread is not busy but waiting for new work to arrive: "Finalizer" daemon prio=5 tid=0x00007fdb1484f800 nid=0x2603 in Object.wait() [0x000000010aaf6000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on &lt;0x000000079aaadf10&gt; (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135) - locked &lt;0x000000079aaadf10&gt; (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177) Locked ownable synchronizers: - None JavaDoc of ReferenceQueue.remove(ReferenceQueue.java:135): Removes the next reference object in this queue, blocking until either one becomes available or the given timeout period expires. Any ideas what can cause this problem and what to do about it? Every input is highly appreciated! Edit: We are using jdk1.7.0_09.jdk, so I guess it has nothing to do with this bug. Edit: When I let the application run long enough (and execute and discard enough client code) I do get OutOfMemoryErrors, so the VM should garbage collect the classes. Also, using the -verbose:gc flag, I see the following log output after the classes should be ready for finalization and just before taking the HeapDump:…
linked to: http://stackoverflow.com/q/14499886
tagged with: java
has answer: http://stackoverflow.com/a/26101045
linked to: http://stackoverflow.com/q/22243487
type: Question
has title: Finalizers not finalized for ThreadPoolExecutor, causing a memory leak
has comment: http://stackoverflow.com/comment/40563299
accepted answer: http://stackoverflow.com/a/26101045
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26013994
score: 0
has comment: http://stackoverflow.com/comment/40899457
answer count: 0
has comment: http://stackoverflow.com/comment/40894576
type: UnansweredQuestion
has body: I want to navigate to JSP page from Hyperlink click through Stucts flow : To call from My Jsp Page to Struts Config file below hyperlink: User Creation In the Struts-config.xml : I mapped my action classes as follow : <action-mappings> <forward name="failure" path="/jsp/index.jsp" /> <forward name="sessionexpired" path="/jsp/error.jsp" /> <forward name="success" path="/jsp/home.jsp" redirect="false"/> <forward name="user" path="user"/> userAction Class : public userAction() { System.out.println("inside userAction !!!!!!!!!!!!!!"); logger = Logger.getLogger("AdminLog"); relativeURL="http://localhost:8080/xyz/"; } public ActionForward user(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println("inside UserAction"); HttpSession session = (HttpSession)request.getSession(); String url = ""; LinkedHashMap<String,String> links = (LinkedHashMap<String,String>)session.getAttribute("links"); String requestURL= request.getRequestURL().substring(request.getRequestURL().lastIndexOf("/")+1) ; System.out.println("Link value in admin acton requestURL!!!!!!!!!"+requestURL); if(request.getQueryString()!=null && !("").equals(request.getQueryString())){ url = relativeURL+requestURL+"?"+request.getQueryString(); }else{ url = relativeURL+requestURL+"?"+request.getQueryString(); } System.out.println("url : "+url); if(links!=null && links.get("user")== null ){ links.put("user",url); //session.setAttribute("links", links); } return mapping.findForward("user"); } I am able to login , LoginAction is working fine but if i click hyperlink it shows : "HTTP Status 500 - No action instance for path /userAction could be created "
has comment: http://stackoverflow.com/comment/40842289
type: Question
tagged with: java
tagged with: hyperlink
has title: Hyperlink call through Struts Action
has comment: http://stackoverflow.com/comment/40748551
tagged with: struts
has comment: http://stackoverflow.com/comment/40748989
tagged with: jsp

http://stackoverflow.com/comment/40743321
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26013894
has text: @Tony change if `(i == ' ')` to `if (answer.charAt(i)==' ')`
score: 1

mapreduce
tags question: http://stackoverflow.com/q/25937946
tags question: http://stackoverflow.com/q/25980575
tags question: http://stackoverflow.com/q/25886830
type: Tag
tags question: http://stackoverflow.com/q/25985921
tags question: http://stackoverflow.com/q/25903137
tags question: http://stackoverflow.com/q/25953081
tag name: mapreduce
tags question: http://stackoverflow.com/q/26002383
tags question: http://stackoverflow.com/q/26008940
tags question: http://stackoverflow.com/q/25991726
tags question: http://stackoverflow.com/q/25902974
tags question: http://stackoverflow.com/q/26004370
tags question: http://stackoverflow.com/q/25987815
tags question: http://stackoverflow.com/q/25913840
tags question: http://stackoverflow.com/q/25985978

http://stackoverflow.com/comment/40621070
type: QuestionComment
has text: So to be perfectly clear, you can browse to `"http://localhost:8000/users/1"` with your browser?
comment on: http://stackoverflow.com/q/25944389
score: 0
type: Comment

http://stackoverflow.com/comment/40773031
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26030035
has text: I noticed that mistakes and placed s.nextLine() inside the end of the loop but it seems the problem is still there

http://stackoverflow.com/q/25936365
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: logging
score: 2
tagged with: java
type: Question
tagged with: intellij-idea
downvote count: 0
has body: I am using Log4J 2.0 and IntelliJ and I have activated the ANSI coloring option in the log4j2.xml file together with the Grep Console Plugin for IntelliJ when I am debugging in my IDE. This greatly improved reading the logs as I can now distinguish the different log levels by color. I know it is possible to change the style of the logs of the different log levels, e.g. %highlight{...}{TRACE=red} This works well but now my stacktraces are all printed in white color instead of red. I tried to change the style with the following rule but had no success: &lt;PatternLayout pattern="... %style{%exception}{Bright,Red}" Here is my complete pattern layout: &lt;PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %highlight{%-5p %c{1} - %m%n}{TRACE=white} %style{%exception}{Bright,Red}"/&gt; It looks like the exception is printed not through log4j but directy to system out. But still the coloring is affected based on whether %highlight is present in the pattern layout.
has title: Log4J Ansi Coloring Exceptions
favorite count: 0

http://stackoverflow.com/q/25899974
score: 0
has answer: http://stackoverflow.com/a/25900223
answer count: 2
has answer: http://stackoverflow.com/a/25900190
has title: Best way to handle JSON changing information
has comment: http://stackoverflow.com/comment/40539030
type: UnansweredQuestion
has body: I am looking for a way to handle the information that I receive in a JSON file. This file is supposed to change constantly (other people and programs are going to access it), so in a moment it would be like this example: { "activities": [ { "name": "do my homework", "status": "not yet done", "important": true }, { "name": "wash the dishes", "status": "not yet done", "important": true }, { "name": "play videogames", "status": "done", "important": false }, { "name": "take a shower", "status": "done", "important": true } ] } And 15 minutes later (just to say an amount of time) it would be like this { "activities": [ { "name": "do my homework", "status": "done", //NOTICE THIS ACTIVITY WAS DONE "important": true }, { "name": "wash the dishes", "status": "not yet done", "important": false //NOTICE THIS HAS CHANGED ITS IMPORTANCE }, { "name": "play videogames", "status": "done", "important": false }, { "name": "take a shower", "status": "done", "important": true }, { //NOTICE I'VE ADDED A NEW ACTIVITY "name": "take another shower", "status": "not yet done", "important": false } ] } What I want to know is how to handle these changes in Java (at least an idea) that could help me to detect these changes and handle them. I was thinking about creating two arraylists (doneActivities and notYetDoneActivities) and every 10 minutes call the json file and check if there were changes, and probably switch objects between those arraylists (sounds fine, but I don't know how could I do it). Or I could even use a mysql database, but I think it could further get my code more complex and I'm trying to keep it as simple as possible. notice that my Activities class is like this: public class Activity { private String name; private boolean done; private boolean important; //Getters and setters } Any suggestions will be really appreciated.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40537745
type: Question
has comment: http://stackoverflow.com/comment/40537747

http://stackoverflow.com/comment/40520909
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25891029
has text: maybe 2,147,483,647 is the character limit?
score: 0

http://stackoverflow.com/q/25979073
tagged with: java
tagged with: eclipse
has title: RenderScript problems in eclipse
type: Question
tagged with: renderscript
has body: I'm trying to compile a sample of renderScript, but no way. I have some errors that I can not solve: [09.22.2014 18:28:44 - aaa] error: Error reading '... \ aaa \ process.rs' Also I get that kind ScriptC_process there when I created the file .rs. project.properties: project.properties: renderscript.target=18 renderscript.support.mode=true sdk.buildtools=19.1.0 target=android-20 Also show the configuration of the project. Thank you very much. EDIT: The code of process.rs is as follows: #pragma version(1) #pragma rs java_package_name(com.example.aaa) //multipliers to convert a RGB colors to black and white const static float3 gMonoMult = {0.299f, 0.587f, 0.114f}; void root(const uchar4 *v_in, uchar4 *v_out) { //unpack a color to a float4 float4 f4 = rsUnpackColor8888(*v_in); //take the dot product of the color and the multiplier float3 mono = dot(f4.rgb, gMonoMult); //repack the float to a color *v_out = rsPackColorTo8888(mono); } I'm just using for example the following website: [link] https://stuff.mit.edu/afs/sipb/project/android/docs/guide/topics/renderscript/compute.html
has comment: http://stackoverflow.com/comment/40680894
score: 0
has comment: http://stackoverflow.com/comment/40694360
has comment: http://stackoverflow.com/comment/40781707
has comment: http://stackoverflow.com/comment/40685455
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40689679
answer count: 0

http://stackoverflow.com/q/26033823
has answer: http://stackoverflow.com/a/26099329
tagged with: java
has body: I have a Maven project with several modules, including org.eclipse.cdt.core. For some reason, the customer wants to build org.eclipse.cdt.core as well. I want to generate an aggregated Checkstyle report, from which some files, including all org.eclipse.cdt.core.* (incl. subpackages) classes are excluded. For this purpose, I specified the excludes tag as **/org/eclipse/cdt/core/**/*,org.eclipse.cdt.core/src/**/*,../org.eclipse.cdt.core/src/**/*,org.eclipse.cdt.core/**/* Then I ran mvn clean checkstyle-aggregate site, opened the file target/checkstyle-result.xml and found following lines in it: <file name="C:\dev\ide\org.eclipse.cdt.core\src\org\eclipse\cdt\core\AbstractExecutableExtensionBase.java"> <error line="0" severity="error" message="File does not end with a newline." source="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck"/> <error line="10" severity="error" message="Line is longer than 80 characters (found 81)." source="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck"/> <error line="15" severity="error" message="Line is longer than 80 characters (found 83)." source="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck"/> This means that my tag doesn't work. Then, I put the lines <checkstyle.skip>true</checkstyle.skip> into pom.xml files of all modules to be excluded from Checkstyle, but it didn't help. How can I generate a CheckStyle report (XML or HTML), without the results for certain modules (other than taking the 180 MB large target/checkstyle-result.xml and removing all "wrong" file enries from there) ? 4.0.0 mycompany-parentproject com.mycompany.parent 1.0.0-SNAPSHOT pom 0.21.0 0.21.0 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 1.7 Codehaus repository http://repository.codehaus.org/ <distributionManagement> ${project.artifactId}-site ${project.baseUri} </distributionManagement> org.eclipse.tycho tycho-maven-plugin ${tycho-version} true org.eclipse.tycho target-platform-configuration ${tycho-ver…
type: UnansweredQuestion
has title: How to exclude packages from CheckStyle analysis in a mavenized multi-module project?
tagged with: maven-3
favorite count: 0
type: Question
upvote count: 6
tagged with: checkstyle
score: 5
tagged with: maven
answer count: 1
downvote count: 1

http://stackoverflow.com/q/26001822
tagged with: ascii
has body: This is the ASCII table printing part of my code for a overall program. I am prompting the user to enter desired roles and columns but I can't get the user input connected to the actual production of the table. I know that my variables aren't matching correctly, how should I go about changing my variable so that rs, re, cs, ce is used in the implementation of the table? I confused myself quite a bit so I am asking help on here. Thanks! else if(input == 3) { System.out.println("Table B.1 ASCII Character Set, p.741 of textbook"); System.out.println("What is starting row (0-12): "); int rs = keyboard.nextInt(); System.out.println("What is end row (0-12): "); int re = keyboard.nextInt(); System.out.println("What is start col (0-9): "); int cs = keyboard.nextInt(); System.out.println("What is end col (0-9)"); int ce = keyboard.nextInt(); if (rs&lt;0 || rs&gt;12) { System.out.println( "Must be int between (0-12)"); rs = keyboard.nextInt(); if (!keyboard.hasNextInt()) { System.out.println("Must be int between (0-12)"); keyboard.nextInt(); } } if (re&lt;0 || re&gt;12) { System.out.println( "Must be int between (0-12)"); re = keyboard.nextInt(); if (!keyboard.hasNextInt()) { System.out.println("Must be int between (0-12)"); keyboard.nextInt(); } } if (cs&lt;0 || cs&gt;9) { System.out.println( "Must be int between (0-9)"); cs = keyboard.nextInt(); if (!keyboard.hasNextInt()) { System.out.println("Must be int between (0-9)"); keyboard.nextInt(); } } if (ce&lt;0 || ce&gt;9) { System.out.println( "Must be int between (0-9)"); ce = keyboard.nextInt(); if (!keyboard.hasNextInt()) { System.out.println("Must be int between (0-9)"); keyboard.nextInt(); } } keyboard.next(); char hex; char ascii = 0*20; int row = 2; int column; System.out.print("\n\n"); System.out.print(" "); System.out.println("ASCII Table"); System.out.print(" "); System.out.print("\n "); for (hex = '0'; hex&lt;= '9'; hex++) System.out.print(" " + hex); for (hex = 'A'; hex&lt;= 'F'; hex++) System.out.print(" " + hex)…
answer count: 1
has comment: http://stackoverflow.com/comment/40727123
has answer: http://stackoverflow.com/a/26001922
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40729781
score: 0
has comment: http://stackoverflow.com/comment/40721163
has comment: http://stackoverflow.com/comment/40721150
has comment: http://stackoverflow.com/comment/40722149
type: Question
tagged with: java
has title: Printing ASCII table java

http://stackoverflow.com/comment/40631597
score: 1
has text: check response status. I bet it's not 200 and you're getting an html error message
comment on: http://stackoverflow.com/q/25952818
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25973759
upvote count: 7
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25973731
score: 7
has body: You can use Math.log(value) to get log of specific value where value is considered to be in double.You can also use Math.log10(value) to get base 10 log. So you can just use Math.log(1/3.0)
has comment: http://stackoverflow.com/comment/40670113

http://stackoverflow.com/comment/40786677
comment on: http://stackoverflow.com/a/26037938
score: 0
type: AnswerComment
type: Comment
has text: what's the distinction between `EntAppClient.jar` and `EntAppClientClient.jar`? the double client is "local" (actual client) and the single client is on GF?

http://stackoverflow.com/q/26028839
type: Question
has comment: http://stackoverflow.com/comment/40770717
has comment: http://stackoverflow.com/comment/40770651
score: 0
has comment: http://stackoverflow.com/comment/40770592
has body: Ambitious newbie here. Help wanted please. On trying to connect to a MySQL database and show results to a JTable, my query accepts parameters from some variables thus: private String conv = "c_name as name,gender"; private String varYear; [later when a JButton makes a click action, it tries to connect and display the results] try{ varYear = yearTF.getText(); //troubleshooting my varYear variable with this next dialog shows that the varYear variable gets the appropriate text that is entered into the yearTF textfield JOptionPane.showMessageDialog(null, varYear); String sql = "SELECT "+conv+" FROM pTable WHERE date LIKE '%"+varMonth+"%' AND date LIKE '%"+varYear+"%' "; //now troubleshooting my statement with this next dialog shows that the varYear variable is null JOptionPane.showMessageDialog(null, sql); pst = conn.prepareStatement(sql); rs = pst.executeQuery(); Table_stats.setModel(DbUtils.resultSetToTableModel(rs)); }catch(Exception e){ JOptionPane.showMessageDialog(null, e); } Question 1: What did the 'String sql = ...' do to the varYear that was first of all 2014 (for example) to become null? Question 2: How can I have my varYear to contain 2014 and not the null it has become? // varMonth suffers the same problem but I just asked for varYear hoping it'll shoot the two birds. Thanks.
type: UnansweredQuestion
has title: anything wrong with passing these variables in java
answer count: 0
tagged with: java

http://stackoverflow.com/q/25983685
has comment: http://stackoverflow.com/comment/40688405
has comment: http://stackoverflow.com/comment/40688516
favorite count: 0
type: UnansweredQuestion
tagged with: swing
score: 2
tagged with: jslider
answer count: 0
downvote count: 0
tagged with: java
tagged with: look-and-feel
tagged with: uimanager
type: Question
upvote count: 2
has body: I'm using an app with JSliders and setting the look and feel to platform default. Now I'm trying to set the slider's thumb size using this code: UIManager.put("Slider.thumbHeight",5); UIManager.put("Slider.thumbWidth",20); but their size remains unchanged. I've also tried this: UIManager.getDefaults().put("Slider.thumbHeight",5); UIManager.getDefaults().put("Slider.thumbWidth",20); same result, the thumb on the slider remains the default size. I've also calling that before/after setting the style but there was no difference.
has comment: http://stackoverflow.com/comment/40688809
has title: UIManager.put() not working?
has comment: http://stackoverflow.com/comment/40688476

http://stackoverflow.com/q/25985921
has body: I have the following job, and many others like it, launched like this String jobName = MR.class .getSimpleName(); Configuration config = HBaseConfiguration.create(); config.set( "hbase.master", HBASE_MASTER); config.set( "hbase.zookeeper.quorum", HBASE_ZOOKEEPERS); config.set( "hbase.zookeeper.property.clientPort", ZK_CLIENT_PORT); Job job = Job.getInstance(config, jobName); job.setJarByClass(MR.class); Scan scan = new Scan(); //gets the raw band data cells scan.addColumn("gc".getBytes(), "s".getBytes()); System.out.println("Job=" + jobName); System.out.println("\tHBASE_MASTER=" + HBASE_MASTER); System.out.println( "\tHBASE_ZOOKEEPERS=" + HBASE_ZOOKEEPERS); System.out.println( "\tINPUT_TABLE=" + INPUT_TABLE); System.out.println( "\tOUTPUT_TABLE= " + OUTPUT_TABLE); System.out.println( "\tCACHING_LEVEL= " + CACHING_LEVEL); // TODO: make caching size configurable scan.setCaching(CACHING_LEVEL); scan.setCacheBlocks( false); // null for output key/value since we're not sending anything to reduce TableMapReduceUtil.initTableMapperJob(INPUT_TABLE, scan, MR.MapClass.class, null, null, job); TableMapReduceUtil.initTableReducerJob( "PIXELS", // output table null, // reducer class job); job.setNumReduceTasks(0); // at least one, adjust as required boolean b = job.waitForCompletion(true); but I keep getting this error and can't even read the data into the mapper Error: java.io.BufferedReader.lines()Ljava/util/stream/Stream; 14/09/22 22:11:13 INFO mapreduce.Job: Task Id : attempt_1410880772411_0045_m_000009_2, Status : FAILED Error: java.io.BufferedReader.lines()Ljava/util/stream/Stream; 14/09/22 22:11:13 INFO mapreduce.Job: Task Id : attempt_1410880772411_0045_m_000018_2, Status : FAILED Error: java.io.BufferedReader.lines()Ljava/util/stream/Stream; 14/09/22 22:11:13 INFO mapreduce.Job: Task Id : attempt_1410880772411_0045_m_000002_2, Status : FAILED never seen this before, been using HBase a while.... here is what i've tried: I can scan the table via the hbase shell no problem…
has answer: http://stackoverflow.com/a/25986116
has title: Error in Map Reduce over HBase, why?
type: AnsweredQuestion
type: Question
tagged with: hbase
answer count: 1
accepted answer: http://stackoverflow.com/a/25986116
tagged with: java
score: 0
tagged with: mapreduce
tagged with: hadoop

http://stackoverflow.com/q/25892417
has title: Caused by: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date
favorite count: 0
linked to: http://stackoverflow.com/q/20130129
has answer: http://stackoverflow.com/a/25915418
tagged with: cachedrowset
tagged with: classcastexception
has comment: http://stackoverflow.com/comment/40523391
has comment: http://stackoverflow.com/comment/40523717
accepted answer: http://stackoverflow.com/a/25915418
has answer: http://stackoverflow.com/a/25893334
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40523969
tagged with: java
possible better answer: http://stackoverflow.com/a/25893334
has comment: http://stackoverflow.com/comment/40523300
type: Question
has body: I am getting the below given error for the following code snippets: try { cRows = new CachedRowSetImpl(); while(cRows.next()) { MyClass myClass = new MyClass(); myClass.setPrevDate(cRows.getDate("PREV_DATE")); // In debug mode, the error was throwing when I press Resume from here. } } Error: Caused by: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date In the database, the datatype for the column is DATE only. I am not able to figure out where the Timestamp is coming here.
has comment: http://stackoverflow.com/comment/40523360
downvote count: 0
score: 4
upvote count: 4
answer count: 2

http://stackoverflow.com/a/25908117
score: 2
answers question: http://stackoverflow.com/q/25901714
has body: This works for me - it's thread-safe and generic. The enum must implement the Creator interface but that is easy - as demonstrated by the sample usage at the end. This solution breaks the binding you have imposed where it is the enum that is the stored object. Here I only use the enum as a factory to create the object - in this way I can store any type of object and even have each enum create a different type of object (which was my aim). This uses a common mechanism for thread-safety and lazy instantiation using ConcurrentMap of FutureTask. There is a small overhead of holding on to the FutureTask for the lifetime of the program but that could be improved with a little tweaking. /** * A Multiton where the keys are an enum and each key can create its own value. * * The create method of the key enum is guaranteed to only be called once. * * Probably worth making your Multiton static to avoid duplication. * * @param &lt;K&gt; - The enum that is the key in the map and also does the creation. */ public class Multiton&lt;K extends Enum&lt;K&gt; &amp; Multiton.Creator&gt; { // The map to the future. private final ConcurrentMap&lt;K, Future&lt;Object&gt;&gt; multitons = new ConcurrentHashMap&lt;K, Future&lt;Object&gt;&gt;(); // The enums must create public interface Creator { public abstract Object create(); } // The getter. public &lt;V&gt; V get(final K key, Class&lt;V&gt; type) { // Has it run yet? Future&lt;Object&gt; f = multitons.get(key); if (f == null) { // No! Make the task that runs it. FutureTask&lt;Object&gt; ft = new FutureTask&lt;Object&gt;( new Callable() { public Object call() throws Exception { // Only do the create when called to do so. return key.create(); } }); // Only put if not there. f = multitons.putIfAbsent(key, ft); if (f == null) { // We replaced null so we successfully put. We were first! f = ft; // Initiate the task. ft.run(); } } try { /** * If code gets here and hangs due to f.status = 0 (FutureTask.NEW) * then you are trying to get from your…
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25901714

http://stackoverflow.com/comment/40568591
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25917011
has text: execute update will return 0 when no rows have been deleted

http://stackoverflow.com/q/25956419
has title: Meaning of ? in Java
has comment: http://stackoverflow.com/comment/40638135
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/798545
downvote count: 1
has comment: http://stackoverflow.com/comment/40638065
has comment: http://stackoverflow.com/comment/40638092
type: Question
has answer: http://stackoverflow.com/a/25956462
answer count: 1
accepted answer: http://stackoverflow.com/a/25956462
score: 0
upvote count: 1
tagged with: ternary-operator
favorite count: 0
has comment: http://stackoverflow.com/comment/40638068
duplicate of: http://stackoverflow.com/q/798545
has body: ltVal = node.left != null ? node.left.height : 0; I think this is written in Java, can anyone explain what this means? Can't understand this shorthand notation

http://stackoverflow.com/comment/40706939
has text: Shouldn't it be better to use `customers[0].toString()` ?
comment on: http://stackoverflow.com/q/25994420
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40579179
has text: I mean how can I take part in the discussion other than commenting or writing a final answer
type: Comment
comment on: http://stackoverflow.com/a/25920598
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40592747
comment on: http://stackoverflow.com/a/25929322
type: AnswerComment
has text: Did you try it? What happened?
score: 0
type: Comment

http://stackoverflow.com/comment/40809018
has text: Thank you so much but I kinda used a different way. Yours work too!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26027149

http://stackoverflow.com/comment/40719532
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26000695
has text: For now I am using the unsigned APK stored in the bin folder.
type: Comment

http://stackoverflow.com/comment/40782432
type: Comment
type: QuestionComment
has text: @SteveC: Thanks for pointing that out. But I am more curious about why response time is increasing even on same machine?
comment on: http://stackoverflow.com/q/26030851
score: 0

http://stackoverflow.com/comment/40629595
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25951915
has text: hand.get(z).RankPoints() gives me an error. Cannot find symbol? I tried it before.

http://stackoverflow.com/q/25925478
downvote count: 0
has comment: http://stackoverflow.com/comment/40584336
possible better answer: http://stackoverflow.com/a/25925543
has title: Using long in place of int causes extra cases of overflow in java. Why?
favorite count: 0
has comment: http://stackoverflow.com/comment/40584217
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25925626
has answer: http://stackoverflow.com/a/25925543
has body: I wrote a solution for a Hackerrank challenge in which I sum a large amount of numbers into a total variable. When I used ints, I noticed I was overflowing in one test case, but all other test cases were outputting the correct answer. When I switched my total variable to a long to avoid overflowing, I started overflowing in two test cases (the same one as before and another one). Once I changed total, numToSell, and lastMax to longs, the program calculate the correct answer. What would cause this to happen? I would expect that moving a variable from int to long should never cause overflow. import java.util.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); while(T--&gt;0) { int N = in.nextInt(); int[] price = new int[N]; for(int i = 0; i &lt; N; ++i) { price[i] = in.nextInt(); } int lastMax = price[N-1]; //works when this and numToSell are longs int numToSell = 0; long total = 0; //if this is also an int, only overflows in one case in my samples for(int i = N - 2; i &gt;= 0; --i) { if(price[i] &lt;= lastMax) { ++numToSell; total -= price[i]; } else { total += numToSell*lastMax; lastMax = price[i]; numToSell = 0; } } total += numToSell*lastMax; System.out.println(total); } } } In the affected test case N is 39,384 and each number in the array is between 1 and 100000.
accepted answer: http://stackoverflow.com/a/25925626
has answer: http://stackoverflow.com/a/25925558
answer count: 3

http://stackoverflow.com/comment/40510924
score: 0
type: Comment
has text: I can't really understand the holding of the question. The question itself isn't perfectly written, but it seems to be clear for me: Is it possible to use external libraries on javacards?
type: QuestionComment
comment on: http://stackoverflow.com/q/25884707

http://stackoverflow.com/q/25939030
type: UnansweredQuestion
score: 0
has title: Reading from file And 2d Array With Arraybound Warning
has comment: http://stackoverflow.com/comment/40608562
has body: import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStreamReader; public class ReadFromFile { public static void main(String[] args) { String[][] clothesDb = new String[10][10]; try { FileInputStream fis = new FileInputStream( "C:/Users/irapple/Desktop/Project db/clothes.txt"); DataInputStream dis = new DataInputStream(fis); BufferedReader br = new BufferedReader(new InputStreamReader(dis)); String str; while ((str = br.readLine()) != null) { System.out.println(str); } int count = 0; while ((str = br.readLine()) != null) { String[] dividedLine = str.split("\t"); for (int i = 0; i &lt; 10; i++) { clothesDb[count][i] = dividedLine[i]; } count++; System.out.println(clothesDb); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } &gt;&gt;&gt;ID Order Type Color Price &gt;&gt;&gt;1 M-T-Shirt A Red 20000$ &gt;&gt;&gt;2 W-T-Shirt B Blue 30000$ &gt;&gt;&gt;3 K-T-Shirt C Yellow 35000$ &gt;&gt;&gt;4 M-Pans D Green 75000$ &gt;&gt;&gt;5 W-Pans E Gray 80000$ &gt;&gt;&gt;6 K-Pans F Purple 60000$ &gt;&gt;&gt;7 Hat G White 15000$ This is what I want to use it as an 2d array and I don't know how I can do with split method exactly and What should I do if I use \t for words and \t\t for another ones.and the final question is how can Scanner Class help for my porpuse(generate this file to 2d array)?
tagged with: java
tagged with: file
type: Question
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/25939181
has comment: http://stackoverflow.com/comment/40608442

http://stackoverflow.com/comment/40727688
score: 0
type: Comment
type: QuestionComment
has text: If you need common variables on both classes, just make a superclass from where both can extend and put all the common variables there. Then use as suited from the other 2 extended classes. Else just redesign your program, because it is impossible that the solution to your problem is that infinite recursion you have going on.
comment on: http://stackoverflow.com/q/26004651

http://stackoverflow.com/q/25988932
type: UnansweredQuestion
has title: ADT getting crashed frequently
type: Question
has comment: http://stackoverflow.com/comment/40698102
has comment: http://stackoverflow.com/comment/40698489
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40697945
has comment: http://stackoverflow.com/comment/40697753
has answer: http://stackoverflow.com/a/27148077
tagged with: java
tagged with: adt
tagged with: fedora
has comment: http://stackoverflow.com/comment/40697930
has body: A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00007fbfff58a061, pid=4562, tid=140465537804032 JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13) Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode linux-amd64 compressed oops) Problematic frame: C [libsoup-2.4.so.1+0x70061] soup_session_feature_detach+0x11 Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again An error report file with more information is saved as: /root/hs_err_pid4562.log If you would like to submit a bug report, please visit: http://bugreport.sun.com/bugreport/crash.jsp The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug. Help me how can i do i resolve this issue?

http://stackoverflow.com/comment/40547842
type: QuestionComment
has text: If you install the JDK you can always see the source of public classes like Vector and see for yourself.
score: 1
comment on: http://stackoverflow.com/q/25905852
type: Comment

http://stackoverflow.com/q/25924868
has comment: http://stackoverflow.com/comment/40584153
score: 0
answer count: 1
tagged with: text-files
has body: I'm going to read a corpus that is segmented by "##################" and put each segment in a separated text file. My corpus is like below: #####4327 (Judicial System) ofobcbyfwquote A right sd A uh actually i lived over in europe for a couple of years sd A i lived in germany sd A and in germany they dont have the jury system #####4423 (living right) sv B i think what they need to do is they need to somehow lipsmack take the money out of it sd B i mean when you have a man thats signed a a a statement saying hes guilty sd B we have a a family called all day family I need two text files out of it that named 4327 and 4423 and contain text in between. I know the standard model of reading text files and used it a lot: FileInputStream fis = new FileInputStream ("C:\\Users\\Desktop\\Train.txt"); BufferedReader br = new BufferedReader (new InputStreamReader(fis,"UTF-8")); String line=""; while ((br.readLine().startsWith("#"))) { But do not know how to command it to create text files out of each segment?
accepted answer: http://stackoverflow.com/a/25926191
has comment: http://stackoverflow.com/comment/40583092
has comment: http://stackoverflow.com/comment/40583127
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25926191
has title: creating text files out of a text file by extracting lines between two character lines
has comment: http://stackoverflow.com/comment/40583143

http://stackoverflow.com/a/25898974
has body: You can achieve the same using Java 7 Files.walkFileTree, PathMatcher and FileVisitor like this import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.PathMatcher; import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; public class MyVisitor extends SimpleFileVisitor&lt;Path&gt; { PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:data"); @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (matcher.matches(dir.getFileName())) { System.out.println("dir found " + dir); } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (matcher.matches(file.getFileName())) { System.out.println("file found " + file); } return FileVisitResult.CONTINUE; } public static void main(String[] args) throws IOException { Files.walkFileTree(Paths.get("full/path/to/your/search"), new MyVisitor()); } }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25898669
has comment: http://stackoverflow.com/comment/40602792
accepted answer of: http://stackoverflow.com/q/25898669
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40600586

http://stackoverflow.com/q/25890680
has answer: http://stackoverflow.com/a/25890929
has title: Can't get a image from resources
has answer: http://stackoverflow.com/a/25891363
accepted answer: http://stackoverflow.com/a/25891363
has body: I have problem to get an image from another package of my Eclipse project! I saw this post here My code is this CreateTableOnPDF.java: 288 ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 289 InputStream input = classLoader.getResourceAsStream("images/sun.png"); 290 PDJpeg img = new PDJpeg(doc, input); I getting this exception: Exception in thread "main" java.lang.IllegalStateException: at org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg.setPropertiesFromAWT(PDJpeg.java:132) at org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg.&lt;init&gt;(PDJpeg.java:113) at MainClasses.CreateTableOnPDF.main(CreateTableOnPDF.java:290) I don't know what I am doing wrong? Maybe is the a lot hour a have spend already infront of my monitor. Here is my project structure: Thanks for your attention and time!
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/3721706
tagged with: pdfbox
possible better answer: http://stackoverflow.com/a/25890929
upvote count: 2
answer count: 2
favorite count: 0

http://stackoverflow.com/comment/40585212
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25924787
type: Comment
has text: Is there a way I can email your or PM you to be able to ask you if I am doing this correctly? My classes are running and I was able to have it print all but not sure if its to the specifications that my project requires.

http://stackoverflow.com/a/25972935
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40690567
has comment: http://stackoverflow.com/comment/40674894
upvote count: 1
answers question: http://stackoverflow.com/q/25962448
has body: Here is how to cheat around this issue: =&gt; (map #(case (class %) #=java.lang.String (str "Found String " %) #=java.lang.Long (str "Found Long " %)) ["a" 42]) ("Found String a" "Found Long 42") However since classes don't have a stable hashcode, never use that on AOT-compiled code.
type: Answer

http://stackoverflow.com/comment/40494123
score: 0
comment on: http://stackoverflow.com/q/25875948
type: QuestionComment
type: Comment
has text: Apologies. It was a typo. Yes, I meant static

http://stackoverflow.com/a/25982469
type: Answer
downvote count: 0
score: 1
has body: if(remainder &lt;= 0) codeLetter = 'A'; else codeLetter = 'A' + remainder; This covers the case where remainder is negative.
upvote count: 1
answers question: http://stackoverflow.com/q/25982370

http://stackoverflow.com/comment/40522395
type: AnswerComment
has text: And which implementation will be used in the above example? SomeFactoryImpl or AnotherFactoryImpl?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25889141

http://stackoverflow.com/q/25939705
downvote count: 0
score: 1
tagged with: java
type: Question
has title: manage a button state in mainframe when opening a internalframe
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/9474622
has comment: http://stackoverflow.com/comment/40732326
has body: I just need to disable a button in mainframe when the button's actionperformed event fired and again enable it after the internal frame closed, I tried several method but all of them not working I'm using netbeans here is what I'm trying to do mainframe class package tt; public class Test extends javax.swing.JFrame { public Test() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jDesktopPane1 = new javax.swing.JDesktopPane(); jPanel1 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout jDesktopPane1Layout = new javax.swing.GroupLayout( jDesktopPane1); jDesktopPane1.setLayout(jDesktopPane1Layout); jDesktopPane1Layout.setHorizontalGroup(jDesktopPane1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 578, Short.MAX_VALUE)); jDesktopPane1Layout.setVerticalGroup(jDesktopPane1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 367, Short.MAX_VALUE)); jButton1.setText("OPEN"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout( jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING).addGroup( jPanel1Layout .createSequentialGroup() .addGap(136, 136, 136) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING).addComponent( jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.D…
tagged with: jinternalframe
favorite count: 0
accepted answer: http://stackoverflow.com/a/25939807
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25939807

http://stackoverflow.com/a/25925366
answers question: http://stackoverflow.com/q/25924721
type: Answer
has body: for(int i = 1; i &lt; 1001; i++) i++ is another way to add an increment of 1 to i for each loop... And a wee bit easier than typing (i = i + 1) I am new to Java and not sure if that was worth your time reading, but I think its pretty cool and might make your code prettier...
score: 0

http://stackoverflow.com/a/58217961
answers question: http://stackoverflow.com/q/25882480
type: Answer
has body: Here's my 100% result submission to this problem Firstly I've broken the 2D arraylist into 1D arrayList layerwise, Then rotated 1D matrix then again placed into matrix form While breaking 2D arraylist into 1D arrayList I've saved the positions of element in array so that we can place that rotated matrix at that position import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; public class Solution { static List&lt;Integer[]&gt; storePosition = new ArrayList&lt;&gt;(); public static ArrayList&lt;Integer&gt; rotateOneDArray(List&lt;Integer&gt; arr, int K) { int[] A = arr.stream().mapToInt(i -&gt; i).toArray(); // write your code in Java SE 8 int r = K % (A.length); int[] ans = new int[A.length]; int y; for (int i = 0; i &lt; A.length; i++) { y = i - r; if (y &lt; 0) { y += A.length; } ans[y] = A[i]; } return (ArrayList&lt;Integer&gt;) Arrays.stream(ans).boxed().collect(Collectors.toList()); } static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; getLinearMatrix(List&lt;List&lt;Integer&gt;&gt; matrix) { ArrayList&lt;ArrayList&lt;Integer&gt;&gt; linear = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); int M = matrix.get(0).size(); int N = matrix.size(); int m = M, n = N, i, j, counter = 0; Integer[] pos = new Integer[2]; while (m &gt;= 2 &amp;&amp; n &gt;= 2) { i = counter; j = counter; ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;((m + n - 2) * 2); while (j &lt; M - counter) { list.add(matrix.get(i).get(j)); pos = new Integer[2]; pos[0] = i; pos[1] = j; storePosition.add(pos); ++j; } --j; ++i; while (i &lt; N - counter) { list.add(matrix.get(i).get(j)); pos = new Integer[2]; pos[0] = i; pos[1] = j; storePosition.add(pos); ++i; } --i; --j; while (j &gt;= counter) { list.add(matrix.get(i).get(j)); pos = new Integ…
score: 0

http://stackoverflow.com/q/26024290
tagged with: gwt
has title: Using a Configuration file server-side in GWT
tagged with: glassfish
score: 0
answer count: 2
tagged with: tomcat
has answer: http://stackoverflow.com/a/32403307
has answer: http://stackoverflow.com/a/26024666
possible better answer: http://stackoverflow.com/a/26024666
type: AnsweredQuestion
has body: I made a GWT App that use TCP/IP connections server side. Now, I have harcoded the URL of the server that is used to connect: private static final String URL = "https://localhost/ws"; I want to load this parameter from a config File like TOMCAT/conf/webService.conf or TOMCAT/conf/webService.xml but I can't find any propper way of doing this. This app run in several servers and each server use a different WebService. I don't want to build a different app each time.
tagged with: java
accepted answer: http://stackoverflow.com/a/32403307
type: Question

http://stackoverflow.com/comment/40581823
type: Comment
has text: Yes, I'd like the message to print each time an invalid character (not a number) is entered. The purpose of the code is for two numbers and an operation (decided by a string input by the user) to be entered and calculated.
comment on: http://stackoverflow.com/a/25923963
score: 0
type: AnswerComment

http://stackoverflow.com/q/25896143
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26850679
score: 5
downvote count: 0
tagged with: cargo
favorite count: 0
has body: Here is how my persistence.xml looks like <?xml version="1.0" encoding="UTF-8"?> org.hibernate.jpa.HibernatePersistenceProvider java:/jdbc/EarthDS <property name="hibernate.archive.autodetection" value="class"/> <property name="hibernate.id.new_generator_mappings" value="true"/> <property name="javax.persistence.lock.timeout" value="5000"/> I am deploying the war file using maven-cargo-plugin. As per their documentation they set the datasource with JNDI as <cargo.datasource.datasource.derby> cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver| cargo.datasource.url=jdbc:derby:derbyDB;create=true| cargo.datasource.jndi=jdbc/CargoDS| cargo.datasource.username=APP| cargo.datasource.password=nonemptypassword </cargo.datasource.datasource.derby> Since I am using H2 database, I set it up as <cargo.servlet.port>9090</cargo.servlet.port> <cargo.datasource.datasource> cargo.datasource.driver=org.h2.Driver| cargo.datasource.url=jdbc:h2:~/earth;create=true| cargo.datasource.jndi=jdbc/EarthDS| cargo.datasource.username=sa| cargo.datasource.password= </cargo.datasource.datasource> When I run the project, I see error in log as [INFO] [talledLocalContainer] 09:43:01,335 INFO [org.jboss.as.server.deployment] (MSC service thread 1-12) JBAS015876: Starting deployment of "cargocpc.war" (runtime-name: "cargocpc.war") [INFO] [talledLocalContainer] 09:43:01,335 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015876: Starting deployment of "earth.war" (runtime-name: "earth.war") [INFO] [talledLocalContainer] 09:43:01,478 INFO [org.jboss.ws.common.management] (MSC service thread 1-3) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final [INFO] [talledLocalContainer] 09:43:01,753 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017534: Registered web context: /cargocpc [INFO] [talledLocalContainer] 09:43:01,779 INFO [org.jboss.as.jpa] (MSC service thread 1-16) JBAS011401: Read persistence.xml for earth [INFO] [talledLocalContain…
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/25918523
has title: Maven Cargo: Could not find JNDI datasource
upvote count: 5
tagged with: java
tagged with: h2
tagged with: jboss

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

http://stackoverflow.com/q/25937977
has comment: http://stackoverflow.com/comment/40606544
has answer: http://stackoverflow.com/a/25938072
has title: Enum to return an instance of an interface using generics in Java?
has body: I would like to have an enum to return an instance of an interface, using generics. I can't quite figure it out yet. I'm not exactly sure how to phrase my question. Below is the code that I am trying to get working. It won't compile because the enum wants the constructor to handle ImplementingClass explicity. My interface public interface MyInterface { } My implementing class public class ImplementingClass implements MyInterface { } The enum I'm trying to get working public enum MyEnum { CASE1(“CODE1”, ImplementingClass.class); private String code; private Class&lt;MyInterface&gt; aClass; private MyEnum(String code, Class&lt;MyInterface&gt; aClass) { this.code = code; this.aClass = aClass; } public String getCode() { return this.code; } public MyInterface getInstance() { return this.aClass.newInstance(); } }
has answer: http://stackoverflow.com/a/25938136
tagged with: generics
type: UnansweredQuestion
tagged with: enums
score: 0
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/40512316
comment on: http://stackoverflow.com/a/25886142
has text: Yeah, but when is menu not null? ;-) when I am using the builder it's still null.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25964382
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40652850
possible better answer: http://stackoverflow.com/a/25964474
type: Question
has answer: http://stackoverflow.com/a/25964428
has answer: http://stackoverflow.com/a/25964474
has title: What type to return?
has answer: http://stackoverflow.com/a/25964407
has body: Consider a method which produces different types of results. In my case it's either an ArrayList or an Integer (pseudo code): int a = ... // value for a comes from another function public ArrayList compute(){ // return either ArrayList or Integer if(a==1){ ArrayList result = new Arraylist() for(int i=0; i&lt;=something; i++){ arr.add(...); } } if(a==2){ int result; result = somethingElse; } return result; } Depending on the result of a, the result of result comes either from a loop and loads the results into an ArrayList, or in the second case it will just be a single number. What type should the method return?
score: 0
tagged with: java
answer count: 3
tagged with: methods
accepted answer: http://stackoverflow.com/a/25964407

http://stackoverflow.com/a/25988426
has body: Use onStart() method Use an Async Task call in the onStart() mentod and run a background thread In the AsyncTask use doInBackground() to run the methods that take longer time to execute Update the UI thread in onPreExecute(), onPostExecute(), onProgressUpdate() Async task Example : public class FrgLatein extends Fragment { //New-Instance public static FrgLatein newInstance(){ Log.d("FrgLatein", "newInstance"); FrgLatein fragment = new FrgLatein(); return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d("FrgLatein", "onCreateView"); View view=inflater.inflate(R.layout.frg_latein, container, false); setHasOptionsMenu(true); return view; } @Override public void onActivityCreated(Bundle savedInstanceState) { Log.d("FrgLatein", "onActivityCreated"); super.onActivityCreated(savedInstanceState); } @Override public void onStart() { Log.d("FrgLatein", "onStart"); super.onStart(); new LongOperation().execute(""); } private class LongOperation extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... params) { // Do the Web service long run here return "Executed"; } @Override protected void onPostExecute(String result) { // Do the UI-task here } @Override protected void onPreExecute() { // Do the UI-task here } @Override protected void onProgressUpdate(Void... values) { // Do the UI-task here which has to be done during backgroung tasks are running like a downloading process } } }
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40697058
has comment: http://stackoverflow.com/comment/40696894
answers question: http://stackoverflow.com/q/25988192

http://stackoverflow.com/q/25879807
has comment: http://stackoverflow.com/comment/40501373
tagged with: text
linked to: http://stackoverflow.com/q/2788080
type: UnansweredQuestion
downvote count: 2
tagged with: file
has comment: http://stackoverflow.com/comment/40524585
has answer: http://stackoverflow.com/a/25879835
has comment: http://stackoverflow.com/comment/40542194
has comment: http://stackoverflow.com/comment/40535287
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/40501534
has body: I have a text file with the following two lines: AAPL 101.50 MSFT 42.50 The text file will change with different tickers and prices so the text file is not constant. My question is, how can I pull just the ticker and then the price separate. My program will have someone enter the ticker name and it should output the price. Furthermore, if someone enters a price and the price the user entered is less than a ticker price then it will show all the tickers with greater. I am looking for info and some help on this since I'm new to Java. It is for a school assignment. Thanks
has answer: http://stackoverflow.com/a/25879854
answer count: 2
has title: Pulling lines from text file in java
has comment: http://stackoverflow.com/comment/40501564
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40524788

http://stackoverflow.com/a/26027125
downvote count: 0
answers question: http://stackoverflow.com/q/26026948
upvote count: 2
type: Answer
has body: I can't answer your question directly, but what you are looking for is referred to as "tokenization," I believe. One reason to use tokenization instead of a simple digest or hashing scheme is to avoid problems related to collisions. Some providers even perform this exact type of tokenization for things like replacing a credit card number with a valid (as far as the format is concerned) token that can be processed like a regular credit card number without exposing any sensitive information.
score: 2

http://stackoverflow.com/a/25989247
has body: From the docs: getPageSource java.lang.String getPageSource() Get the source of the last loaded page. If the page has been modified after loading (for example, by Javascript) there is no guarantee that the returned text is that of the modified page. Please consult the documentation of the particular driver being used to determine whether the returned text reflects the current state of the page or the text last sent by the web server. The page source returned is a representation of the underlying DOM: do not expect it to be formatted or escaped in the same way as the response sent from the web server. Think of it as an artist's impression. Returns: The source of the current page http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebDriver.html#getPageSource%28%29
answers question: http://stackoverflow.com/q/25988884
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40698380
upvote count: 1

http://stackoverflow.com/comment/40612606
comment on: http://stackoverflow.com/q/25940412
score: 0
has text: @ElliottFrisch Now I am confused. If my understanding is correct then a server needs to implement these containers to be Java EE compliant. If weblogic does not have the other two then why is it listed as a compliant server on oracle's website at http://www.oracle.com/technetwork/java/javaee/overview/compatibility-jsp-136984.html? Is my understanding incorrect?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25965904
has body: The Spring Batch ItemReaders and ItemWriters can also extend an additional interface called ItemStream. This interface provides some additional life cycle methods that are useful for this scenario. In your case, I'd recommend doing the actual read in the ItemStream.open method. This is called once at the beginning of the step. Then, in the ItemReader.read method, you can iterate through the results of the query. There are a number of ItemReader implementations provided with Spring Batch that use this technique. One example is the JdbcCursorItemReader who's source code can be found here: https://github.com/spring-projects/spring-batch/blob/master/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcCursorItemReader.java
accepted answer of: http://stackoverflow.com/q/25965705
answers question: http://stackoverflow.com/q/25965705
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40644997
comment on: http://stackoverflow.com/q/25960302
type: Comment
score: 0
has text: when i use terminal as a client(using command ./mongo) it works.. But hwen i use java, its not getting connected
type: QuestionComment

http://stackoverflow.com/a/25965815
type: Answer
accepted answer of: http://stackoverflow.com/q/25942358
answers question: http://stackoverflow.com/q/25942358
downvote count: 0
type: AcceptedAnswer
has body: You are missing your &lt;TD&gt; tags providing the template which fields to print where. See the Iteration Basics of the documentation
score: 8
upvote count: 8

http://stackoverflow.com/a/25899845
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/63524568
has body: String dateIdValue = "..."; Class&lt;?&gt; mainClass = A.class; Class&lt;?&gt; dateClass = B.class; String colDate1 = "date1"; String colDate2 = "date2"; String colDateId = "id"; Property date1Prop = Property.forName(colDate1); Property date2Prop = Property.forName(colDate2); DetachedCriteria date1Criteria = DetachedCriteria.forClass(dateClass) .setProjection(date1Prop) .add(Restrictions.eq(colDateId, dateIdValue)); DetachedCriteria date2Criteria = DetachedCriteria.forClass(dateClass) .setProjection(date2Prop) .add(Restrictions.eq(colDateId, dateIdValue)); Criteria criteria = getSession().createCriteria(mainClass) .add(date1Prop.lt(date1Criteria)) .add(Restrictions.or(date2Prop.isNull(), date2Prop.le(date2Criteria))) .addOrder(Order.desc("x")); /* SELECT A.* FROM A, P WHERE A.date1 &lt; P.date1 AND (A.date2 is null or A.date2 &lt;= P.date2 ) ORDER BY A.x DESC; */
accepted answer of: http://stackoverflow.com/q/25893886
answers question: http://stackoverflow.com/q/25893886

http://stackoverflow.com/comment/40656482
has text: a good example:http://c2.com/cgi/wiki?CanonicalizedMapping
score: 1
comment on: http://stackoverflow.com/q/25966210
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26012786
has body: This is just repost from comment, which solved my problem: Thanks to Opal Running gradle without net connection may not be a very good idea. Nevertheless if You have the jar You need in the local directory, just add id to script dependencies using file dependencies. See: http://www.gradle.org/docs/current/userguide/dependency_management.html#file-dependencies from Opal
downvote count: 0
answers question: http://stackoverflow.com/q/26000235
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/25936843
answers question: http://stackoverflow.com/q/25936272
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
score: 2
has body: The problem lies in the fact that both for and map yield lazy sequences. Since you don't force their results anywhere in your code the sequence isn't realized and the calls to .update are never made. Try subtituting both for doseq - an iteration form that deals specifically with side-effects (among other things isn't lazy) and see how that changes the result: (defn getCRC [s i bytes] (let [crc32 (CRC32.)] (if (not= s nil) (doseq [c s] (.update crc32 (int c))) ) (doseq [x [0 8 16 24]] (.update crc32 (int (bit-shift-right i x)))) (doseq [c bytes] (.update crc32 (int c)) ) (.getValue crc32) ) )
accepted answer of: http://stackoverflow.com/q/25936272

http://stackoverflow.com/comment/40774445
score: 0
type: Comment
type: QuestionComment
has text: I suggest always use try catch i.e exception handling and when exception occurred try to understand it and goggle it with exception message. :)
comment on: http://stackoverflow.com/q/26030579

http://stackoverflow.com/a/47108760
answers question: http://stackoverflow.com/q/25992277
type: Answer
upvote count: 1
has body: Another alternative is to use @Pointcut("bean(*Controller)") But naming of your beans should be corresponding
score: 1
downvote count: 0

http://stackoverflow.com/q/25963603
has title: How to make number wrap back to maximum value
accepted answer: http://stackoverflow.com/a/25963721
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25963721
has comment: http://stackoverflow.com/comment/40651481
type: AnsweredQuestion
has body: Sorry if the title is vague, and if this doesn't belong here (since it's more of a maths question) but I have a problem. Here I have an algorithm, that adds a number to another number (e.g current += step) and if that number is greater than the max value, the remainder of the step is added to the minimum: int current = 89; int step = 4; final int max = 90; final int min = 29; current += step; if(current &gt; max) current %= max; System.out.println(current + min); // this will give 32 My question is, how would I do this backwards, so that if the number is less than the minimum, the remainder is taken away from the maximum. I have tried some different things but none of them seem to work. Thanks!
tagged with: math
tagged with: java

http://stackoverflow.com/q/26000836
has title: JSON Parsing: org.json.JSON.typeMismatch
upvote count: 1
has answer: http://stackoverflow.com/a/26002346
type: AnsweredQuestion
has body: I am attempting to parse JSON from a URL, I think I have tried a 100 different ways but so far I haven't found the correct solution. I believe the problem I am having is with the data structure from the JSON I am receiving. Each has a name starting with"0" and increasing to till last one. I want to take all these companies and put them into an arraylist. public static String url = "http://api.richmondsystemengineering.com/v1/?query_type=rva_card_get_businesses&amp;appkey=51e53e510ecc14e4b2bde952f0c589f0"; public static void getData(Context context) { // Hashmap for ListView ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); HttpClient httpClient = new DefaultHttpClient(); HttpResponse response = null; HttpGet getMethod = new HttpGet(url); try { response = httpClient.execute(getMethod); // CONVERT RESPONSE TO STRING String result = EntityUtils.toString(response.getEntity()); // CONVERT RESPONSE STRING TO JSON ARRAY JSONArray ja = new JSONArray(result); // ITERATE THROUGH AND RETRIEVE CLUB FIELDS int n = ja.length(); for (int i = 0; i &lt; n; i++) { // GET INDIVIDUAL JSON OBJECT FROM JSON ARRAY JSONObject c = ja.getJSONObject(i); Log.e("name", c.getString("phone")); // Storing each json item in variable companyName = c.getString("name"); companyEmail = c.getString("email"); companyAddress = c.getString("address"); companyCity = c.getString("city"); companyZip = c.getString("zip"); companyDescription = c.getString("description"); HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("name", companyName); map.put("email", companyEmail); map.put("address", companyAddress); map.put("city", companyCity); map.put("zip", companyZip); map.put("description", companyDescription); contactList.add(map); } } catch (Exception e) { error = true; e.printStackTrace(); } } Then on my Logcat I get: org.json.JSONException: Value {"EAT_subcat":"farm, market and grocery","phone":"(804) 780-0086","WOR…
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
accepted answer: http://stackoverflow.com/a/26002346
has comment: http://stackoverflow.com/comment/40720867
has comment: http://stackoverflow.com/comment/40719354
has comment: http://stackoverflow.com/comment/40721876
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40720453

http://stackoverflow.com/q/25900465
tagged with: threadpool
answer count: 1
downvote count: 0
favorite count: 0
has title: Is there any thread pool for Sun/Oracle CORBA implementation and how to configure it?
type: UnansweredQuestion
tagged with: multithreading
tagged with: orb
score: 1
tagged with: java
has body: I would like to know how many client requests my CORBA server can handle at same time : Does the server creates a new thread for each new client request ? Is there any thread pool ? What is the default thread pool size ? What happens if we reach the max size ? Does the new threads wait in a queue ? What is the idle time for inactive threads (threads which have already been used for a client) in the pool ? Are we able configure those parameters (pool size &amp; idle time) ? I've done a lot of research but I didn't find real answers to those questions for the Sun/Oracle official CORBA implementation (JDK). In the Oracle Documentation (link) we can see this : -Djava.naming.factory.initial=com.sun.appserv.naming.S1ASCtxFactory -Dcom.sun.appserv.iiop.orbconnections=value => I am not sure about what really this parameter is, also this parameter may not be compatible with all JVMs, and its default value is "one". I know that for RMI there is a "sun.rmi.transport.tcp.maxConnectionThreads" parameter for changing default thread pool size (which is already "unlimited"). The inactive threads idle time is 1 minute... RMI is inspired by CORBA, so maybe Sun/Oracle put the same parameters for both of them ? Thanks
has answer: http://stackoverflow.com/a/26592189
tagged with: corba
type: Question
upvote count: 1

http://stackoverflow.com/a/65886908
upvote count: 2
answers question: http://stackoverflow.com/q/26017545
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/128560681
downvote count: 0
has body: Shortest code I could come up with is following Java &gt;=8 code: Files.walk(Paths.get(&quot;/my/base/dir/&quot;)) .sorted(Comparator.reverseOrder()) .map(Path::toFile) .filter(File::isDirectory) .forEach(File::delete); Add a second (or more) filter statement with whatever clause you need to include/exclude certain folders. File::delete should not delete folders with contents. Use at own risk.

http://stackoverflow.com/comment/40792628
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26023820
has text: Right on the different compilers. I probably shouldn't have tagged Gradle on this question, but rather Oracle Javac vs Eclipse compiler. The question is which one is "right"? Btw, I generate my Eclipse project using Gradle's `eclipse` target.
type: Comment

http://stackoverflow.com/a/25882871
answers question: http://stackoverflow.com/q/25882820
has body: public class Test{ public static void main(String[] args) { System.out.print("Enter your first name: "); Scanner keyboard = new Scanner(System.in); String firstName = keyboard.nextLine(); if (!(firstName.equalsIgnoreCase("mike") || (firstName.equalsIgnoreCase("diane")))) { System.out.println("derp"); } else System.out.println("true"); } } Output Enter your first name: diane true
score: 0
type: Answer

http://stackoverflow.com/a/25996018
downvote count: 0
answers question: http://stackoverflow.com/q/25995806
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25995806
has body: you are executing AsyncTask which run in background. put this code in side @Override protected void onPostExecute Object[] ObjectList = AidStr.toArray(); String[] StringArray = Arrays.copyOf(ObjectList,ObjectList.length,String[].class); /*One more method it is not working */ String[] stringArr = AidStr.toArray(new String[AidStr.size()]); Spinner dropdown = (Spinner)findViewById(R.id.spinner_tag); dropdown.setOnItemSelectedListener(this); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, StringArray); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dropdown.setAdapter(adapter);
type: AcceptedAnswer

deserialization
type: Tag
tags question: http://stackoverflow.com/q/26010179
tags question: http://stackoverflow.com/q/25910472
tags question: http://stackoverflow.com/q/25958044
tag name: deserialization
tags question: http://stackoverflow.com/q/25881694
tags question: http://stackoverflow.com/q/25926376
tags question: http://stackoverflow.com/q/25970634
tags question: http://stackoverflow.com/q/26014972
tags question: http://stackoverflow.com/q/25894625
tags question: http://stackoverflow.com/q/25881024

http://stackoverflow.com/comment/40682975
score: 0
type: QuestionComment
type: Comment
has text: Reading file from E makes me think you are reading from E:\ is this the case?
comment on: http://stackoverflow.com/q/25980887

http://stackoverflow.com/q/25928896
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/40590492
accepted answer: http://stackoverflow.com/a/25929074
tagged with: ternary-operator
possible better answer: http://stackoverflow.com/a/25929017
favorite count: 0
has answer: http://stackoverflow.com/a/25928996
has answer: http://stackoverflow.com/a/25929169
answer count: 5
has comment: http://stackoverflow.com/comment/40590929
linked to: http://stackoverflow.com/q/3882095
has answer: http://stackoverflow.com/a/25929074
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/3882095
downvote count: 0
tagged with: java
score: 16
has answer: http://stackoverflow.com/a/25929047
type: Question
has comment: http://stackoverflow.com/comment/40590524
has title: Why ternary operation gives nullpointer while its ifelse counterpart doesn't?
upvote count: 16
has body: I am getting NullPointerException in one instance below while its counterpart runs smooth. public static void main(String[] args){ System.out.println(withTernary(null, null)); //Null Pointer System.out.println(withIfElse(null, null)); //No Exception } private static Boolean withTernary(String val, Boolean defVal){ return val == null ? defVal : "true".equalsIgnoreCase(val); } private static Boolean withIfElse(String val, Boolean defVal){ if (val == null) return defVal; else return "true".equalsIgnoreCase(val); } Online version Online version with the lines in main reversed, which outputs null from withIfElse and then fails in withTernary. I am using following java version java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
has answer: http://stackoverflow.com/a/25929017

http://stackoverflow.com/q/25878744
has answer: http://stackoverflow.com/a/25878756
has answer: http://stackoverflow.com/a/25878909
type: AnsweredQuestion
tagged with: syntax
upvote count: 2
score: 0
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/25878763
type: Question
has answer: http://stackoverflow.com/a/25878763
has body: Whenever I try to to an else statement, Eclipse highlights the line and says that the "else" is a syntax error and to delete it. My code looks like this import java.util.Scanner; public class P4 { public static void main(String[] args) { // TODO Auto-generated method stub double grossSalary, interestIncome, capitalGains, totalIncome, adjustedIncome, totalTax, stateTax; int exemptions; Scanner input = new Scanner(System.in); System.out.print("Gross Salary: "); grossSalary = input.nextDouble(); System.out.print("Number of Exemptions: "); exemptions = input.nextInt(); System.out.print("Interest Income: "); interestIncome = input.nextDouble(); System.out.print("Capital Gains: "); capitalGains = input.nextDouble(); totalIncome = grossSalary + interestIncome + capitalGains; adjustedIncome = totalIncome - (exemptions * 1800.0); if ((adjustedIncome &gt;= 0.0 &amp;&amp; adjustedIncome &lt; 10000.0)); stateTax = adjustedIncome * .06; totalTax = 0.0 + stateTax; else if (adjustedIncome &gt;= 10000.0 &amp;&amp; adjustedIncome &lt; 25000.0); stateTax = adjustedIncome * .06; totalTax = (adjustedIncome * .15) + stateTax; else if (adjustedIncome &gt;= 25000.0 &amp;&amp; adjustedIncome &lt; 36000); stateTax = adjustedIncome * .06; totalTax = (adjustedIncome * .25) + stateTax; else (adjustedIncome &gt;= 36000.0); stateTax = adjustedIncome * .06; totalTax = (adjustedIncome * .28) + stateTax; System.out.printf("Total Income: $ %.2f", totalIncome); System.out.println(); System.out.printf("Adjusted Income: $ %.2f", adjustedIncome); System.out.println(); System.out.printf("Total Tax: $ %.2f", totalTax); System.out.println(); System.out.printf("State Tax: $ %.2f", stateTax); } } The else if statements are coming back as errors as well. I don't understand what's wrong with the statements, because even when I try to put an else directly after the if, it still says that theres a syntax error.
has answer: http://stackoverflow.com/a/25878784
tagged with: if-statement
has answer: http://stackoverflow.com/a/25878759
has answer: http://stackoverflow.com/a/25878764
has title: else if statement in java returning syntax error
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/25878775
accepted answer: http://stackoverflow.com/a/25878759

http://stackoverflow.com/comment/41156955
score: 0
type: AnswerComment
has text: i call the process in action class in a method,and i read the output of the command using readline and store it in a variable called line and do request.setattribute in the action class.
type: Comment
comment on: http://stackoverflow.com/a/26018919

http://stackoverflow.com/comment/40545195
score: 0
type: QuestionComment
has text: see [Java List ArrayList override equals method](http://javacodeimpl.blogspot.in/2014/01/java-listarraylist-override-contains.html#.VBpjsZazCKM) example
type: Comment
comment on: http://stackoverflow.com/q/25904181

http://stackoverflow.com/comment/40556451
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25907435
has text: You can try, but in my rendered markup there is no onclick option. Wait for a while, I will try your code. And could you say which wicket version do you use?

search-engine
type: Tag
tags question: http://stackoverflow.com/q/25998991
tag name: search-engine

http://stackoverflow.com/comment/40722798
score: 0
type: Comment
type: QuestionComment
has text: where are your setters?
comment on: http://stackoverflow.com/q/26002738

http://stackoverflow.com/comment/41907081
has text: Moreover I'd say that your best option is to test by stopping gracefully one of your instances, make the update, start it back and see if replication and gossip tend to work. Afterward it would be marvellous to share your results with us :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25973377
score: 1

http://stackoverflow.com/a/25979976
has comment: http://stackoverflow.com/comment/40684776
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40684525
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25979748
has comment: http://stackoverflow.com/comment/40685421
has comment: http://stackoverflow.com/comment/40685303
has body: There is nothing wrong with his teaching methods and with some further study I am sure you can figure it out. No one here is going to do it for you and I don't want to do your homework so I will ask the common question, what have you tried so far? I've given you one of the modified setters. Keep working, study your java better or you are going to have a hard time when it gets difficult. //Here is where you start public void setDenom(int x){ if(x &gt; 0){ denom = x; }else{ //throw an error } }
accepted answer of: http://stackoverflow.com/q/25979748

http://stackoverflow.com/comment/40557407
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25910497
type: AnswerComment
has text: it don't found with context "this" I changed "this" with "MainActivity.this" and i can compile it but I have the error that I post in the edit answer.

http://stackoverflow.com/q/25896044
has title: Eclipse could not write to ./launch
type: UnansweredQuestion
tagged with: remote-debugging
has comment: http://stackoverflow.com/comment/40531131
has comment: http://stackoverflow.com/comment/40530854
has comment: http://stackoverflow.com/comment/40530619
has comment: http://stackoverflow.com/comment/40530170
has comment: http://stackoverflow.com/comment/40530698
tagged with: java
has answer: http://stackoverflow.com/a/71037125
type: Question
has comment: http://stackoverflow.com/comment/40530368
has body: I have accidentally deleted ./metadata folder in eclipse. Now when i try reconfigure the project from workspace, things are fine and the project gets created with some old data about libraries. But when i try to create a new remote java application for debugging, i get the following error "Could not write file:/workspace/.metadata/.plugins/org.eclipse.debug.core/.launches" Can someone please tell me how do i rectify this error and start remote java debugging?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40530602
answer count: 3
has comment: http://stackoverflow.com/comment/40530636
score: 2
has answer: http://stackoverflow.com/a/75645380
has answer: http://stackoverflow.com/a/46135378
downvote count: 0
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/26003890
has answer: http://stackoverflow.com/a/26004964
accepted answer: http://stackoverflow.com/a/26004964
answer count: 1
has body: I have a SQL script with Insert statements (around 100 rows and might increase in the future) that I would like to execute using ActiveJDBC. Is there a way to do it?
tagged with: activejdbc
type: AnsweredQuestion
tagged with: java
has title: Loading large dataset using ActiveJDBC
type: Question
score: 0

http://stackoverflow.com/a/25948209
score: 1
accepted answer of: http://stackoverflow.com/q/25947849
downvote count: 0
answers question: http://stackoverflow.com/q/25947849
type: AcceptedAnswer
has body: Try to add been propertySourcesPlaceholderConfigurer in your configuration, @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } @PropertySource annotation does not automatically register a PropertySourcesPlaceholderConfigurer with Spring. Instead, the bean must be explicitly defined in the configuration to get the property resolution mechanism working.[reference] Read more about it in spring docs.
type: Answer
upvote count: 1

http://stackoverflow.com/q/26001806
upvote count: 1
accepted answer: http://stackoverflow.com/a/26001850
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
downvote count: 0
score: 1
has title: Safe API to transform HTML (Java)
favorite count: 0
has answer: http://stackoverflow.com/a/26001850
tagged with: http://stackoverflow.com/tag/html
has body: I'd like to take a web page and add some tags to its head. Specifically, a CSS link and a JavaScript link. I need to do this programatically for a wide variety of web pages. Now, I could hack this out with a regex or two, but I'd like to use something more robust. What's a good way to inject or transform HTML? I'm using Scala, but anything Java or JVM will work.
tagged with: scala

http://stackoverflow.com/comment/42255366
comment on: http://stackoverflow.com/q/25908124
type: Comment
type: QuestionComment
score: 0
has text: Thanks for all your suggestions; I never really resolved the problem but the project got shelved anyway. I did write a different simple consumer and it promptly received all the missing messages. As the consumer was for a Jira plugin, I can only guess that the plugin sdk or the Jira server was causing the problem.

http://stackoverflow.com/a/25893356
answers question: http://stackoverflow.com/q/25892978
score: 0
type: Answer
has body: If you want to print the presidents names and the president years sorted: List&lt;President&gt; list = new ArrayList&lt;President&gt;(); list.add(new President("Aguinaldo", 1)); list.add(new President("Marcos", 10)); list.add(new President("Quezon", 2)); Collections.sort(list, new President()); map.get("Philippines").put("presidents", list); for(Entry&lt;String, HashMap&lt;String, Object&gt;&gt; entry: map.getEntrySet()){ HasMap&lt;String, Object&gt; attributes = entry.getValue(); List&lt;President&gt; pList = (List&lt;President&gt;) attributes.get("presidents"); for(President p: pList) System.out.print(p.getPresName() + ", " + p.getYear() + " "); } Output is: "Aguinaldo, 1 Quezon, 2 Marcos, 10" You have to do the checks to be sure you are not getting a NPE (like, there is always a "presidents" key? and so on). In this way you have a Map which contains a Map which contains a List. It's a bit messy.. Why don't you use Java classes? public class State{ String name; String capital; List&lt;President&gt; presidents; public State(String name){ this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCapital() { return capital; } public void setCapital(String capital) { this.capital = capital; } public List&lt;String&gt; getPresidents() { return presidents; } } In your main: State philippines = new State("Philippines"); philippines.setCapital("Manila"); philippines.getPresidents().add(new President("Aguinaldo", 1)); philippines.getPresidents().add(new President("Marcos", 10)); philippines.getPresidents().add(new President("Quezon", 2)); Collections.sort(philippines.getPresidents(), new President()); for(President p: philippines.getPresidents()) System.out.print(p.getPresName()); And to store your states: Map&lt;String, State&gt; states = new HashMap&lt;String, State&gt;(); //create philippines states.add("Philippines", philippines); Collections.sort(states.get("Philippines").getPresidents(), new P…

http://stackoverflow.com/a/25966680
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25966585
has body: You can use SimpleDateFormat http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html Or if you are willing to add a dependency on apache commons lang, use DateUtils: http://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/time/DateUtils.html But in this case, apache's lib probably won't add a lot of value if this is all you use it for. Here is an example of formatting the date: java.util.Date d = new java.util.Date(); java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("HH:mm"); String result = sdf.format(d); BTW, if your instance is a calendar, just use the getTime() method to get a date instance.
answers question: http://stackoverflow.com/q/25966585
has comment: http://stackoverflow.com/comment/40691512

http://stackoverflow.com/q/25893524
has answer: http://stackoverflow.com/a/25893755
accepted answer: http://stackoverflow.com/a/25893755
tagged with: .class-file
type: Question
has title: How can I change all .class files in a jar(or folder) to .java (or .txt) at once?
has comment: http://stackoverflow.com/comment/40528707
tagged with: jar
tagged with: decompiling
tagged with: github
score: 0
answer count: 1
has body: I have always used this to decompile any .class file to readable format. However, now I need to change around 30-40 .class files to readable format to push to my github. How may I change all the .class files to readable (.java or .txt) at once?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40529320
type: AnswerComment
has text: Yes it will. Every browser sends headers that identify it. So when you are visiting/parsing a page by a bot (machine) you have to imitate the same behavor because some servers don't permit the absence of those headers.
type: Comment
comment on: http://stackoverflow.com/a/25882937
score: 0

http://stackoverflow.com/comment/53971457
has text: I have a similar bug, I'm using JBoss 6.1 GA, with the default hornetQ version, that is 2.2.5.Final. the <JBOSS>\server\default\data\hornetq\largemessages grows in time. The client is in the same ear of the sender.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25892727
type: Comment

http://stackoverflow.com/q/25966005
has body: I'm trying to design a simple app that scrolls horizontally that is populated with image buttons. I'm able to populate the list but only if I had 6 buttons manually. Isn't there a way I could do this with an array and a loop? Its feels clunky using btn, btn1, btn2 ect. my linearList is referenced as mLinearList I haven't set onClickListeners yet. private void fillPaintingGallery() { ImageButton btn = new ImageButton(this); btn.setImageDrawable(getResources().getDrawable(R.drawable.painting1)); mLinearList.addView(btn); ImageButton btn1 = new ImageButton(this); btn1.setImageDrawable(getResources().getDrawable(R.drawable.painting2)); btn1.setContentDescription(RenaissanceDatabase.description[1]); mLinearList.addView(btn1); ImageButton btn2 = new ImageButton(this); btn2.setImageDrawable(getResources().getDrawable(R.drawable.painting3)); btn2.setContentDescription(RenaissanceDatabase.description[2]); mLinearList.addView(btn2); ImageButton btn3 = new ImageButton(this); btn3.setImageDrawable(getResources().getDrawable(R.drawable.painting4)); btn3.setContentDescription(RenaissanceDatabase.description[3]); mLinearList.addView(btn3); ImageButton btn4 = new ImageButton(this); btn4.setImageDrawable(getResources().getDrawable(R.drawable.painting5)); btn4.setContentDescription(RenaissanceDatabase.description[4]); mLinearList.addView(btn4); ImageButton btn5 = new ImageButton(this); btn5.setImageDrawable(getResources().getDrawable(R.drawable.painting6)); btn5.setContentDescription(RenaissanceDatabase.description[5]); mLinearList.addView(btn5); } Thanks
has answer: http://stackoverflow.com/a/25966045
tagged with: android-linearlayout
type: UnansweredQuestion
tagged with: imagebutton
has title: Populate a linear layout with custom class objects
type: Question
answer count: 2
tagged with: android
tagged with: scrollview
has answer: http://stackoverflow.com/a/25966999
score: 0
tagged with: java

mysql
tags question: http://stackoverflow.com/q/25964656
tags question: http://stackoverflow.com/q/25997991
tags question: http://stackoverflow.com/q/25963133
tags question: http://stackoverflow.com/q/26022654
tags question: http://stackoverflow.com/q/26024939
tags question: http://stackoverflow.com/q/25992471
tags question: http://stackoverflow.com/q/25978781
tags question: http://stackoverflow.com/q/25935810
tags question: http://stackoverflow.com/q/25990658
tags question: http://stackoverflow.com/q/25978233
tags question: http://stackoverflow.com/q/25883403
tags question: http://stackoverflow.com/q/25929301
tags question: http://stackoverflow.com/q/25884262
tags question: http://stackoverflow.com/q/25969108
tag name: mysql
tags question: http://stackoverflow.com/q/25903148
tags question: http://stackoverflow.com/q/25959240
tags question: http://stackoverflow.com/q/25961528
tags question: http://stackoverflow.com/q/26011804
tags question: http://stackoverflow.com/q/25889131
tags question: http://stackoverflow.com/q/26032198
tags question: http://stackoverflow.com/q/25879523
tags question: http://stackoverflow.com/q/25957566
tags question: http://stackoverflow.com/q/25892923
tags question: http://stackoverflow.com/q/25967776
tags question: http://stackoverflow.com/q/25961555
tags question: http://stackoverflow.com/q/25918416
tags question: http://stackoverflow.com/q/25908262
tags question: http://stackoverflow.com/q/25912693
tags question: http://stackoverflow.com/q/25932610
tags question: http://stackoverflow.com/q/25885330
tags question: http://stackoverflow.com/q/25901902
tags question: http://stackoverflow.com/q/25958293
tags question: http://stackoverflow.com/q/25907742
tags question: http://stackoverflow.com/q/25973669
tags question: http://stackoverflow.com/q/25909838
tags question: http://stackoverflow.com/q/25875396
tags question: http://stackoverflow.com/q/25949867
tags question: http://stackoverflow.com/q/25965446
tags question: http://stackoverflow.com/q/26004708
tags question: http://stackoverflow.com/q/25887967
tags question: http://stackoverflow.com/q/25986482
tags question: http://stackoverflow.com/q/25930191
tags question: http://stackoverflow.com/q/26021400
tags question: http://stackoverflow.com/q/25927093
tags question: http://stackoverflow.com/q/26008986
tags question: http://stackoverflow.com/q/25905835
tags question: http://stackoverflow.com/q/25984576
type: Tag
tags question: http://stackoverflow.com/q/25988765
tags question: http://stackoverflow.com/q/25950418
tags question: http://stackoverflow.com/q/25934666
tags question: http://stackoverflow.com/q/25932971
tags question: http://stackoverflow.com/q/25921275
tags question: http://stackoverflow.com/q/25924366
tags question: http://stackoverflow.com/q/25923696
tags question: http://stackoverflow.com/q/25939370
tags question: http://stackoverflow.com/q/25901656
tags question: http://stackoverflow.com/q/25979642
tags question: http://stackoverflow.com/q/25933361
tags question: http://stackoverflow.com/q/26008081
tags question: http://stackoverflow.com/q/25918569
tags question: http://stackoverflow.com/q/25880891
tags question: http://stackoverflow.com/q/25994898
tags question: http://stackoverflow.com/q/25988774
tags question: http://stackoverflow.com/q/25888240
tags question: http://stackoverflow.com/q/25990571
tags question: http://stackoverflow.com/q/25944505
tags question: http://stackoverflow.com/q/25908798
tags question: http://stackoverflow.com/q/25961883
tags question: http://stackoverflow.com/q/25882978
tags question: http://stackoverflow.com/q/25970817
tags question: http://stackoverflow.com/q/25889354
tags question: http://stackoverflow.com/q/25994043
tags question: http://stackoverflow.com/q/25969716
tags question: http://stackoverflow.com/q/25989850
tags question: http://stackoverflow.com/q/25994701
tags question: http://stackoverflow.com/q/25928628
tags question: http://stackoverflow.com/q/25925672

http://stackoverflow.com/q/25930426
has comment: http://stackoverflow.com/comment/40593272
has body: Is there any possibility to hide/remove the buttons of the org.eclipse.swt.widgets.Spinner control without completely reimplementing it? The easiest way I can think of would be a style-Flag but I was not able to find one which influences the buttons. Maybe it is not possible at all since the OS manages the implementation of those controls.
tagged with: swt
type: AnsweredQuestion
tagged with: java
has title: SWT Spinner - Hiding Buttons
type: Question
has comment: http://stackoverflow.com/comment/40593186
has answer: http://stackoverflow.com/a/25930787
accepted answer: http://stackoverflow.com/a/25930787
score: 0
answer count: 1
tagged with: spinner
has comment: http://stackoverflow.com/comment/40592842

http://stackoverflow.com/q/25919954
favorite count: 0
duplicate of: http://stackoverflow.com/q/2134784
accepted answer: http://stackoverflow.com/a/25919969
has comment: http://stackoverflow.com/comment/40574191
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40575257
linked to: http://stackoverflow.com/q/12524322
downvote count: 1
type: Question
score: 3
has title: Class name same as filename in java?
has comment: http://stackoverflow.com/comment/40575484
has answer: http://stackoverflow.com/a/25919969
upvote count: 4
has answer: http://stackoverflow.com/a/25920018
answer count: 2
has body: in java, filename should be same as that of main class. It is the way of telling compiler that this is the entry point for you. but why this thing works: class xyz{ public static void main(String[] args){ System.out.println("a"); } } even when saved with different filename. And why this thing does not when saved with diffrent filename: public class xyz{ public static void main(String[] args){ System.out.println("a"); } }
linked to: http://stackoverflow.com/q/2134784
has comment: http://stackoverflow.com/comment/40574227
possible better answer: http://stackoverflow.com/a/25920018

http://stackoverflow.com/a/25883360
downvote count: 0
type: Answer
has body: I think that in your case you should use Android Service or Intent Service. Link:http://developer.android.com/guide/components/services.html You shouldn't use Async for long heavy operations. In my case I used Intent Service with new Runnables in it and it worked. If you have more questions, please ask.
answers question: http://stackoverflow.com/q/25882768
score: 1
upvote count: 1

http://stackoverflow.com/comment/40744393
type: Comment
type: QuestionComment
has text: This is personal understanding, as this says If this & this NOT and show clear meaning shows by false
score: 0
comment on: http://stackoverflow.com/q/26014694

http://stackoverflow.com/a/26452582
downvote count: 1
answers question: http://stackoverflow.com/q/25945439
type: Answer
has body: You can use setBounds() method as: Frame f=new Frame(); f.setLayout(null); Button b=new Button("Dummy"); //setBounds() methods accepts 4 // integer parameters /* 1. Location on x axis 2. Location on y axis 3. Width 4. Height */ b.setBounds(20,30,50,30); f.add(b); Thats how you set size for a button There are more ways to specify size but i use this one Hope this will help you....
upvote count: 2
score: 1

http://stackoverflow.com/comment/40495857
type: QuestionComment
has text: I apologize if I sounded vague at all. What I'm trying to do is make each task perform some sort of computation in a scheduled manner, concurrently, paralleled, and finally nested. String is what each task will be holding. "How to Instantiate them and reference each other? " Yes!.....
comment on: http://stackoverflow.com/q/25876679
score: 0
type: Comment

http://stackoverflow.com/q/25898812
upvote count: 1
type: Question
tagged with: jakarta-ee
tagged with: servlets
answer count: 2
has title: Servlet resource is not available HTTP 404
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/40535242
favorite count: 0
has body: I got a servlet, which I'm trying to get to through a hyperlink. I checked the Servlet's folder availability by a hyperlink to JSP file on that folder. I also checked the Servlet itself when asking it on the hyperlink with the .java extension, and I got the code of that Servlet on the browser. When I'm trying to connect to that Servlet either to doGet or doPost, I'm getting a 404 HTTP error, the resource is not available. Web.xml: Archetype Created Web Application TestServlet controllers.TestServlet TestServlet /controllers /views/welcomePage.jsp What is wrong?
has answer: http://stackoverflow.com/a/25898881
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25900793
score: 1
tagged with: java

http://stackoverflow.com/comment/40741890
has text: I use create-drop in test database, also I test insert and update commands, with readonly it will be bad result.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25998928
score: 0

http://stackoverflow.com/comment/40657032
score: 2
has text: System properties and environment variables are different things. While it's true the subprocess can read the properties out of the environment variable and set them, libraries (including the standard library) generally only check properties once, when they're first used, and store the result in a static field. Thus it's important to pass them on the command line, not through environment variables.
comment on: http://stackoverflow.com/a/25966226
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26005857
tagged with: java
has answer: http://stackoverflow.com/a/26005892
answer count: 1
has body: According to the gradle user guide: http://www.gradle.org/docs/current/userguide/userguide.pdf top of page 41 "Gradle expects to find your production source code under src/main/java". How can I customize gradle to use with my current and different directory structure?
favorite count: 0
has title: Changing your production source code location
accepted answer: http://stackoverflow.com/a/26005892
type: AnsweredQuestion
score: 0
upvote count: 1
tagged with: gradle
downvote count: 1
type: Question

http://stackoverflow.com/q/26023653
has comment: http://stackoverflow.com/comment/40788676
type: Question
tagged with: tiff
has body: I'm trying to read in a 16-bit TIFF image (grayscale) into Java using the Apache Commons Imaging library. When I read it in using the following code: TiffImageParser tip = new TiffImageParser(); BufferedImage img = tip.getBufferedImage(new File("img.tif"), null); The resulting BufferedImage is of type TYPE_INT_RGB, not the expected TYPE_USHORT_GRAY. Is this due to the TIFFImageParser not having the correct decoder (i.e. a Apache Commons problem), or is it because I haven't set the correct parameters? N.B. The image in question was created in Matlab using the following code: img = uint16(rand(200,200) * 65535); imwrite(img, 'img.tif');
has comment: http://stackoverflow.com/comment/40774708
has title: Read Grayscale 16-bit TIFF using Apache Commons Imaging (Java)
tagged with: apache
downvote count: 0
has comment: http://stackoverflow.com/comment/100730647
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: javax.imageio
has comment: http://stackoverflow.com/comment/45416468
has comment: http://stackoverflow.com/comment/45432218
score: 1
tagged with: java

http://stackoverflow.com/a/25906808
has body: You need to include the jersey-client.jar file for the same You can download it from here
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25906182
has comment: http://stackoverflow.com/comment/40596616
downvote count: 0
type: Answer

http://stackoverflow.com/a/27903352
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25908719
downvote count: 0
has body: You can do this to see only JDK exception types: Open the "Quick Type Hierarchy" (CTRL - T on the class name) and use the name filter. Then type *java. and only exceptions of the java package will be shown.
has comment: http://stackoverflow.com/comment/44281841

google-fusion-tables
type: Tag
tags question: http://stackoverflow.com/q/25892318
tag name: google-fusion-tables

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/25946952
tags question: http://stackoverflow.com/q/25883941
tags question: http://stackoverflow.com/q/25936248
tags question: http://stackoverflow.com/q/25998649
type: Tag
tag name: pdf
tags question: http://stackoverflow.com/q/25946093
tags question: http://stackoverflow.com/q/25904721
tags question: http://stackoverflow.com/q/25882842
tags question: http://stackoverflow.com/q/25956454
tags question: http://stackoverflow.com/q/25889780
tags question: http://stackoverflow.com/q/25938482
tags question: http://stackoverflow.com/q/25983230

http://stackoverflow.com/a/25951800
has comment: http://stackoverflow.com/comment/103889159
type: Answer
answers question: http://stackoverflow.com/q/25951019
has comment: http://stackoverflow.com/comment/66039829
upvote count: 10
score: 10
has comment: http://stackoverflow.com/comment/63963581
type: AcceptedAnswer
downvote count: 0
has body: It turns out I had a library problem. I had had imported all the jars in the .lib directory from jfreechart. In reality only two were needed and some unnecessary ones were labeled swt and experimental. Once I removed all the ones that were not needed, did a clean, and rebuilt, everything worked fine. Oddly, changing the order of the jfreechart library (which included the conflicting jars) to the bottom did not help, the extra jars had to be removed. Not a jfreechart issue, obviously my own library import issue. If you run into this I suggest you try to remove some of the libraries that may be conflicting, then clean, build, and run again. Thanks to Hovercraft Full Of Eels and everyone else who responded for helping me out.
accepted answer of: http://stackoverflow.com/q/25951019

http://stackoverflow.com/comment/40643523
type: Comment
comment on: http://stackoverflow.com/q/25959518
type: QuestionComment
has text: There is nothing called `element is pointing to memory block of "coin" variable` in Java!!! You have `coin` object of couple class and it'll definitely work like a charm!
score: 0

http://stackoverflow.com/a/26063096
downvote count: 0
has body: Once the weaving has been done (I presume you are doing compile time weaving?) you could actually just strip out the annotations. They were only needed during the matching/weaving stage, they are not typically consulted again (e.g. at runtime). You could write a simple Asm visitor that stripped out any in the org.aspectj package.
score: 1
answers question: http://stackoverflow.com/q/26033109
upvote count: 1
type: Answer

http://stackoverflow.com/a/25965979
answers question: http://stackoverflow.com/q/25965929
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25965929
has body: For any non-null 'str' while(!str.equals("yes")||!str.equals("no")) will always be true. Instead make it while(!str.equals("yes") &amp;&amp; !str.equals("no"))

http://stackoverflow.com/q/26007871
upvote count: 0
has comment: http://stackoverflow.com/comment/40732341
tagged with: user-interface
has title: How do I add an image to JPanel using imageicon (Java GUI)?
favorite count: 0
has comment: http://stackoverflow.com/comment/41132959
tagged with: imageicon
type: Question
score: -1
answer count: 2
tagged with: embedded-resource
linked to: http://stackoverflow.com/q/26210236
tagged with: swing
downvote count: 1
has body: I looked all over the place but I am still stuck on how directory works to find the image to put onto the JPanel. Where is the image supposed to be? I clicked on properties for my image and it shows Location: C:\Users\Joseph\Pictures\Background and the picture's name is random.jpg. I am trying to add an image to a tab using tabbedPane. Here is what I have so far, and I am not able to do it. JPanel flPanel = new JPanel(); flPanel.setLayout(new FlowLayout()); ImageIcon image = new ImageIcon(getClass().getResource("")); // Tried /Users/Joseph/Pictures/Background/random.jpg and doesn't work JLabel j1 = new JLabel(image); flPanel.add(j1); tabbedPane.add("Tab 2", flPanel); Is the picture supposed to be in the same package file as the project? Or is it supposed to be in the source file to be able to just do "random.jpg"?
has answer: http://stackoverflow.com/a/26008010
has comment: http://stackoverflow.com/comment/40737162
linked to: http://stackoverflow.com/q/18768861
has answer: http://stackoverflow.com/a/26007910
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12266761
linked to: http://stackoverflow.com/q/2458305

http://stackoverflow.com/q/25953687
upvote count: 1
tagged with: eclipse
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
has title: NullPointerException with ListView
score: 0
has comment: http://stackoverflow.com/comment/40632992
answer count: 1
has answer: http://stackoverflow.com/a/25953830
favorite count: 0
has body: I am playing around with using a ListView with an Navigation Drawer. Eclipse does not give me any errors but when i start the code in the emulator it says: "Unfortunately, DrunKingz has stopped." MainActivity.java : package de.pascalborker.drunkingz; import android.app.ListActivity; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class MainActivity extends ListActivity implements OnClickListener{ private DrawerLayout DrawerLayout; private ActionBarDrawerToggle ActionBarDrawerToggle; public ListView drawerlist; public String[] listentext = {"DrunKingz","Songs","Kontakt"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_main); DrawerLayout = (DrawerLayout) findViewById(R.id.dlDrawerLayout); ActionBarDrawerToggle = new ActionBarDrawerToggle(this, DrawerLayout, R.drawable.icon_drawer, R.string.open, R.string.close); DrawerLayout.setDrawerListener(ActionBarDrawerToggle); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); // ListView // ------ // ------ drawerlist = (ListView) findViewById(R.id.drawerliste); ArrayAdapter&lt;String&gt; drawerlistadapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, listentext); drawerlist.setAdapter(drawerlistadapter); drawerlist.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { switch (drawerlist.getPositionForView(view)) { case 0: { Toast.makeText(getApplicationContext(), "DrunKingz…
accepted answer: http://stackoverflow.com/a/25953830
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40633325

unicode
tags question: http://stackoverflow.com/q/26026561
tags question: http://stackoverflow.com/q/25925490
tag name: unicode
type: Tag
tags question: http://stackoverflow.com/q/25897932
tags question: http://stackoverflow.com/q/25924603
tags question: http://stackoverflow.com/q/25992431
tags question: http://stackoverflow.com/q/25994882

http://stackoverflow.com/a/25935582
score: 22
has comment: http://stackoverflow.com/comment/125224125
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25934678
has body: The first parameters that are given to the LinearGradient constructor are the coordinates of the start- and end point of the gradient axis, respectively. This means that you can achieve a "rotated" gradient simply by passing in an appropriately rotated axis. In the simplest form, for the example that you described, you can use the following pattern: double angleInRadians = Math.toRadians(45); double length = 100; double endX = Math.cos(angleInRadians) * length; double endY = Math.sin(angleInRadians) * length; LinearGradient lg = new LinearGradient(0, 0, endX, endY, ...); This will result in a gradient rotated by 45 degrees. The fixed values here will affect the final appearance of the gradient, together with the other parameters. Referring to your example, this gradient with the same "wave length" as before (namely 100), and start with the same color at the upper left corner (i.e. Color.BLACK will be at coordinates (0,0)).
answers question: http://stackoverflow.com/q/25934678
type: AcceptedAnswer
upvote count: 23
has comment: http://stackoverflow.com/comment/40602062

http://stackoverflow.com/q/25879171
has body: I'm sorry; I don't like asking "why am I getting exception?" questions on StackOverflow (bit ironic now that I think of it...), but I can't figure out the cause of this exception! I've searched for a solution, but those that popped up were either for a subtly different exception, when people were trying to access a Transferrable outside of an event handler, or not ever answered at all. I'm trying to do this right inside the DropTargetListener#drop(DropTargetListener) method. I'm testing this by dragging a PNG from the same drive that the program is running on, which makes me think that the data is readily available. My relevant code and the resulting exception are below: Code (shortened for brevity, line numbers in comments, followed by =&gt; if it's an error line) // package declaration // imports /*45 */ public class BHFileChooser extends JComponent implements DropTargetListener /*46 */ { // object declaration ... // initialization methods ... /*186*/ @Override /*187*/ public void dragEnter(DropTargetDragEvent dtde) /*188*/ { /*189*/ setState(State.EVALUATING); /*190*/ setState(canAccept(dtde.getTransferable()) ? State.EVALUATED_ACCEPTABLE : State.EVALUATED_UNACCEPTABLE); /*191*/ validate(); /*192*/ } /*193*/ /*194*/ @Override /*195*/ public void dragExit(DropTargetEvent dte) /*196*/ { /*197*/ setState(State.WAITING); /*198*/ validate(); /*199*/ } /*200*/ /*201*/ @Override public void dragOver(DropTargetDragEvent dtde){} // unused for now /*202*/ /*203*/ @Override /*204*/ public void dropActionChanged(DropTargetDragEvent dtde) /*205*/ { /*206*/ userAction = dtde.getDropAction(); /*207*/ validate(); /*208*/ } /*209*/ /*210*/ @Override /*211*/ public void drop(DropTargetDropEvent dtde) /*212*/ { /*213*/ setState(State.WAITING); // I use a finite-state machine to keep track of what's happening /*214*/ setState(State.EVALUATING); /*215*/ Transferable t = dtde.getTransferable(); /*216*/ try /*217*/ { /*218 =&gt;*/ if (canAccept(t)) /*219*/ try /*220*/ { /*221*/ setStat…
score: 4
accepted answer: http://stackoverflow.com/a/25879332
tagged with: java
upvote count: 4
answer count: 2
downvote count: 0
has title: Why am I getting an InvalidDnDOperationException?
possible better answer: http://stackoverflow.com/a/41943756
type: Question
has answer: http://stackoverflow.com/a/41943756
tagged with: exception
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25879332
favorite count: 0
tagged with: drag-and-drop
tagged with: swing

http://stackoverflow.com/comment/40566638
type: Comment
comment on: http://stackoverflow.com/a/25910543
has text: OK, I got it. I actually wanted to call generateConnectedPatterns() by dynamically creating objects something like: generateConnectedPatterns("Test1", mayamalavagowla.arohaObj.new MoorchanInnerClass("S1,,R2,,G3",""), mayamalavagowla.arohaObj.new MoorchanInnerClass("D2,,P1,"")); I will now create ArrayList in calling portion and then pass that array list
score: 0
type: AnswerComment

http://stackoverflow.com/a/26002480
answers question: http://stackoverflow.com/q/26002419
has body: The problem is how do I get the applications context within a single class? From Android Docs: There is normally no need to subclass Application. In most situation, static singletons can provide the same functionality in a more modular way. If your singleton needs a global context (for example to register broadcast receivers), the function to retrieve it can be given a Context which internally uses Context.getApplicationContext() when first constructing the singleton. Create your singleton like this: // ... private Context mAppContext = null; private static MySingleton mSingleton = null; // ... private MySingleton(Context context) { mAppContext = context; // ... other initialization } public static MySingleton get(Context context) { if (mSingleton == null) { /* * Get the global application context since this is an * application-wide singleton */ mSingleton = new MySingleton( context.getApplicationContext()); } return mSingleton; } The each time you obtain your singleton from any activity, you have access to the global application context. You can use it for your creation of files within your singleton like: public void createFile(String filename) { File file = new File(mAppContext.getFilesDir(), filename); } Or you can use the other ways mentioned here
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40722577
has comment: http://stackoverflow.com/comment/40722547
has comment: http://stackoverflow.com/comment/40725204
type: Answer
has comment: http://stackoverflow.com/comment/40726380
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26002419
has comment: http://stackoverflow.com/comment/40722680

http://stackoverflow.com/comment/40802759
type: QuestionComment
has text: Did you 5 mods even read the question? @Yogi is asking for something different to the question you linked to. Please moderate properly or don't moderate at all.
comment on: http://stackoverflow.com/q/26030886
score: 0
type: Comment

http://stackoverflow.com/q/25921322
tagged with: java
type: Question
has title: Unlimited interval for CountDownTimer
has comment: http://stackoverflow.com/comment/40577732
downvote count: 0
has comment: http://stackoverflow.com/comment/40577599
tagged with: android
has comment: http://stackoverflow.com/comment/40576998
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25921890
upvote count: 1
has body: in this below simple code i want to set unlimited interval for CountDownTimer. i can not find any document for this action. public class MyCountDownTimer extends CountDownTimer { public MyCountDownTimer(long startTime, long interval) { super(startTime, interval); } @Override public void onFinish() { countDownTimer.cancel(); timerHasStarted = false; } @Override public void onTick(long millisUntilFinished) { Random rand = new Random(); int rnd = rand.nextInt(1000000000); text.setText("" + rnd); } } i want to stop that by click on button to finish.
score: 1

http://stackoverflow.com/comment/40750930
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26001688
has text: **claz.org is just a random mirror which host apache libraries!** LOL! go through the stacktrace you can definitely find a clue about what cause the error. If not please post the stacktrace here.
score: 0

http://stackoverflow.com/comment/40767322
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26025286
type: Comment
has text: Then you should change the type to be `Address` instead of `Set<Address>`, since one-to-ones can have only a single associated value. But based on your comments (e.g. "I want to load all address locations for that member."), I don't believe that's actually what you mean, even though you say it is.

http://stackoverflow.com/q/25886658
has answer: http://stackoverflow.com/a/25886743
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25886752
tagged with: tomcat
score: 0
has answer: http://stackoverflow.com/a/25886758
answer count: 4
has body: I had previously deployed a WAR file in tomcat installed on my local computer and it worked really fine. I am deploying the same WAR file on tomcat installed in my windows 2003 server and i get the following error. Below is my logfile. INFO: Deploying web application archive C:\ProgramFiles\ApacheSoftwareFoundatio\Tomcat 7.0\webapps\xxxxxxx.war Sep 17, 2014 9:40:33 AM org.apache.catalina.startup.ContextConfig beforeStart SEVERE: Exception fixing docBase for context [/dstvNickGateway] java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\dstvNickGateway.war (The process cannot access the file because it is being used by another process) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) at java.util.jar.JarFile.&lt;init&gt;(Unknown Source) at java.util.jar.JarFile.&lt;init&gt;(Unknown Source) at sun.net.www.protocol.jar.URLJarFile.&lt;init&gt;(Unknown Source) at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source) at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source) at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source) at sun.net.www.protocol.jar.JarURLConnection.getJarFile(Unknown Source) at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:111) at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:719) at org.apache.catalina.startup.ContextConfig.beforeStart(ContextConfig.java:847) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:373) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.j…
type: UnansweredQuestion
has title: Error Deploying a WAR file in tomcat 7.0.50
tagged with: maven
has answer: http://stackoverflow.com/a/44010928
has comment: http://stackoverflow.com/comment/40513164

http://stackoverflow.com/q/26029780
type: Question
answer count: 2
downvote count: 5
has comment: http://stackoverflow.com/comment/40772660
has answer: http://stackoverflow.com/a/26029834
favorite count: 0
upvote count: 2
score: -3
has body: Please explain the following situation: double d3=(double) 1; Double d4=new Double(1); System.out.println(d4==d3); // true System.out.println(d4.equals(d3)) // true Why do both of these print true?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26029817
has comment: http://stackoverflow.com/comment/40772235
accepted answer: http://stackoverflow.com/a/26029834
has answer: http://stackoverflow.com/a/26029817
tagged with: java
has comment: http://stackoverflow.com/comment/40772264
has title: Why is a double "==" and "equals" to a Double?
tagged with: equality
has comment: http://stackoverflow.com/comment/40772227

http://stackoverflow.com/a/25962555
has comment: http://stackoverflow.com/comment/40649902
answers question: http://stackoverflow.com/q/25962437
has comment: http://stackoverflow.com/comment/40654290
has body: As far as I can see, logic is fine, although I would check in a different way, quite more readable. int n = 0; //number of equal sides if(a==b) n++; if(a==c) n++; if(b==c) n++; //Display seems like a class, but is a variable, should start with lower case and have camel notation such as displayTextView switch(n) { case 0: Display.setText("Scalen"); break; case 1: Display.setText("Isosceles"); break; case 2: case 3: Display.setText("Equilateral"); break; } As far as the error it shows, could you post the log?
has comment: http://stackoverflow.com/comment/40650040
has comment: http://stackoverflow.com/comment/40649687
has comment: http://stackoverflow.com/comment/40649536
has comment: http://stackoverflow.com/comment/40653328
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40649517
has comment: http://stackoverflow.com/comment/40649846

http://stackoverflow.com/comment/40652041
score: 0
type: Comment
has text: Hmm, I just took the code from your login class and used it as the panel..It shows when you select login from the menu. What is your login panel supposed to display? Or are you referring to a panel when you're actually logged in?
comment on: http://stackoverflow.com/a/25963434
type: AnswerComment

http://stackoverflow.com/comment/40774641
type: AnswerComment
has text: Thanks for your help, but i got an error where `new Builder(this)` - error is `The constructor AlertDialog.Builder(new View.OnClickListener(){}) is undefined`
type: Comment
comment on: http://stackoverflow.com/a/26030549
score: 0

http://stackoverflow.com/comment/87482694
comment on: http://stackoverflow.com/a/26019243
type: Comment
has text: Exactly. Always use the built-in tools until your careful instrumentation shows this is the crux of your performance issues.
type: AnswerComment
score: 4

http://stackoverflow.com/comment/40684425
has text: When i use it, its open new frame, so actionListner its work, but i still dont know how to invoke JPanel in my main class. Can you explain how i should do it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25981506
type: Comment

http://stackoverflow.com/q/25938189
has comment: http://stackoverflow.com/comment/40765085
favorite count: 0
has body: I'm trying to create an Axis2 web service on OS X Yosemite using Eclipse Luna (64bit) with a running Tomcat v7.0 server. When i go to New > Dynamic web project > Modify (under Configuration), Axis2 web services is not in the list of facets. I have followed this tutorial but I'm stuck at this level here: How can I solve this?
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
answer count: 0
score: 1
tagged with: java
tagged with: apache-axis
tagged with: eclipse
type: Question
has title: Can't find Axis 2 Web services facet
downvote count: 0
tagged with: android

http://stackoverflow.com/q/25943647
accepted answer: http://stackoverflow.com/a/25966155
has comment: http://stackoverflow.com/comment/40634597
type: Question
has body: So the file image.png is getting overwritten every 2 seconds. I want an applet to display the image in a browser. It does display the image, but the problem is the image never gets updated in the applet after the image file was updated on the computer. What am I doing wrong? import java.awt.*; import java.util.Timer; import java.util.TimerTask; import javax.swing.JApplet; public class ImageUpdate extends JApplet { Image picture; Timer timer = new Timer(); int delay = 2000; //2 second int period = 4000; //4 seconds public void init() { picture = getImage(getDocumentBase(),"image.png"); timer.scheduleAtFixedRate(new TimerTask() { public void run() { repaint(); System.out.println("image updated"); } }, delay, period); } public void paint(Graphics g) { g.drawImage(picture, 0,0, this); } public void update(Graphics g) { super.paint(g); } }
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/40618476
score: 0
answer count: 1
has title: Image not updating on repaint
has comment: http://stackoverflow.com/comment/40634786
tagged with: japplet
has answer: http://stackoverflow.com/a/25966155
has comment: http://stackoverflow.com/comment/40634591
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40617148

http://stackoverflow.com/comment/40602314
type: Comment
type: QuestionComment
has text: The issue is that there is another article (http://www.objectmentor.com/resources/articles/granularity.pdf) which describes exactly same six packaging principles. But it says: in this article we will ...refer to these higher order granules as “packages”. ...The term “package” is common in Ada and Java circles. In those languages a package is used to represent a logical grouping of declarations that can be imported into other programs. So the question is: **can we apply REP, CRP, CCP ... principles to java NS packages as well as to java archives (JARs)**? Thanks
comment on: http://stackoverflow.com/q/25932857
score: 0

http://stackoverflow.com/q/26016802
type: Question
score: 0
linked to: http://stackoverflow.com/q/1624084
has comment: http://stackoverflow.com/comment/44396329
answer count: 1
has body: Following sample is just to explain the my implementation, please have a look at and let me know if i can get any answers for this I have created a annotation Dispenser @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Dispenser { } I have two classes of type dispenser above Milk Dispenser -- Drink Dispenser -- @Dispenser class MilkDispenser{ public void releaseDrink() } @Dispenser class DrinkDispenser{ public void releaseDrink() } and i have a class DispenserProcessor extends AbstractProcessor Everything looks fine until unless i found a better implmentation of DispenserProcessor from the client they have their own implementation I cannot copy their code so i need a way switch to that dispenserProcessor developed by the client instead of mine Question, is there any way @MyDispenser can extend their @ClientDispenser
has answer: http://stackoverflow.com/a/27971346
tagged with: annotations
has title: Change annotation processor dynamically
type: AnsweredQuestion
tagged with: annotation-processing
tagged with: java
accepted answer: http://stackoverflow.com/a/27971346

http://stackoverflow.com/q/25903776
has answer: http://stackoverflow.com/a/25904768
has comment: http://stackoverflow.com/comment/40545477
has comment: http://stackoverflow.com/comment/40545744
tagged with: java
has answer: http://stackoverflow.com/a/37037278
type: Question
has body: I have one or more ByteBuffers containing parts of a single message. Now I want to read this message but I do not want to copy N ByteBuffer into a single one. My parser expects a single ByteBuffer with the complete message, but my message is divided into N ByteBuffers. Is there a way to combine these N ByteBuffers into a single one without byte copying? I imagined some kind of smart implementation of the ByteBuffer abstract class that is backed up by these ByteBuffer under the hood and just adjust the pointers and delegates to the correct ByteBuffer. In case you are curious why I need that, check the protocol below from BM&amp;F/Bovespa. They break a message into chunks and they can come out-of-order in different packets, in other words, the same message sequence can come in multiple packets, each one with a message chunk. I can't write sequentially to the same ByteBuffer because these chunks can be out of order. :( Am I missing something smarter here? It looks like there is no way to write sequentially to the same ByteBuffer given this chunk protocol below. :(
has title: Is there a Java ByteBuffer implementation that combines multiple backing ByteBuffers under the hood?
answer count: 2
score: 8
has comment: http://stackoverflow.com/comment/40546627
downvote count: 0
has comment: http://stackoverflow.com/comment/40545651
tagged with: nio
tagged with: bytebuffer
has comment: http://stackoverflow.com/comment/40553845
upvote count: 8
tagged with: real-time
favorite count: 0
has comment: http://stackoverflow.com/comment/40544545
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40546794
has comment: http://stackoverflow.com/comment/40545569
has comment: http://stackoverflow.com/comment/40545360

cryptography
tags question: http://stackoverflow.com/q/25896809
tag name: cryptography
tags question: http://stackoverflow.com/q/25894131
type: Tag
tags question: http://stackoverflow.com/q/26026948
tags question: http://stackoverflow.com/q/25912184
tags question: http://stackoverflow.com/q/25956453
tags question: http://stackoverflow.com/q/25922682

http://stackoverflow.com/q/25922809
has answer: http://stackoverflow.com/a/73568762
answer count: 1
has title: Glassfish 4 Grizzly Threads Heavy CPU usage
has body: I have a Jersey application running on Glassfish 4 (4.1 build 13), JDK 1.7 update 67 and AWS Linux AMI and I'm noticing that after some hours running it, CPU usage goes up and stays up even though clients are stopped. Running "top -H" identifies 2 http-listener-1-kernel threads with high CPU usage (from a total of 16). I then took a thread dump to check these two threads: "http-listener-1-kernel(3) SelectorRunner" daemon prio=10 tid=0x00007fbc68251000 nid=0xaee runnable [0x00007fbcb55ce000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method) at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269) at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79) at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87) - locked &lt;0x000000060263ad88&gt; (a sun.nio.ch.Util$2) - locked &lt;0x000000060263ad78&gt; (a java.util.Collections$UnmodifiableSet) - locked &lt;0x00000006025fb068&gt; (a sun.nio.ch.EPollSelectorImpl) at sun.nio.ch.SelectorImpl.selectNow(SelectorImpl.java:106) at org.glassfish.grizzly.nio.DefaultSelectorHandler.select(DefaultSelectorHandler.java:114) at org.glassfish.grizzly.nio.SelectorRunner.doSelect(SelectorRunner.java:338) at org.glassfish.grizzly.nio.SelectorRunner.run(SelectorRunner.java:278) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) at java.lang.Thread.run(Thread.java:745) "http-listener-1-kernel(8) SelectorRunner" daemon prio=10 tid=0x00007fbc6825b800 nid=0xaf3 runnable [0x00007fbcb50c9000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method) at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269) at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79) at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87) - locked &lt;0x00000006026648b8&gt; (a sun.nio.ch.Util$2) - locke…
has comment: http://stackoverflow.com/comment/76147854
favorite count: 0
type: UnansweredQuestion
tagged with: glassfish-4
score: 6
upvote count: 6
tagged with: grizzly
tagged with: java
type: Question
tagged with: java-7
downvote count: 0
tagged with: glassfish

http://stackoverflow.com/a/25883192
has body: For the first question, rh.setUnderline(UnderlinePatterns.SINGLE) or any other parameters depending on the underline style will work.
score: 0
answers question: http://stackoverflow.com/q/25882806
type: Answer

http://stackoverflow.com/q/25893283
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/40668967
tagged with: jsp
type: UnansweredQuestion
tagged with: spring
has body: I have a error in a JSP page. The error is saying that the text variable has the geters and setter methods, but the model has these methods Here is my model: @Entity public class Comentario implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(columnDefinition="TEXT") @Size(min = 5, message = "Mínimo 5 caracteres") private String texto; @DateTimeFormat(pattern = "dd/mm/yyyy") private Date data; @ManyToOne @JoinColumn(name = "usuario_id") @JsonBackReference private Usuario usuario; @ManyToOne @JoinColumn(name = "projeto_id") @JsonBackReference private Projeto projeto; public Comentario() { super(); } public Comentario(Long id, String texto, Date data, Usuario usuario, Projeto projeto) { super(); this.id = id; this.texto = texto; this.data = data; this.usuario = usuario; this.projeto = projeto; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getTexto() { return texto; } public void setTexto(String texto) { this.texto = texto; } public Date getData() { return data; } public void setData(Date data) { this.data = data; } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public Projeto getProjeto() { return projeto; } public void setProjeto(Projeto projeto) { this.projeto = projeto; } } In My jsp page has the code: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> Informações do Projeto <link href="<c:url value="/webjars/bootstrap/3.1.1/css/bootstrap.min.css" />" rel="stylesheet" /> <link href="<c:url value="/resources/css/estilo.css"…
has comment: http://stackoverflow.com/comment/40528513
tagged with: spring-mvc
answer count: 0
has title: org.springframework.beans.NotReadablePropertyException: Invalid property 'texto' of bean class [java.util.ArrayList]:
type: Question

http://stackoverflow.com/comment/41147289
score: 0
type: AnswerComment
type: Comment
has text: thank you. You have opened eye. Less time, immediate want and constant pressure leads to bad application only.
comment on: http://stackoverflow.com/a/25937848

http://stackoverflow.com/q/25947474
has title: I have a error Exception in thread "main" java.lang.NullPointerException when I connect SQL Server and Check User in table
favorite count: 0
score: -3
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25947495
type: Question
accepted answer: http://stackoverflow.com/a/25947495
upvote count: 0
duplicate of: http://stackoverflow.com/q/218384
has body: I am having a problem at a Java program. Exception in thread "main" java.lang.NullPointerException Exception in thread "main" java.lang.NullPointerException at DBOperation.DBOperation.checkLogin(DBOperation.java:30) at DBOperation.DBOperation.main(DBOperation.java:82) who can help me find error? how to fix them? (Please note that the code is still complete and I have entered some print statements for checking) My code: package DBOperation; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.*; public class DBOperation { private String url; private String serverName; private String dbName; private String usr; private String pwd; private Connection cnn; public boolean checkLogin(String user, String pass) { boolean tmp = false; Statement stm = null; ResultSet rs = null; try { stm = cnn.createStatement(); rs = stm.executeQuery("Select *from ListUser where username = '"+user+"' and password = '"+pass+"'"); if(rs.next()) return tmp = true; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ try { rs.close(); stm.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return tmp; } public DBOperation() { this.url = "jdbc:sqlserver://"; this.serverName = "localhost"; this.dbName = "sharefile"; this.usr = "sa"; this.pwd = "123456"; } @SuppressWarnings("finally") public Connection getMyCon() { Connection cn = null; try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); try { cn = DriverManager.getConnection(getMyUrl(),usr,pwd); if(cn!=null) { System.out.println("Ket noi thanh cong"); } else{ System.out.println("Ket noi khong thanh cong"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ return cn; } } private String getMyUrl() { // TODO A…
answer count: 1

http://stackoverflow.com/comment/40768188
has text: The collision is actually a problem since I wanted key-value pairs for both "records" and "pageSize" but after inserting "pageSize" the "records" key and value were overwritten. I can use an ImmutableMap, and I have since remedied the situation by using a HashMap without an expected size. I was just curious why the two keys would hash to the same bucket when the map was constructed with expected size and would **not** hash to the same bucket when it wasn't. I'm fairly certain the probability of the two strings hashing to the same value is small.
type: Comment
comment on: http://stackoverflow.com/a/26026738
type: AnswerComment
score: 0

http://stackoverflow.com/a/25972611
score: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25965437
type: Answer
answers question: http://stackoverflow.com/q/25965437
has body: There are two ways: To add the following to your code: import java.util.logging.Level; . . . LOG.setLevel(Level.ALL); LOG.warning("Warning message logged"); LOG.severe("severe debug message logged"); LOG.info("info message logged"); LOG.config("config message logged"); LOG.fine("some fine message"); LOG.finer("some finer message"); LOG.finest("some finest message"); The second option is to add your logging.properties file to appengine-web.xml as suggested here: &lt;!-- Configure java.util.logging --&gt; &lt;system-properties&gt; &lt;property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/&gt; &lt;/system-properties&gt; Note it should be located under WEB-INF or change that location in the previous file.
downvote count: 1
has comment: http://stackoverflow.com/comment/40691031
has comment: http://stackoverflow.com/comment/40699333

http://stackoverflow.com/q/25910553
tagged with: java
tagged with: vaadin
type: Question
has answer: http://stackoverflow.com/a/54459160
has answer: http://stackoverflow.com/a/31432562
linked to: http://stackoverflow.com/q/28264841
has title: java.lang.NoClassDefFoundError: au/com/bytecode/opencsv/CSVReader - Upload File Vaadin
has body: Based on the example mentioned in - https://gist.github.com/canthony/3655917 I have created a new Vaadin example to upload an Excel/CSV file. Based on the comments mentioned, I even downloaded opencsv-3.0 from the http://opencsv.sourceforge.net and added them into the project. Below is how I added them Right Click on Vaadin project created --> Properties --> Java Build Path --> Add Library (Created new User Library) --> New User Library --> User Libraries --> New (In User Libraries page) --> Created New Library with name CSV --> Included the OpenCSV3.0-jar Finally this is how my setup looks like: No errors or warnings are present, but when I publish on tomcat I get below error. This error comes up when I Browse a file and click on Upload button. Can some one please help? SEVERE: java.lang.NoClassDefFoundError: au/com/bytecode/opencsv/CSVReader at com.example.uploadexcel.UploadexcelUI.buildContainerFromCSV(UploadexcelUI.java:101) at com.example.uploadexcel.UploadexcelUI$2.uploadFinished(UploadexcelUI.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508) at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198) at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161) at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:979) at com.vaadin.ui.Upload.fireUploadInterrupted(Upload.java:875) at com.vaadin.ui.Upload$2.streamingFailed(Upload.java:1166) at com.vaadin.server.communication.FileUploadHandler.streamToReceiver(FileUploadHandler.java:615) at com.vaadin.server.communication.FileUploadHandler.handleFileUploadValidationAndData(FileUploadHandler.java:447) at com.vaadin.server.communication.FileUploadHandler.doHandleSimpleMultipartFileUpload(FileUploadHandler.j…
answer count: 2
has comment: http://stackoverflow.com/comment/40558534
has comment: http://stackoverflow.com/comment/47286428
has comment: http://stackoverflow.com/comment/40557693
type: UnansweredQuestion
tagged with: vaadin7
score: 0

http://stackoverflow.com/q/25927230
answer count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40587753
has comment: http://stackoverflow.com/comment/40587624
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25928242
has body: I am trying to access the MS-Access dsn created on a machine where the tomcat server is deployed. The normal code : Connection con=DriverManager.getConnection(sun.jdbc....) did not work. So I got the solution somewhere that it can be done using context. my current code is as below: &lt;%@ page import="java.sql.*" %&gt; &lt;%@ page import="javax.naming.*" %&gt; &lt;%@ page import="javax.sql.*" %&gt; &lt;% String un=request.getParameter("un"); String ps=request.getParameter("ps"); out.println("Redirected from index page&lt;br&gt;"); %&gt; &lt;% Connection con=null; Statement st=null; ResultSet rs=null; try{ Context initCtx=new InitialContext(); Context envCtx = (Context)initCtx.lookup("java:comp/env"); DataSource ds=(DataSource)envCtx.lookup("jdbc/product"); con=ds.getConnection(); st=con.createStatement(); rs=st.executeQuery("select * from login where User_name='"+un+"' and password='"+ps+"' "); if(rs.next()) { session.setAttribute("user",un); out.println("&lt;html&gt; &lt;body onload='f.submit()'&gt; &lt;form action='dis.jsp' name='f' &lt;/form&gt;&lt;/body&gt;&lt;/html&gt; "); } else { out.println("&lt;h1&gt; Kindly check your username and password &lt;/h1&gt;"); } } catch(Exception ex) { out.println(ex.getMessage()); } %&gt; but when clicked on submit, it shows the following error: Redirected from index page Name [jdbc/product] is not bound in this Context. Unable to find [jdbc]. Help me out.. I am new to this.. Regards.
has title: Connecting to MS Access in Tomcat Using Context
type: Question
tagged with: apache
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/25928242

http://stackoverflow.com/q/25884724
type: Question
score: 0
duplicate of: http://stackoverflow.com/q/5763750
answer count: 1
tagged with: polymorphism
has title: ArrayList and Polymorphism
linked to: http://stackoverflow.com/q/5763750
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40512072
tagged with: oop
has comment: http://stackoverflow.com/comment/40509695
tagged with: java
has body: It would be of great help, if someone can point out the problem and possible explanation here. class Parent{} public class ChildClass extends Parent{ /*Main class*/ public static void main(String[] args) { ArrayList&lt;ChildClass&gt; a3 = new ArrayList&lt;ChildClass&gt;(); foo(a3); } /*another function*/ static void foo(ArrayList&lt;Parent&gt; obj) { } This throws the following compilation error. The method foo(ArrayList&lt;Parent&gt;) in the type ChildClass is not applicable for the arguments (ArrayList&lt;ChildClass&gt;) The rule of Polymorphism should allow me to do it. Right? After all the ChildClass IS-A Parent. What seems to be the problem?
has answer: http://stackoverflow.com/a/25884788
accepted answer: http://stackoverflow.com/a/25884788

http://stackoverflow.com/q/25875367
has body: I proceed to this tutorial http://eclipsesource.com/blogs/2014/02/04/step-by-step-how-to-bring-jax-rs-and-osgi-together/ and standalone it works fine for me. Now i want to integrate it with my other bundles and got into the following exception: !ENTRY com.eclipsesource.jaxrs.publisher 4 0 2014-09-16 14:11:27.203 !MESSAGE FrameworkEvent ERROR !STACK 0 org.osgi.framework.BundleException: Exception in com.eclipsesource.jaxrs.publisher.internal.Activator.start() of bundle com.eclipsesource.jaxrs.publisher. at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792) at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721) at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936) at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319) at org.eclipse.osgi.container.Module.doStart(Module.java:571) at org.eclipse.osgi.container.Module.start(Module.java:439) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) Caused by: java.lang.NoClassDefFoundError: javax/servlet/Filter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:272) at…
score: 0
tagged with: osgi
tagged with: equinox
type: UnansweredQuestion
tagged with: java
type: Question
has title: osgi-jax-rs-connector ClassNotFoundException javax.servlet.Filter
has answer: http://stackoverflow.com/a/25887185
tagged with: jersey
answer count: 1
tagged with: jax-rs

http://stackoverflow.com/comment/40752564
type: Comment
type: QuestionComment
has text: Without looking into anything, what does `Expected a string but was BEGIN_OBJECT` mean to you?
comment on: http://stackoverflow.com/q/26019086
score: 0

http://stackoverflow.com/comment/40568831
type: Comment
has text: thank you, I changed TransportClient client =... to just Client client =... and that may very well have done it. ^1. Please give me another min to test before I accept. Either way THANK YOU for your time, I am so appreciative!
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25916362

http://stackoverflow.com/comment/40715716
type: QuestionComment
comment on: http://stackoverflow.com/q/25998991
score: 1
has text: won't work he needs the entire word match
type: Comment

http://stackoverflow.com/comment/40752301
score: 0
type: Comment
has text: Updated, the full stack trace is shown at the top, just those two lines are all I get
type: QuestionComment
comment on: http://stackoverflow.com/q/26005483

http://stackoverflow.com/a/25895973
upvote count: 1
has body: First of all, try to made your project with mvn install -DskipTests and see if it builds without others problems like dependency or others. If it builds without problems, try to check dependency scopes http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
accepted answer of: http://stackoverflow.com/q/25895817
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25895817
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/25984190
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40689432
type: Answer
accepted answer of: http://stackoverflow.com/q/25983775
answers question: http://stackoverflow.com/q/25983775
upvote count: 1
has body: This line String fromCity = line.substring(0, line.indexOf("-")); leaves a space after the starting city because that is how your text file is formatted. Your keys look like "Denver " and "San Jose ". You should change it to this: String fromCity = line.substring(0, line.indexOf("-") - 1); Additionally, it would make more sense to use the entire delimiter " -&gt; " because some cities have a dash in them, such as Wilkes-Barre. NullPointerException is thrown because Map returns null if the key doesn't exist. You should account for that in printAvailableFlights.
type: AcceptedAnswer

http://stackoverflow.com/comment/40767021
score: 0
type: AnswerComment
type: Comment
has text: when I emulated it give me error "Unfortunately da4 stopped"
comment on: http://stackoverflow.com/a/26026581

http://stackoverflow.com/q/25944053
tagged with: java
type: Question
has title: Find Kth digit number after n changes
has comment: http://stackoverflow.com/comment/40617685
has comment: http://stackoverflow.com/comment/40617830
has comment: http://stackoverflow.com/comment/40617736
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40617870
has answer: http://stackoverflow.com/a/25944328
has body: There is a changing rule that, 0 -> 01, 1 -> 10. For example, after the change, 10 is 1001. Assume that the input is 0, after n changes of such rule, what is the Kth digit? I can only come with the brutal solution, which is as followings. However I believe there exist better solutions, can anyone come up with some new ideas? public char lalala(int n, int k) { String str = "0"; for (int i = 0; i &lt; n; i++) { StringBuilder sb = new StringBuilder(); for (int j = 0; j &lt; str.length; j++) { if (str.charAt(j) == '0') { sb.append("01"); } else { sb.append("10"); } } str = sb.toString(); } return str.charAt(k); }
tagged with: bit
upvote count: 1
accepted answer: http://stackoverflow.com/a/25944328
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/40506539
type: QuestionComment
has text: set i to `i = colNames.length-1` not `i = colNames.length`. colNames' indices range from 0 to colNames.length-1. So, colNames[i] is giving you problem.
score: 3
comment on: http://stackoverflow.com/q/25882895
type: Comment

http://stackoverflow.com/q/26028995
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/26029036
tagged with: java
has body: This is a homework assignment where we need to get input from the user to enter their first and last name with a space inbetween. Upon entering this data, the user presses enter and will be asked to enter their alias name. once thats entered the program outputs the user inputted first and last name and adds "aka" and the user inputted alias name and also display the initials of the first and last name in lower case letters, upper case letters, and the persons first and last name in all lower case letters. I have successfully got the program to display the first and last name and aka alias name as well as initials. But I cannot figure out how I can get the initial to be to instances "AB" and "ab" and also how to get the user input and make it all lower case letters. /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package aliassearch; import java.awt.*; import javax.swing.*; import java.util.Scanner; /** * * @author students */ public class Aliassearch { public static int user_input; /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner user_input = new Scanner (System.in); String first_name; System.out.print("Please put in your first name followed by a space and a last name: "); first_name = user_input.nextLine(); String s = new String(first_name); int slength = s.length(); //System.out.println(slength); // int sindex = s.indexOf(" "); // System.out.println(sindex); //alias parts String alias_name; System.out.print("Enter your alias: "); alias_name = user_input.next(); // combines user input first name and alias name String full_name; full_name = first_name + " " + alias_name; System.out.println(first_name + " aka " + alias_name ); //converts to initials for (int i = 1; i &lt; first_name.length(); i++) { char c1 = first_name.charAt(i); if (c1 == ' ') { System…
answer count: 2
score: 0
has title: How to manipulate one string to upper case and lower case
has comment: http://stackoverflow.com/comment/40770994
has answer: http://stackoverflow.com/a/26029467

http://stackoverflow.com/q/25899087
tagged with: android
type: AnsweredQuestion
tagged with: java
has title: Socket Client Sends nothing
has answer: http://stackoverflow.com/a/25899217
type: Question
has body: I have a Problem: I have a Socket Client on my Android Phone and a Java Socket Server on my PC. Server -> Android works perfektly, but Android -> Server doesn't work. This is my sending Method on my Phone: public void sendMessage(String cmd, String parameter) { String msg; if(!parameter.equals("")) msg = cmd+";"+parameter; else msg = cmd+";null"; Log.v(TAG,"Send: "+msg); DataOutputStream bos; try { bos = new DataOutputStream(s.getOutputStream()); bos.write(msg.getBytes("US_ASCII")); bos.flush(); } catch (IOException e) { e.printStackTrace(); } } And this is The receiving on my Server: @Override public void run() { while (isRunning) { try { DataInputStream dis = new DataInputStream(s.getInputStream()); String message = dis.readUTF(); System.out.println("#"+this.ID+": Received: "+message); obs.setID(ID); obs.proceedMsg(message); } catch (IOException ex) { this.isRunning = false; System.out.println("#"+this.ID+": Closed Instance"); } } } Has anyone an Idea? :) Thanks
has comment: http://stackoverflow.com/comment/40535772
score: 0
has comment: http://stackoverflow.com/comment/40535827
answer count: 1
accepted answer: http://stackoverflow.com/a/25899217
tagged with: sockets

http://stackoverflow.com/q/25876736
answer count: 1
tagged with: opengl
tagged with: java
has title: how to colour objects without texturing in openGL
type: UnansweredQuestion
has body: I want to colour objects in openGL without using any textures. Preferrably I want to colour objects based on an integer colour code. What is the best way to do this(in java)?
upvote count: 0
favorite count: 0
type: Question
score: -2
has answer: http://stackoverflow.com/a/25878667
tagged with: jogl
downvote count: 2

http://stackoverflow.com/comment/40635078
has text: Provide your stacktrace
score: 0
comment on: http://stackoverflow.com/q/25953958
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40562831
has text: Please post the actual missing dependency; with full group and artifact name. It might be that the dependency simply moved since the ear was last built. But it might also be that the project was depending on a local nexus with a manually maintained third party repository for example. Its impossible to know if you don't post the details.
score: 0
comment on: http://stackoverflow.com/q/25913490
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25920527
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25920371
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25920371
has body: Everything you write inside doInBackground runs in the background. It has no connection with your GUI or different thread.
upvote count: 1

http://stackoverflow.com/comment/40777767
has text: So you rather hack/coble together a solution then use a proven well tested solution. The only thing to do is that you need to add a `@Audited` annotation on the classes that need to be monitored. You could even do special auditing on entity relations.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26016147
score: 0

http://stackoverflow.com/q/25981514
type: UnansweredQuestion
tagged with: netty
has comment: http://stackoverflow.com/comment/40684306
has title: Netty 4.0 Client/Server Freezes on Connection
tagged with: java
has body: Well i was working ok with Netty 3 but i wanted to work with Netty 4, i converted the code and got all of this below, im not sure if its a server issue and client issue in the code because it doesnt tell me, not even the source of the error, i also tried sending no data to the server and it still did it, i can not interact with the client but from tests it is making the application take up more ram very slowly and i am only sending strings that are not even 40 chars long MecaCoreConnector (Client): import io.netty.bootstrap.Bootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.codec.DelimiterBasedFrameDecoder; import io.netty.handler.codec.Delimiters; import io.netty.handler.codec.LengthFieldBasedFrameDecoder; import io.netty.handler.codec.string.StringDecoder; import io.netty.handler.codec.string.StringEncoder; import main.java.net.meca.thecheatgamer1.CryptionUtils; import main.java.net.mecalib.logger.Logger; public class MecaCoreConnector { private static CryptionUtils cryption = new CryptionUtils(); protected static UserAuthenticationData userdata; private ChannelFuture ch; private final static String host = "secret"; private final static int port = secret; private static MecaCoreConnector MecaConnection; public MecaCoreConnector() { MecaConnection = this; } public void init() throws InterruptedException { EventLoopGroup workerGroup = new NioEventLoopGroup(); try { Bootstrap bootstrap = new Bootstrap(); bootstrap.group(workerGroup); bootstrap.channel(NioSocketChannel.class); bootstrap.option(ChannelOption.SO_KEEPALIVE, true); bootstrap.handler(new ChannelInitializer&lt;SocketChann…
has comment: http://stackoverflow.com/comment/40684789
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25994297
has comment: http://stackoverflow.com/comment/40684715
has answer: http://stackoverflow.com/a/25991797

http://stackoverflow.com/q/26032713
has comment: http://stackoverflow.com/comment/40781680
has answer: http://stackoverflow.com/a/26059434
has comment: http://stackoverflow.com/comment/40782028
has comment: http://stackoverflow.com/comment/40780409
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40779401
has comment: http://stackoverflow.com/comment/40779967
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/40782623
has comment: http://stackoverflow.com/comment/40782131
has body: hi everyone I'm working on some java code which call functions from a c++ dll. But some functions from the dll can be called correctly, while others can not. I first write a java class wrap all the functions from the dll, then using javah generate the corresponding jni header file. At last I write c++ code include the generated jni header file. The c++ file was written in Visual Studio and the java code was written in Eclipse. Below is my code,I have remove some irrelevant code. Java: public class VideoDetecion { static { System.load("dll_video_detect.dll"); System.load("vd_jni_impl.dll"); } public static native int getFrame(String videoName, int second,String frameName); public static native int getFrame1(String videoName); public static native int getFrame2(String videoName, int second); } c++ using cv::VideoCapture; using cv::Mat; using std::string; using std::bind; using std::shared_ptr; using std::vector; using std::string; using namespace std::placeholders; JNIEXPORT jint JNICALL Java_videoDetectionJNI_VideoDetecion_getFrame1 (JNIEnv *env, jclass, jstring videoName) { //String videoName = "D:\\videos\\detect1\\0.mp4"; shared_ptr&lt;const char&gt; vn(env-&gt;GetStringUTFChars(videoName, NULL), bind(&amp;JNIEnv::ReleaseStringUTFChars, env, videoName, _1)); int second = 10; string frameName = "D:\\videos\\detect1\\0-10.jpg"; vd::getVideoFrame(string(vn.get()), second, frameName); return 0; } /* * Class: videoDetectionJNI_VideoDetecion * Method: getFrame2 * Signature: (Ljava/lang/String;I)I */ JNIEXPORT jint JNICALL Java_videoDetectionJNI_VideoDetecion_getFrame2 (JNIEnv *env, jclass, jstring videoName, jint second) { shared_ptr&lt;const char&gt; vn(env-&gt;GetStringUTFChars(videoName, NULL), bind(&amp;JNIEnv::ReleaseStringUTFChars, env, videoName, _1)); string frameName = "D:\\videos\\detect1\\0-10.jpg"; vd::getVideoFrame(string(vn.get()), second, frameName); return 0; } JNIEXPORT jint JNICALL Java_videoDetectionJNI_VideoDetecion_getFrame (JNIEnv *env, jobject, js…
has comment: http://stackoverflow.com/comment/40781622
tagged with: c++
has comment: http://stackoverflow.com/comment/40782305
has comment: http://stackoverflow.com/comment/40783234
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40810639
has comment: http://stackoverflow.com/comment/40780027
type: Question
has title: jni native method problems
has comment: http://stackoverflow.com/comment/40848067
has comment: http://stackoverflow.com/comment/40865675
tagged with: java-native-interface

blackhole
type: Tag
tags question: http://stackoverflow.com/q/25940650
tag name: blackhole

http://stackoverflow.com/comment/40614401
type: Comment
comment on: http://stackoverflow.com/a/25940044
has text: Thank you! I have been playing around with the code since posting this and now have a completely new set of issues :-(
score: 0
type: AnswerComment

http://stackoverflow.com/q/25932370
tagged with: spring-mvc
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: wildfly-8
has answer: http://stackoverflow.com/a/25932648
has body: I am developing a spring 4 based web applciation, that is divided into two modules; one the service (jar) and the other is the web application. The web war will contain the service jar and other library dependencies within it. The application works as expected when deployed with the Spring tool suite vFabric tc Server. But when the same war is deployed in the Wildfly 8.1, though the application allows to login, on every web page of the app, the validator recieves the target with all the form values empty. Why is that? public void validate(Object target, Errors errors) I have the jboss-deployment-structure.xml like the one below &lt;jboss-deployment-structure&gt; &lt;deployment&gt; &lt;dependencies&gt; &lt;module name="org.slf4j"/&gt; &lt;/dependencies&gt; &lt;/deployment&gt; &lt;/jboss-deployment-structure&gt; Do I need to configure any more information in this? I tried to deploy the war by directly copying into the wildfly-8.1.0.Final\standalone\deployments. Am I missing any configuration?
downvote count: 0
answer count: 1
tagged with: jboss7.x
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has title: How to deploy Spring 4 web application in Wildfly 8.1

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/25916563
tags question: http://stackoverflow.com/q/25912341
tags question: http://stackoverflow.com/q/26014358
tags question: http://stackoverflow.com/q/26022255
tags question: http://stackoverflow.com/q/25894957
tags question: http://stackoverflow.com/q/25899632
tags question: http://stackoverflow.com/q/26004168
tags question: http://stackoverflow.com/q/25878127
tags question: http://stackoverflow.com/q/25956890
tags question: http://stackoverflow.com/q/25886641
tags question: http://stackoverflow.com/q/25938425
tags question: http://stackoverflow.com/q/25991953
tags question: http://stackoverflow.com/q/25922336
type: Tag
tags question: http://stackoverflow.com/q/25988894
tags question: http://stackoverflow.com/q/25994675
tags question: http://stackoverflow.com/q/25962033
tags question: http://stackoverflow.com/q/25933481
tags question: http://stackoverflow.com/q/25988503
tags question: http://stackoverflow.com/q/25893503
tags question: http://stackoverflow.com/q/25884646
tags question: http://stackoverflow.com/q/25894363
tags question: http://stackoverflow.com/q/25893183
tags question: http://stackoverflow.com/q/26012982
tags question: http://stackoverflow.com/q/25924465
tags question: http://stackoverflow.com/q/25995817
tags question: http://stackoverflow.com/q/25919733
tags question: http://stackoverflow.com/q/26024582
tags question: http://stackoverflow.com/q/25917630
tags question: http://stackoverflow.com/q/26013922
tags question: http://stackoverflow.com/q/26005758
tags question: http://stackoverflow.com/q/26015240
tags question: http://stackoverflow.com/q/26029712
tags question: http://stackoverflow.com/q/25998287
tags question: http://stackoverflow.com/q/25979135
tags question: http://stackoverflow.com/q/25928486
tags question: http://stackoverflow.com/q/25962437
tags question: http://stackoverflow.com/q/25908796
tags question: http://stackoverflow.com/q/25976391
tags question: http://stackoverflow.com/q/25924474
tags question: http://stackoverflow.com/q/25883264
tags question: http://stackoverflow.com/q/25936349
tags question: http://stackoverflow.com/q/25884169
tags question: http://stackoverflow.com/q/26026684
tags question: http://stackoverflow.com/q/25931318
tags question: http://stackoverflow.com/q/25903029
tags question: http://stackoverflow.com/q/25931967
tags question: http://stackoverflow.com/q/26021459
tags question: http://stackoverflow.com/q/25928253
tags question: http://stackoverflow.com/q/25894485
tags question: http://stackoverflow.com/q/25974351
tags question: http://stackoverflow.com/q/25958896
tags question: http://stackoverflow.com/q/25932810
tags question: http://stackoverflow.com/q/26014744
tags question: http://stackoverflow.com/q/25875187
tags question: http://stackoverflow.com/q/25916595
tags question: http://stackoverflow.com/q/25967551
tags question: http://stackoverflow.com/q/26014686
tags question: http://stackoverflow.com/q/25930347
tag name: xml
tags question: http://stackoverflow.com/q/25977293
tags question: http://stackoverflow.com/q/25969655
tags question: http://stackoverflow.com/q/25972691
tags question: http://stackoverflow.com/q/25981968
tags question: http://stackoverflow.com/q/25935447
tags question: http://stackoverflow.com/q/25877483
tags question: http://stackoverflow.com/q/26028505
tags question: http://stackoverflow.com/q/25995792
tags question: http://stackoverflow.com/q/26002636
tags question: http://stackoverflow.com/q/25949317
tags question: http://stackoverflow.com/q/25948982
tags question: http://stackoverflow.com/q/25940525
tags question: http://stackoverflow.com/q/25896516
tags question: http://stackoverflow.com/q/25906092
tags question: http://stackoverflow.com/q/25911428
tags question: http://stackoverflow.com/q/25888953
tags question: http://stackoverflow.com/q/25889719
tags question: http://stackoverflow.com/q/26024738
tags question: http://stackoverflow.com/q/25978847
tags question: http://stackoverflow.com/q/25971286

http://stackoverflow.com/comment/40490158
comment on: http://stackoverflow.com/a/25873794
type: AnswerComment
score: 0
type: Comment
has text: @jack I agree, visitor pattern looks tricky to someone looking at it for the first time. I am heavily biased here, because I've been using this pattern for many years. The advantage, however, is that one needs to learn this pattern only once to reliably recognize it in the future. It's like learning to ride a bicycle :)

http://stackoverflow.com/comment/40571191
type: Comment
type: QuestionComment
has text: @JDS Do you mean, convert this array of arrays `0.0, 0.1, 0.2; 1.0, 1.1, 1.2; 2.0, 2.1, 2.2` to one list? ``0.0, 0.1, 0.2, 1.0, 1.1, 1.2, 2.0, 2.1, 2.2` Then move the race around. Then convert back into the array of arrays?
score: 0
comment on: http://stackoverflow.com/q/25918169

http://stackoverflow.com/comment/40777003
type: QuestionComment
comment on: http://stackoverflow.com/q/26032461
has text: It is important to mention in your code example how the scanner is used in the for loop - I hope you have not forgotten to do something like `s.nextLine()` to actualy advance in the file.
score: 0
type: Comment

http://stackoverflow.com/q/25878303
accepted answer: http://stackoverflow.com/a/25878534
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40498974
favorite count: 0
has comment: http://stackoverflow.com/comment/40498890
has body: I need to add objects from a sourceList to a collection that sorts the collection as we add objects to the collection. I am thinking of using TreeSet. TreeSet bookSet Based on certain conditions, I need to take subset of the bookSet. Subset will be first N elements. The value of N is known only after entire bookSet is prepared from another sourceList. Is there anyway I can get the subset of bookSet using index N, Similar to arrayList.subList(0,N). I can use headSet, but I need to know N+1 th element.
has title: Index based subset of SortedSet
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: sortedset
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/40498877
has answer: http://stackoverflow.com/a/25878534

http://stackoverflow.com/comment/40745550
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61833/discussion-between-abhiroop-sarkar-and-fionn).
type: Comment
comment on: http://stackoverflow.com/a/26014903
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40616446
type: Comment
has text: Yes, but my question is not about static *fields* but about the background why referencing a superclass' static *method* via a subclass doesn't initialize the subclass. But, it seems likely that your answer "avoid having the JVM load classes unnecessarily" applies to methods as well. Though, in the case described in my original question I wouldn't call it "unnecessary".
comment on: http://stackoverflow.com/a/25942525
type: AnswerComment
score: 0

http://stackoverflow.com/a/26024381
accepted answer of: http://stackoverflow.com/q/26023748
score: 0
type: AcceptedAnswer
has body: I think your if expression has a logical error. haveFiles = true will always return true, reducing your expression to : file.findAllFiles(userid).contains(true) since (haveFiles = true) assigns the value true to the variable haveFiles. You should rather be doing something on the following lines : Map&lt;Flag, Boolean&gt; keyValueMap = file.findAllFiles(userid) if(keyValueMap.contains(Flag.HAVE_FILES) == true){ //send email }else{ //do something } ..asuming you the file.findAllFiles() returns a map object with flags and their boolean status and Flag is an enum containing all the supported flags. The expression (keyValueMap.contains(Flag.HAVE_FILES) == true) will evaluate to true only when keyValueMap contains an entry for Flag.HAVE_FILES and the value is true.
answers question: http://stackoverflow.com/q/26023748
type: Answer

http://stackoverflow.com/comment/40606388
type: Comment
score: 0
has text: I think @SimoneGianni means that `/w` does not equal whitespace in Java. That sequence will literally just output `/w/w/w` into your target. Nor is `\w` whitespace in Java, so can you clarify what you are asking?
type: QuestionComment
comment on: http://stackoverflow.com/q/25937806

http://stackoverflow.com/q/25989798
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26658736
has title: Eclipse: change variable from private to public using refactoring tools (or plugin)?
has answer: http://stackoverflow.com/a/29401882
has comment: http://stackoverflow.com/comment/40699533
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25989982
tagged with: eclipse
has body: There are questions seeking to go from public to private. I wish to go the other way. I have a medium sized project, and I wish to change three commonly used variables from private to public. The setters and getters are of the form: private int x; public getX() { return x; } public setX(int x) { this.x = x; } Is there an easy way to refactor these variables, removing the setters and all references to the setters, and replacing with the variable directly? As far as I can tell, Eclipse refactoring supports transitioning from public to private, but the other way seems difficult. If it's not supported natively, is there a plugin that can perform this task? [edit: should add, I'm using Eclipse Kepler, Service Release 2].
tagged with: automated-refactoring
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40699516

http://stackoverflow.com/comment/40640471
type: Comment
comment on: http://stackoverflow.com/a/25957519
has text: Edited the answer. you can store the data in an ArrayList.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40567997
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25916563
has text: Please show the queries that you are seeing and state your exact question. Are you asking why you see these queries? Are you asking how to change your code/configuration to somehow change the queries?

multithreading
tags question: http://stackoverflow.com/q/25980548
tags question: http://stackoverflow.com/q/25885422
tags question: http://stackoverflow.com/q/26011433
tags question: http://stackoverflow.com/q/25916745
type: Tag
tags question: http://stackoverflow.com/q/26021372
tags question: http://stackoverflow.com/q/25949145
tags question: http://stackoverflow.com/q/25957493
tags question: http://stackoverflow.com/q/25955287
tags question: http://stackoverflow.com/q/26013563
tags question: http://stackoverflow.com/q/26005336
tags question: http://stackoverflow.com/q/25922372
tags question: http://stackoverflow.com/q/25951404
tags question: http://stackoverflow.com/q/25879487
tags question: http://stackoverflow.com/q/25943257
tags question: http://stackoverflow.com/q/25986152
tags question: http://stackoverflow.com/q/25947655
tags question: http://stackoverflow.com/q/25978784
tags question: http://stackoverflow.com/q/25920748
tags question: http://stackoverflow.com/q/26030960
tags question: http://stackoverflow.com/q/25911129
tags question: http://stackoverflow.com/q/25961553
tags question: http://stackoverflow.com/q/26004337
tags question: http://stackoverflow.com/q/25904803
tags question: http://stackoverflow.com/q/25967744
tags question: http://stackoverflow.com/q/25980237
tags question: http://stackoverflow.com/q/25989277
tags question: http://stackoverflow.com/q/26012709
tags question: http://stackoverflow.com/q/25978928
tags question: http://stackoverflow.com/q/26031724
tags question: http://stackoverflow.com/q/25884342
tags question: http://stackoverflow.com/q/25925041
tags question: http://stackoverflow.com/q/25972299
tags question: http://stackoverflow.com/q/26014617
tags question: http://stackoverflow.com/q/25946103
tags question: http://stackoverflow.com/q/25931940
tags question: http://stackoverflow.com/q/26015953
tags question: http://stackoverflow.com/q/26015586
tags question: http://stackoverflow.com/q/25928954
tags question: http://stackoverflow.com/q/25915621
tags question: http://stackoverflow.com/q/26011376
tags question: http://stackoverflow.com/q/25964734
tags question: http://stackoverflow.com/q/25961142
tags question: http://stackoverflow.com/q/26022054
tags question: http://stackoverflow.com/q/25931649
tags question: http://stackoverflow.com/q/25875883
tags question: http://stackoverflow.com/q/25963481
tags question: http://stackoverflow.com/q/25923700
tags question: http://stackoverflow.com/q/25970123
tags question: http://stackoverflow.com/q/26013411
tags question: http://stackoverflow.com/q/25881019
tags question: http://stackoverflow.com/q/25980296
tags question: http://stackoverflow.com/q/26006223
tags question: http://stackoverflow.com/q/25963348
tags question: http://stackoverflow.com/q/25956649
tags question: http://stackoverflow.com/q/25970852
tags question: http://stackoverflow.com/q/25927306
tags question: http://stackoverflow.com/q/25964203
tags question: http://stackoverflow.com/q/25920048
tags question: http://stackoverflow.com/q/25971518
tags question: http://stackoverflow.com/q/25968028
tags question: http://stackoverflow.com/q/25944695
tags question: http://stackoverflow.com/q/26030693
tags question: http://stackoverflow.com/q/25901363
tags question: http://stackoverflow.com/q/25946506
tags question: http://stackoverflow.com/q/25925306
tags question: http://stackoverflow.com/q/25895498
tags question: http://stackoverflow.com/q/26017560
tags question: http://stackoverflow.com/q/25936000
tags question: http://stackoverflow.com/q/25981657
tags question: http://stackoverflow.com/q/25949642
tags question: http://stackoverflow.com/q/25959581
tags question: http://stackoverflow.com/q/25924672
tags question: http://stackoverflow.com/q/26000221
tags question: http://stackoverflow.com/q/25903128
tags question: http://stackoverflow.com/q/25929920
tags question: http://stackoverflow.com/q/25984980
tags question: http://stackoverflow.com/q/25996404
tags question: http://stackoverflow.com/q/25999909
tags question: http://stackoverflow.com/q/25953472

http://stackoverflow.com/q/25958486
has comment: http://stackoverflow.com/comment/40739272
tagged with: android
has answer: http://stackoverflow.com/a/26071922
tagged with: connection
has comment: http://stackoverflow.com/comment/40838402
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40641794
accepted answer: http://stackoverflow.com/a/26071922
upvote count: 5
tagged with: bluetooth
score: 5
has title: Error while sending files through bluetooth in android?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40741800
has body: I followed up this question but all mention solution didn't work for me. I am making an application similar to rainbow application. This application will be installed in the device which has to send all contacts to other device.The application is to be installed only in one device.I am able to connect to the remote device through this piece of code // BluetoothConnector (Complete Code) Class&lt;?&gt; clazz = tmp.getRemoteDevice().getClass(); Class&lt;?&gt;[] paramTypes = new Class&lt;?&gt;[] {Integer.TYPE}; Method m = clazz.getMethod("createRfcommSocket", paramTypes); Object[] params = new Object[] {Integer.valueOf(1)}; fallbackSocket = (BluetoothSocket) m.invoke(tmp.getRemoteDevice(), params); after pairing request is made and connection is done,I try to send data by outputstream to other device through this piece of code. //Output-stream Code (Complete code) public void write(byte[] buffer) { try { Log.i(TAG, "write"); mmOutStream.write(buffer); } catch (IOException e) { Log.e(TAG, "Exception during write", e); } but I am not able to send data as soon as mmOutStream.write(buffer); is called it gives following error. // Error Log (Complete Log) 09-21 16:21:52.829 6262-6262/com.example.aadi.myapplication D/BT_app﹕ connection_done 09-21 16:21:52.829 6262-6871/com.example.aadi.myapplication I/BT_app﹕ BEGIN mConnectedThread 09-21 16:21:52.829 6262-6871/com.example.aadi.myapplication I/BT_app﹕ write 09-21 16:21:52.829 6262-6262/com.example.aadi.myapplication D/BT_app﹕ msg write :[B@4265cd70 09-21 16:22:50.149 6262-6823/com.example.aadi.myapplication W/BluetoothAdapter﹕ getBluetoothService() called with no BluetoothManagerCallback 09-21 16:22:50.159 6262-6823/com.example.aadi.myapplication D/BluetoothSocket﹕ connect(), SocketState: INIT, mPfd: {ParcelFileDescriptor: FileDescriptor[81]} 09-21 16:22:50.679 6262-6823/com.example.aadi.myapplication W/BT_app﹕ Fallback failed. Cancelling. java.io.IOException: read failed, socket might closed or timeout, read ret: -1 at android…
linked to: http://stackoverflow.com/q/11502497
favorite count: 0

http://stackoverflow.com/comment/40519355
has text: Its part of standard web dir structure for dynamic web project that eclipse creates.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25890198

http://stackoverflow.com/q/25950686
has title: @RequestMapping with parameter in the middle of path
answer count: 1
linked to: http://stackoverflow.com/q/4073970
downvote count: 0
tagged with: url
tagged with: jsp
favorite count: 0
tagged with: spring
tagged with: spring-mvc
has body: Let's say I'm displaying a schedule for academic group with id = 1 at the following URL: http://localhost:8222/schedule?groupId=1. At this page I have buttons for deleting specific lessons from the schedule. Button's action attribute in JSP has the following value: "schedule?${pageContext.request.queryString}/delete/${lessons[count].id}", so clicking the "Delete" button near the lesson with id = 1 causes the redirect to this URL: http://localhost:8222/schedule?groupId=1/delete/1. What I want to do is create a method that is mapped to this URL, which performs deletion and redirects to the page with schedule for currently selected group: http://localhost:8222/schedule?groupId=1. Here's what I've tried to do: @RequestMapping(value = "/schedule?groupId={groupId}/delete/{lessonId}") public String deleteLesson(@PathVariable("lessonId") Integer lessonId, @PathVariable("groupId") Integer groupId) { lessonRepository.delete(lessonId); return "redirect:/schedule?groupId=" + groupId; } But that doesn't work, this method is never called. How do I write this method properly for what I'm trying to achieve?
score: 1
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25950787
accepted answer: http://stackoverflow.com/a/25950787
has comment: http://stackoverflow.com/comment/40627593

http://stackoverflow.com/comment/40671399
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25974672
has text: This gives me an error `ProgressDialog pd = new ProgressDialog(SMSReceiver.this);` The constructor ProgressDialog(SMSReceiver.this) is undefined.

http://stackoverflow.com/q/25921475
favorite count: 0
has comment: http://stackoverflow.com/comment/40578112
upvote count: 2
tagged with: exception
has answer: http://stackoverflow.com/a/25930470
score: 2
type: AnsweredQuestion
tagged with: bad-request
tagged with: java
has comment: http://stackoverflow.com/comment/40577348
type: Question
has comment: http://stackoverflow.com/comment/40577518
accepted answer: http://stackoverflow.com/a/25930470
has title: Catch a Bad Request Exception (400)
answer count: 1
downvote count: 0
has body: My Facade/EJB is a simple method.In this method I make something like: if(!something.isempty()){ do something; else{ throw new BadRequestException("Something is missing"); In controller I call EJB and make a method which parameters cannot be null.Then I try to catch exception like this: try{ something; catch(BadRequestException ex){ makeSomethin;}´ The problem is that i don´t cach exception...

http://stackoverflow.com/comment/40600323
type: QuestionComment
comment on: http://stackoverflow.com/q/25933532
has text: Thanks, it solved the problem! Can you please tell what is the difference between passing to `createCriteria` a string with class name and class (like that `ProductPart.class`)?
score: 0
type: Comment

http://stackoverflow.com/q/25944644
type: UnansweredQuestion
tagged with: spring
tagged with: spring-jdbc
tagged with: java
type: Question
has body: Spring Security is giving me fits, I cannot get around the authentication error. Here is my config: &lt;beans:bean id='bCryptPasswordEncoder' class='org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder'/&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;password-encoder ref="bCryptPasswordEncoder" /&gt; &lt;jdbc-user-service data-source-ref="dataSource" users-by-username-query="select emplid as USERNAME ,password as PASSWORD,'true' AS ENABLED from app_user where emplid=?" authorities-by-username-query="select u.emplid, p.name from app_user u inner join app_user_app_permissions auap ON auap.app_users = u.id inner join app_permission p on p.id = auap.app_permissions where u.emplid =?" /&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; I'm creating my encoded password with: String password = "p4ssword"; BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); String encodedPassword = passwordEncoder.encode(password); I've verified that the correct user/password are in the database, and that the query that fetches them runs. Any idea why this does not work, it's driving me nuts
has title: Spring Securitiy jdbc-user-service not authenticating - bad credentials
tagged with: security
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/52931522
has answer: http://stackoverflow.com/a/25947321

http://stackoverflow.com/comment/40637440
score: 0
comment on: http://stackoverflow.com/a/25932648
type: AnswerComment
type: Comment
has text: Well, as I said, your question was about deploying to Wildfly and you got it deployed to wildfly. I can't not help you with your app without seeing your code. I could be a dependency that is in verion 9 but not in version 8.1? I don't know.

http://stackoverflow.com/q/25945061
type: UnansweredQuestion
has title: Layers overriding each other in GUI using JPanel
linked to: http://stackoverflow.com/q/5621338
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/40619342
type: Question
tagged with: jpanel
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/40619304
score: 0
has body: I am having trouble making the layout of a simple Calculator. What is happening is that everything appears fine except that my subtract button stays as the background and I have to guess where my other buttons are to be able to click them. When I click them I am able to see them until I unclick them. is there anyway to fix this? I'm not posting the math algorithm a it is not needed for this question. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class GUIcalc extends JFrame implements ActionListener { private JPanel panel; private JPanel buttonpanel; private JPanel text; private JLabel sumfield; private BorderLayout layout; private GridLayout grid; private Container container; private boolean toggle=true; private float sum; private int num1; private int num2; JButton one = new JButton("1"); JButton two = new JButton("2"); JButton three = new JButton("3"); JButton four = new JButton("4"); JButton five = new JButton("5"); JButton six = new JButton("6"); JButton seven = new JButton("7"); JButton eight = new JButton("8"); JButton nine = new JButton("9"); JButton zero = new JButton("0"); JButton multi = new JButton("*"); JButton divide = new JButton("/"); JButton equal = new JButton("="); JButton add = new JButton("+"); JButton subtract = new JButton("-"); JButton deci = new JButton("."); private final Font number= new Font("monspaced", Font.ITALIC, 20); JFrame guiFrame; private int counter; /** * @param args */ public GUIcalc() { super("Calculator"); sumfield = new JLabel(""+sum); sumfield.setLocation(0, 0); sumfield.setSize(245, 45); add(sumfield); seven=new JButton("7"); seven.setLocation(0,50); seven.setSize(50, 50); seven.addActionListener(this); add(seven); eight=new JButton("8"); eight.setLocation(55,50); eight.setSize(50, 50); eight.addActionListener(this); add(eight); nine=new JButton("9"); nine.setLocation(110,50); nine.setSize(50, 50); nine.addActionListener(this); add(nine); divide=new JButton("/"); divide.setLocation(165,50); divid…
tagged with: user-interface
answer count: 1
has answer: http://stackoverflow.com/a/25945139

http://stackoverflow.com/comment/100612102
score: 0
has text: DO above steps, and remove existing GlassFish Server and Add new same with changed port
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/31463126

http://stackoverflow.com/q/25946168
tagged with: python
has comment: http://stackoverflow.com/comment/40659963
type: UnansweredQuestion
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/40622088
tagged with: file
has body: 2.6 GB, binary file of 32-bit signed integers, 100 elements is each row. I can read line by line in Java with: DataInputStream dis = new DataInputStream(new FileInputStream("input.rawdata")) for(int i = 0; i &lt; 100; i++){ int idata = dis.readInt(); % DO THE NECESSARY TO LOAD idata IN A VARIABLE ARRAY % } dis.close(); But if I wish to read only 505th line without reading the initial 504 lines, then how to do it? Or if data is 100 x 1000 matrix and wish to read only the rectangle of 15 to 80th row &amp; 100 to 200th column. then how to achieve this in any of the above three languages (preferably Python &amp; Java). Suggestions related to code efficiency are very much welcome.
type: Question
has answer: http://stackoverflow.com/a/25946491
has comment: http://stackoverflow.com/comment/40627202
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/40620650
downvote count: 4
upvote count: 0
answer count: 1
tagged with: binary-data
favorite count: 0
has comment: http://stackoverflow.com/comment/40620740
has title: How to read part of big datafile in Python, C or Java?
has comment: http://stackoverflow.com/comment/40627622

http://stackoverflow.com/comment/40641064
type: AnswerComment
has text: Well, that is easy, version incompatibility. There is always someone to fix problems like this when the company refresh technology stacks. I do believe that if that is another problem, you should ask another question. This a Q&A site which means that someone will come to this question looking for a solution for wildfly deployment problems.
comment on: http://stackoverflow.com/a/25932648
score: 0
type: Comment

http://stackoverflow.com/comment/40678462
type: AnswerComment
comment on: http://stackoverflow.com/a/25977619
has text: @AbdulJabbarWebBestow, I don't understand the question? You use the mouse point from the MouseEvent and invoke the method.
score: 0
type: Comment

http://stackoverflow.com/a/29438986
has body: Simply override the toString() method. In that method, return whichever database value you want to retrieve. In my case, I returned a variable name that I needed (i.e. message) : @Override public String toString() { return message; }
answers question: http://stackoverflow.com/q/26014181
score: 0
type: Answer

http://stackoverflow.com/comment/40575079
comment on: http://stackoverflow.com/q/25920326
has text: @Pshemo yeap, i'm sure
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40630464
has text: Well, I am kind of cheating. I have Eclipse for Scala installed and working somehow, so the "simple Java program" was actually a "simple Scala program". However, I am not the only one detecting Java 1.6 installed. When I open Minecraft it also finds Java 1.6.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25952307
score: 0

http://stackoverflow.com/q/25988086
upvote count: 0
has body: I'm new to coding. My task is to get a total duration of all tracks in a playlist (in seconds). There is an accessor method called getDur in another class. There is also toString method that converts everything into seconds. This is my code. private ArrayList&lt;Track&gt; tracksN; public int getDurTotal() { for (Track b: tracksN) { int sum = 0; for (int i=0; i&lt;tracksN.size();i++) { sum += tracks.get(getDur(i)); } } return sum; } However, I'm getting an error message that says "method getDur in class PlayList cannot be applied to given type. Required: no arguments; Found: int; reason: actual and formal argument lists differ in length".
favorite count: 0
has comment: http://stackoverflow.com/comment/40696356
has answer: http://stackoverflow.com/a/25988126
has answer: http://stackoverflow.com/a/25988196
answer count: 4
accepted answer: http://stackoverflow.com/a/25988155
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25988126
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/40696277
score: -2
has title: Sum of ArrayList in a method
has answer: http://stackoverflow.com/a/25988150
tagged with: arraylist
has answer: http://stackoverflow.com/a/25988155
has comment: http://stackoverflow.com/comment/40696234

http://stackoverflow.com/q/26002383
answer count: 4
tagged with: java-stream
upvote count: 2
has title: How to do a parallel unique word count with Java 8 streams and lambdas?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36807341
tagged with: java
tagged with: mapreduce
type: Question
has body: What's the best way to do a parallel unique word count with Java 8 streams and lambdas? I've come up with a couple, but I'm not convinced they are optimal. I know the map reduce solution on Hadoop, and wonder if these give the same kind of parallelism. // Map Reduce Word Count Map&lt;String, Integer&gt; wordCount = Stream.of("dog","cat","dog","dog","cow","house","house").parallel().collect( Collectors.groupingBy(e-&gt;e,Collectors.summingInt(e -&gt; 1))); System.out.println("number of dogs = " + wordCount.get("dog")); Map&lt;Object, Object&gt; wordCount2 = Stream.of("dog","cat","dog","dog","cow","house","house").parallel().collect(Collectors.toConcurrentMap(keyWord-&gt;keyWord, keyWord-&gt;1, (oldVal,newVal)-&gt;(int)oldVal+(int)newVal)); System.out.println("number of dogs = " + wordCount2.get("dog")); Assume the real list would be much longer, possibly coming from a file or generated stream, and that I want to know the counts for all words, not just dog.
score: 2
has comment: http://stackoverflow.com/comment/40723195
downvote count: 0
has answer: http://stackoverflow.com/a/30431131
has answer: http://stackoverflow.com/a/31706973
has answer: http://stackoverflow.com/a/31705170
favorite count: 0
tagged with: word-count
has comment: http://stackoverflow.com/comment/40722487
tagged with: lambda

http://stackoverflow.com/a/25939027
upvote count: 3
downvote count: 0
has body: Use Collections.sort with a custom Comparator&lt;T&gt;: Collections.sort(times, new Comparator&lt;interval&gt;() { public int compare(interval a, interval b) { int res = Integer.compare(a.start, b.start); if (res != 0) return res; return Integer.compare(a.end, b.end); } }); Another way of coding this would be implementing the Comparable&lt;T&gt; interface in the interval class.
score: 3
type: Answer
answers question: http://stackoverflow.com/q/25938973

http://stackoverflow.com/q/26026424
has answer: http://stackoverflow.com/a/26027381
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/26027429
tagged with: k-means
has comment: http://stackoverflow.com/comment/40767028
tagged with: data-structures
has comment: http://stackoverflow.com/comment/40768245
upvote count: 2
answer count: 2
has title: HashMap speed greater for smaller maps
favorite count: 0
has comment: http://stackoverflow.com/comment/40767930
type: UnansweredQuestion
has body: This may be a strange question, but it is based on some results I get, using Java Map - is element retrieval speed greater in case of a HashMap, when the map is smaller? I have some part of code that uses containsKey and get(key) methods of a HashMap, and it seems that runs faster if number of elements in the Map is smaller? Is that so? My knowledge is that HashMap uses some hash function to access to certain field of a map, and there are versions in which that field is a reference to a linked list (because some keys can map to same value), or to other fields in the map, when implemented fully statically. Is this correct - speed can be greater if Map has less elements? I need to extend my question, with a concrete example. I have 2 cases, in both the total number of elements is same. In first case, I have 10 HashMaps, I'm not aware how elements are distributed. Time of execution of that part of algorithm is 141ms. In second case, I have 25 HashMaps, same total number of elements. Time of execution of same algorithm is 69ms. In both cases, I have a for loop that goes through each of the HashMaps, tries to find same elements, and to get elements if present. Can it be that the execution time is smaller, because individual search inside HashMap is smaller, so is there sum? I know that this is very strange, but is something like this somehow possible, or am I doing something wrong? Map(Integer,Double) is considered. It is hard to tell what is the distribution of elements, since it is actually an implementation of KMeans clustering algorithm, and the elements are representations of cluster centroids. That means that they will mostly depend on the initialization of the algorithm. And the total number of elements will not mostly be the same, but I have tried to simplify the problem, sorry if that was misleading.
linked to: http://stackoverflow.com/q/7115445
has comment: http://stackoverflow.com/comment/40766985
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40766837
has comment: http://stackoverflow.com/comment/40766515
tagged with: java

http://stackoverflow.com/q/25991191
tagged with: java
possible better answer: http://stackoverflow.com/a/33672834
score: 9
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/25991643
downvote count: 0
linked to: http://stackoverflow.com/q/25717778
has comment: http://stackoverflow.com/comment/40701861
has body: I have a logger class that makes use of a service. Each time a new logger is created, I expect to have access to the singleton scoped logging service. I autowire the logging service into the logger however, a null pointer exception is returned. I have tried a few solutions: manually defining the bean in the application context, Trying to get the logger to be spring managed but that just resulted in more issues. I am trying to get this to work in my junit tests, and I do specify the context file to make use of a different application context. However even if kept identical it does not resolve the issue. Please find code below: The following is an excerpt from the application context. &lt;context:component-scan base-package="com.platform"/&gt; &lt;bean id="asyncLoggingService" class="com.platform.services.AsyncLoggingServiceImplementation" scope="prototype"/&gt; The following is the Logger class. package com.platform.utils; import com.platform.services.AsyncLoggingService; import org.joda.time.DateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; public class OurLogger { private static Logger logger; @Autowired private AsyncLoggingervice asyncLoggingService; public OurLogger(Class Clazz) { logger = LoggerFactory.getLogger(Clazz); } public void trace(TraceableObject object, String message) { //Do nothing yet } } I then make use of the Logger in another service in order to log whats going on. (The reason I am writing another logger is to make use of an RabbitMQ server) In the service I instantiate a new instance of the Logger and then use it accordingly. @Service public class AsyncAccountServiceImplementation implements AsyncAccountService { private static final String GATEWAY_IP_BLOCK = "1"; private static OurLogger logger = new OurLogger(AsyncAccountServiceImplementation.class); ... } The null pointer occurs in the OurLogger when I try to call any method on the asyncLoggingService. I then am t…
has title: Spring autowired bean causes null pointer
has comment: http://stackoverflow.com/comment/40702022
linked to: http://stackoverflow.com/q/25738491
has comment: http://stackoverflow.com/comment/40702584
has comment: http://stackoverflow.com/comment/40702157
tagged with: junit
linked to: http://stackoverflow.com/q/812415
has answer: http://stackoverflow.com/a/25991352
has answer: http://stackoverflow.com/a/33672834
accepted answer: http://stackoverflow.com/a/25991352
favorite count: 0
has answer: http://stackoverflow.com/a/25991518
answer count: 5
has answer: http://stackoverflow.com/a/25991678
linked to: http://stackoverflow.com/q/25635845
tagged with: spring-annotations
tagged with: spring
tagged with: autowired
has comment: http://stackoverflow.com/comment/40701961
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40702052
has comment: http://stackoverflow.com/comment/40702393

http://stackoverflow.com/a/25929952
has body: Thats how: private PointF getPosition(PointF center, float radius, float angle) { PointF p = new PointF((float) (center.x + radius * Math.cos(Math.toRadians(angle))), (float) (center.y + radius* Math.sin(Math.toRadians(angle)))); return p; } This method calculates the position around the center of a circle (center of your view) depending on radius and angle. Angle in degrees. The returned PointF will contain the x- and y-coordinate of the calculated position. Be aware that 0 degrees is at the very east position of the circle, 270 degrees is in the very north position of the circle: So if the center of your view is at x: 100, y: 100 and you calculate the position with an angle of 0 degrees and a radius of 50, the result will be x: 150, y: 100 If you use angle 90 degrees and radius 50, the result will be x: 100, y: 150 It is used here in my charting libary, and it works.
has comment: http://stackoverflow.com/comment/40594799
accepted answer of: http://stackoverflow.com/q/25929820
type: Answer
has comment: http://stackoverflow.com/comment/40592899
has comment: http://stackoverflow.com/comment/40598621
has comment: http://stackoverflow.com/comment/40596930
score: 21
upvote count: 21
has comment: http://stackoverflow.com/comment/43690414
answers question: http://stackoverflow.com/q/25929820
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/71334926
downvote count: 0

http://stackoverflow.com/q/26022960
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26022989
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26023017
has answer: http://stackoverflow.com/a/26022989
has body: I'm trying to count consecutive letters in java using JOptionPane and when I try to compile and run my code I get this: exception in thread main java.lang.StringIndexOutOfBoundsException: String index out of range: 5 I feel like I have most of it down so I'm not exactly sure what's wrong here. Any help would be appreciated. My code: import javax.swing.JOptionPane; public class Project { public static void main(String[] args) { String input = JOptionPane.showInputDialog("Enter a string..."); while (true) { if (input.equals("Stop")) System.exit(0); else { int count = 0; int len = input.length(); for (int i = 0; i &lt; len; i++) { if (input.charAt(i) == input.charAt(i + 1)) count++; } JOptionPane.showMessageDialog(null, "There are " + count + "pairs of consecutive letters."); input = JOptionPane.showInputDialog(null, "Enter a string..."); } } } }
type: AnsweredQuestion
has title: Counting consecutive letters in java using JOptionPane?
has answer: http://stackoverflow.com/a/26023017
has comment: http://stackoverflow.com/comment/40759586

http://stackoverflow.com/q/25882336
has answer: http://stackoverflow.com/a/25882360
score: -1
tagged with: stringtokenizer
tagged with: runtimeexception
has comment: http://stackoverflow.com/comment/40505683
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25882360
has title: NoSuchElementException error
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40505672
has body: I am trying to see if the next token in a string is equivalent to map key, and adding a message to an array list. ArrayList&lt;String&gt; trace = new ArrayList&lt;String&gt;(); if(!element.startsWith("PRINT")) { while(st.hasMoreTokens()) { tokens.add(st.nextToken()); } for(String key: expression.keySet()) if(st.nextToken() == key) trace.add(key + "Changed from " + expression.get(key) + " to " + tokens.get(2)); expression.put(tokens.get(0),Integer.parseInt(tokens.get(2))); tokens.clear(); } ERROR MESSAGE Exception in thread "main" java.util.NoSuchElementException at java.util.StringTokenizer.nextToken(StringTokenizer.java:349) at Commander.main(Commander.java:45)
has comment: http://stackoverflow.com/comment/40505656
downvote count: 1
type: Question
tagged with: nosuchelementexception
tagged with: java

integrity
type: Tag
tags question: http://stackoverflow.com/q/25930946
tag name: integrity

http://stackoverflow.com/q/25921226
tagged with: android
has comment: http://stackoverflow.com/comment/40578463
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40596665
score: 0
has answer: http://stackoverflow.com/a/25940172
has title: Intent extra doesn't return to previous fragment on onActivityResult
tagged with: android-intent
type: Question
has body: I open a DatePickerFragment and select a new date but the date doesn't return with the intent extra to the previous fragment. I'm not sure why and a closer inspection using the debugger says "java.lang.ClassNotFoundException: [LObject;" when the method reaches that breakpoint on the code. I'm following the BigNerdRanch Tutorial. Here is my CrimeFragment public class CrimeFragment extends Fragment { private Crime mCrime; private EditText mTitleField; private Button mDateButton; private CheckBox mSolvedCheckBox; public static final String EXTRA_CRIME_ID = "xxx.com.criminalintent.crime_id"; public static final String DIALOG_DATE = "date"; public static final int REQUEST_DATE = 0; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); UUID crimeId = (UUID)getArguments().getSerializable(EXTRA_CRIME_ID); mCrime = CrimeLab.get(getActivity()).getCrime(crimeId); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState){ View v = inflater.inflate(R.layout.fragment_crime, parent, false); mTitleField = (EditText)v.findViewById(R.id.crime_title); mTitleField.setText(mCrime.getTitle()); mTitleField.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence c, int start, int count, int after) { //Left blank } @Override public void onTextChanged(CharSequence c, int start, int before, int count) { mCrime.setTitle(c.toString()); } @Override public void afterTextChanged(Editable c) { // Left blank } }); mDateButton = (Button)v.findViewById(R.id.crime_date); updateDate(); mDateButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { FragmentManager fm = getActivity() .getSupportFragmentManager(); DatePickerFragment dialog = DatePickerFragment .newInstance(mCrime.getDate()); dialog.setTargetFragment(CrimeFragment.this, REQUEST_DATE); dialog.show(fm, DIALOG_DATE); } }); mSolvedCheckBox = (CheckBox)v.findViewById(R.id.crime_solved); mSol…
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/40610589
accepted answer: http://stackoverflow.com/a/25940172
answer count: 1

http://stackoverflow.com/comment/40751567
has text: Probably more SO correct is to close this question as a duplicate.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26017457

http://stackoverflow.com/comment/40735686
score: 2
comment on: http://stackoverflow.com/q/26009277
type: Comment
type: QuestionComment
has text: Don't read jar resources a a `File`. That's probably your first problem, if that's what you are doing. Read it as a resource with `getClass().getResourceAsStream()` or one of it's variants. Second, I wouldn't try to read files directly from A using paths dependent on jar B. Instead just create a class in project B that will serve up its resources. And just call that class/method from project A

http://stackoverflow.com/comment/40880711
comment on: http://stackoverflow.com/q/26015524
type: Comment
type: QuestionComment
has text: @Jiang I am making it as a prototype/proof of concept for my research project. It is about automating workflows. I am making test case workflow. This is a scientific workflow, search DNAs, convert to protein, find homology, protein modeling and in the end model verification. Each step uses various services.
score: 0

arguments
tags question: http://stackoverflow.com/q/25914396
type: Tag
tag name: arguments

http://stackoverflow.com/a/25973815
downvote count: 0
has body: I think you should remove the params object on the delete action or rename the parameter to speakerId, because otherwise AngularJS cant set the url parameter in the resource (your url placeholder is speakerId, but your property is named id)
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25973575
type: Answer
answers question: http://stackoverflow.com/q/25973575
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40670209

http://stackoverflow.com/comment/77317914
type: Comment
has text: With CDI it's possible to inject primitive types or objects that are not beans themselves. Is that also valid with Spring? Also when I got this right, the concepts are different: while CDI allows for every bean to produce an injectable object, in Spring only classes annotated with @Configuration can produce Beans (otherwise in Lite mode). The intentions are different...
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25876753

http://stackoverflow.com/comment/40568862
type: Comment
has text: I'm running excecuteCommand from controller (aggiungi and Wait are two differents classes). I'm going to try Kettle with a different thread :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25917134

http://stackoverflow.com/q/26019123
accepted answer: http://stackoverflow.com/a/26019290
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/26019260
type: Question
score: 3
has answer: http://stackoverflow.com/a/26019260
tagged with: compareto
has comment: http://stackoverflow.com/comment/40752482
tagged with: comparator
answer count: 2
has comment: http://stackoverflow.com/comment/40753419
downvote count: 0
favorite count: 0
has title: How to have a TreeSet which is "inconsistent with equals"
tagged with: equals
has answer: http://stackoverflow.com/a/26019290
has body: I have read numerous posts about TreeSets, Comparable/Comparator Interfaces, equals, compareTo, compare methods and I know that API says you have to make your ordering "consistent with equals" or weird things might happen. But in my case and I think this is a fairly general case, I really do need a TreeSet ordering which is "inconsistent with equals". Lets say we are doing some kind of heuristic search and we are expanding (or generating) new states starting from a root(initial) state. And we put new (expanded/generated) states into a TreeSet which we usually call open list. We would like to use the TreeSet container because we dont want duplicate states in our open list. Every state generated/expanded is evaluated by a cost function and given a heuristic value which shows the quality of the state. We want the TreeSet (open list) ordered by this value. We want to have the best states (which has the best cost value) at the top of the TreeSet. Now here comes the problem. To accommodate the ordering by cost value we need to give the TreeSet a comparator which compares the cost values. But, two different states can have the same cost/heuristic value. I want to have both of these states on my open list because they are not "equal". But comparator needs to return 0 from the compare method because they have the same cost value. And because this, different states with the same cost value will not be inserted into the list. I want to give a simple example to make this more understandable. Lets say our states are strings showing binary data and the cost function counts the number of "1"s in the string. Lets say these are the generated states and their respective cost values. No State Cost 1 01001001 3 2 01101001 4 3 10001001 3 4 01001111 5 As you can see all these 4 states are different. They are "not equal". But even though state-1 and state-3 are different, they have the same cost value "3". So when we order our TreeSet by cost, state-3 will not be added to the TreeSet beca…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40752461
has comment: http://stackoverflow.com/comment/40752419
tagged with: treeset

http://stackoverflow.com/a/25882324
score: 1
answers question: http://stackoverflow.com/q/25881024
upvote count: 1
type: Answer
has body: Not sure if it is desired, but if you are using ObjectMapper you can do the following: 1) Remove @JsonFormat(shape= JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss"). I also added @JsonRootName for the way you showed your input data. @JsonRootName("item") @JsonInclude(JsonInclude.Include.NON_NULL) public class Item { public String title; public Date expires; @Override public String toString() { return "Item{" + "title='" + title + '\'' + ", expires=" + expires + '}'; } } 2) And configure the ObjectMapper with the DateFormat you want to use: mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:s")); Here is the full example I tested with: public class Test { private static final String T1 = "{\n"+ " \"item\" : {\n"+ " \"title\": \"Some title\",\n"+ " \"expires\": \"2014-11-02 00:00:00\"\n"+ " }\n"+ "}"; private static final String T2 = "{\n" + " \"item\" : {\n" + " \"title\": \"null\",\n" + " \"expires\": \"2014-11-02 00:00:00\"\n" + " }\n" + "}"; private static final String T3 = "{\n" + " \"item\" : {\n" + " \"title\": \"Some title\",\n" + " \"expires\": \"null\"\n" + " }\n" + "}"; public static void main(String[] args) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:s")); Item t1 = mapper.readValue(T1, Item.class); Item t2 = mapper.readValue(T2, Item.class); Item t3 = mapper.readValue(T3, Item.class); System.out.println(t1); System.out.println(t2); System.out.println(t3); System.out.println(mapper.writeValueAsString(t1)); System.out.println(mapper.writeValueAsString(t2)); System.out.println(mapper.writeValueAsString(t3)); } } Results. Last printout shows how the @JsonInclude affects the output, and how the serialization of the input String 'null' is done with this configuration: Item{title='Some title', expires=Sun Nov 02 00:00:00 PDT 2014} Item{title='null', expires=Sun Nov 02 00:00:00 PDT 2014} Item{title='Some …
downvote count: 0

http://stackoverflow.com/comment/40525611
type: QuestionComment
comment on: http://stackoverflow.com/q/25893560
has text: @LuísRamalho Aha! Not quite yet ;)
score: 0
type: Comment

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/25884935
tag name: google-oauth

http://stackoverflow.com/a/25944423
has comment: http://stackoverflow.com/comment/40618502
answers question: http://stackoverflow.com/q/25944310
has comment: http://stackoverflow.com/comment/40618425
has body: //two overload method to make a deposit from account public void deposit(double depositAmount) { balance += depositAmount; } public void deposit(int depositAmount) { balance += depositAmount; } Yes, these are overloaded methods. You did it correctly.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40618447
has comment: http://stackoverflow.com/comment/40618405
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25944310
has comment: http://stackoverflow.com/comment/40618549

http://stackoverflow.com/comment/40659478
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25967906
has text: excuse my question, but when i look at your images i can't really detect a circle - can you tell my yur zoom factor? i mean: whats the distance between your point and the circle (d) using what radius (r)... seems like a rounding error to me...
score: 0

http://stackoverflow.com/comment/40717054
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25980294
has text: Hi @nishantjaisinghani, that is a very complex question to answer in the comments. I think you should accept this answer and start a new question for that

http://stackoverflow.com/a/26429125
type: Answer
has body: Download the newest version of Java for OS X 2014-001 from Apple. http://support.apple.com/kb/DL1572?viewlocale=en_US&amp;locale=en_US I encountered the same error this morning and this was a quick and easy fix.
has comment: http://stackoverflow.com/comment/42146993
answers question: http://stackoverflow.com/q/25914757
has comment: http://stackoverflow.com/comment/69202793
has comment: http://stackoverflow.com/comment/41635397
has comment: http://stackoverflow.com/comment/41612956
has comment: http://stackoverflow.com/comment/55420632
has comment: http://stackoverflow.com/comment/49395528
upvote count: 69
type: AcceptedAnswer
downvote count: 0
score: 69
accepted answer of: http://stackoverflow.com/q/25914757

http://stackoverflow.com/q/26017291
tagged with: spring-mvc
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40749542
has comment: http://stackoverflow.com/comment/40749647
score: 0
has comment: http://stackoverflow.com/comment/40749802
has title: Always shows 404 error page with spring
tagged with: jsp
has body: I am trying to fetch data from Spring mvc jdbc template and display in table format .But always the 404 error comes up. package com.sample.complaint.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.sample.domain.TrackComplaints; import com.sample.services.TrackComplaintsService; @Controller public class TrackComplaintsController { @Autowired ComplaintsService complaintservice; @RequestMapping("/userList" ) public ModelAndView Complaints() { List<Complaints> complaintlist = complaintservice.getComplaintsList(); return new ModelAndView("userList", "Complaints", complaintlist); } } My ApplicationContect.xml //dispatcher servlet <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <mvc:default-servlet-handler /> <context:annotation-config /> <context:component-scan base-package="com.sample.*" /> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> <!-Datasource code is present--!> </beans> web.xml <?xml version="1.0" encoding="UTF-8"?> SpringJDBCTemplate index.jsp ApplicationContext org.springframework.web.servlet.DispatcherServlet 1 ApplicationContext / userList.jsp %@ page language="java" conten…
has comment: http://stackoverflow.com/comment/40749689
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: spring

http://stackoverflow.com/a/26002077
accepted answer of: http://stackoverflow.com/q/26001865
has comment: http://stackoverflow.com/comment/40722039
answers question: http://stackoverflow.com/q/26001865
has comment: http://stackoverflow.com/comment/40722329
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40722667
type: Answer
score: 1
has body: Yep that's how Struts works. If you don't want the populate method to run, add another action tag for "showing" the page. So making you're struts XML like this, means /ShowRegister will render the page. Then you post the form to the /Register and it will actually run the populate method and do the work for you. <struts> /success.jsp /register.jsp /register.jsp /success.jsp This is a good doc on the Struts Arch. http://www.roseindia.net/struts/struts2/struts-2-architecture.shtml
upvote count: 1

http://stackoverflow.com/q/26033320
has body: im lookin a way how to force close app like when using ` Settings -> application->installed->MyApp ->Force close. ` It's possible? im just tested threed and put there Toast , and it's make toast always while app not force closed. I want when i leave from my app - just Fully close my app. :) please
accepted answer: http://stackoverflow.com/a/26033522
score: -1
tagged with: forceclose
answer count: 3
has answer: http://stackoverflow.com/a/26033522
downvote count: 1
has comment: http://stackoverflow.com/comment/40778687
favorite count: 0
has comment: http://stackoverflow.com/comment/40778685
possible better answer: http://stackoverflow.com/a/26033417
tagged with: android
has answer: http://stackoverflow.com/a/26033417
has comment: http://stackoverflow.com/comment/40778561
has title: Force close app as in a settings by code
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/40778662
has answer: http://stackoverflow.com/a/26033425
tagged with: java
has comment: http://stackoverflow.com/comment/40778718
has comment: http://stackoverflow.com/comment/40778602
linked to: http://stackoverflow.com/q/6330200
linked to: http://stackoverflow.com/q/2033914
type: Question

http://stackoverflow.com/comment/40637572
has text: I don't think the choice of IDE should really matter, as long as it has the capabilities to do what he needs, it's just a matter of testing it out on several other IDE's to ensure that the problem is not the IDE itself. I personally don't know anything about Android Studio, have you tried using SDK's like this on that specific IDE?
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25955947

game-physics
tags question: http://stackoverflow.com/q/25962602
tag name: game-physics
type: Tag

http://stackoverflow.com/comment/40543733
type: AnswerComment
has text: how come under the part where it is checking the columns, in the for loop it says int r = 0 and then i < array.length? two different variables?
type: Comment
comment on: http://stackoverflow.com/a/25903342
score: 0

http://stackoverflow.com/a/25918781
answers question: http://stackoverflow.com/q/25918711
has comment: http://stackoverflow.com/comment/40572866
score: 1
has comment: http://stackoverflow.com/comment/40572446
has body: Put connection information in a property file, and replace your hard-coded values with references to properties. A better approach is to use a framework for all this, like Spring Data: http://spring.io/guides/gs/accessing-data-jpa/ This tutorial shows you how to do this in the context.xml file which you can configure Apache Tomcat to reread: http://www.codejava.net/frameworks/spring/configuring-spring-mvc-jdbctemplate-with-jndi-data-source-in-tomcat
downvote count: 0
has comment: http://stackoverflow.com/comment/40572323
type: Answer
has comment: http://stackoverflow.com/comment/40572026
upvote count: 1

http://stackoverflow.com/q/25920027
type: Question
tagged with: java
score: -1
tagged with: jfilechooser
has answer: http://stackoverflow.com/a/25920212
upvote count: 0
tagged with: user-interface
answer count: 1
favorite count: 0
has body: I am working on a simple GUI for a program that allows users to select a properties file to run with. I have a JFileChooser that allows the user to select their properties file. I want to make it so if a file is not chosen with the JFileChooser, a default file found in the root directory of my Project folder will be used instead. This file will then be added to a list&lt; string > to be used with ProcessBuilder in order to run the actual program. This GUI will eventually be exported to a runnable jar file. But, for some reason, I can't add the default file to the list even though it's in the root directory; I should have access to it if it's stored in the root directory. When I print out the file's path, it shows that it is stored in my workspace and can access it but it won't add it into the list&lt; string >. Any ideas on how to do this? Here's some of my code: public void createCommand() { List&lt;string&gt; commands = new ArrayList&lt;string&gt;() commands.add("cmd.exe"); commands.add("/k"); command.add("java"); command.add("-jar"); commands.add("\"" + filepathtojar + "\\" + "testjar.jar"); File user_default = new File("user.default.properties"); //user.default.properties is in the root directory of the project String propertypath = getPropertyFilePath(); if(propertypath.isEmpty()) // nothing is chosen in the JFileChooser { commands.add("-c"); System.out.println("default file's path is: " + user_default.getAbsolutePath()); commands.add(user_default.getAbsolutePath()); } else // if a file is chosen in the JFileChooser { commands.add("-c"); commands.add(propertypath); } ProcessBuilder testprocess = new ProcessBuilder(commands); ... Etc. } And my getPropertyFilePath() method is this: //this method is in another class public void getPropertyFilePath() { //returns the path to the PROPERTIES file chosen in the JFileChooser return filechosenfromjfile.getAbsolutePath(); } When I print out commands, this is what comes out if a properties file isn't chosen with the JFileC…
has title: Access default file in Java project if JFileChooser is not used
has comment: http://stackoverflow.com/comment/40575018
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40575442
has comment: http://stackoverflow.com/comment/40574617
downvote count: 1

http://stackoverflow.com/comment/40623160
score: 0
type: Comment
type: QuestionComment
has text: *"...when i input value more then it is inside if used."* Huh?
comment on: http://stackoverflow.com/q/25947796

http://stackoverflow.com/q/25945854
has comment: http://stackoverflow.com/comment/82463505
upvote count: 6
type: AnsweredQuestion
tagged with: performance
has title: What is the difference between split method in String class and the split method in Apache StringUtils?
tagged with: java
accepted answer: http://stackoverflow.com/a/25946080
type: Question
has body: I am reading a file line by line and want to split each line on the basis of specific delimiter.I found some options available in String class and StringUtils class. So my question is which is the better option to use and why?
has comment: http://stackoverflow.com/comment/40620294
possible better answer: http://stackoverflow.com/a/25945908
tagged with: string-utils
has answer: http://stackoverflow.com/a/25945908
answer count: 3
has answer: http://stackoverflow.com/a/39410700
downvote count: 0
has comment: http://stackoverflow.com/comment/40620973
tagged with: string
has answer: http://stackoverflow.com/a/25946080
favorite count: 0
score: 6

http://stackoverflow.com/a/25996647
type: Answer
score: 3
upvote count: 3
has body: Use an ExecutorService to create the tasks in order. Use executor.invokeAll to invoke (start) the threads / tasks. Use future.get() to the results of the tasks in the order it was submitted. ExecutorService executor = Executors.newFixedThreadPool(numberOfThread); List&lt;Task&gt; threads = new ArrayList&lt;&gt;(); // create the threads for (Integer key_ : dbIdList) { threads.add(new Task(key_)); } try { //launch the threads List&lt;Future&lt;String&gt;&gt; futures = executor.invokeAll(threads); //read results for (Future&lt;String&gt; future_ : futures) { System.out.println(future_.get()); // this preserves the order of the tasks } } catch (Exception e) { } finally { //shut down executor.shutdown(); } Thread class which does the task: class Task implements Callable&lt;String&gt; { Integer dbId = null; @Override public String call() throws Exception { //do whatever works needs to be done return output; } public Task(int dbId_) { this.dbId = dbId_; } }
answers question: http://stackoverflow.com/q/25996404
downvote count: 0

http://stackoverflow.com/comment/40543419
score: 0
type: AnswerComment
has text: +1. Note that "blocking" refers to `take`. Your consumer will wait until an element to process is available (which is what you probably want anyway). `put` does not need to wait.
comment on: http://stackoverflow.com/a/25903192
type: Comment

http://stackoverflow.com/q/25997291
tagged with: apache-curator
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/26000877
tagged with: java
tagged with: timeout
has comment: http://stackoverflow.com/comment/40722360
tagged with: apache-zookeeper
has title: Curator with Zookeeper Service Discovery connection forcibly closed
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26000877
has body: I am trying out service discovery using Curator and Zookeeper. The following is occurring when I try to register my service. 2014-09-23 16:36:09,755 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@197] - Accepted socket connection from /127.0.0.1:52026 2014-09-23 16:36:09,759 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@868] - Client attempting to establish new session at /127.0.0.1:52026 2014-09-23 16:36:09,790 [myid:] - INFO [SyncThread:0:ZooKeeperServer@617] - Established session 0x148a17bad590007 with negotiated timeout 40000 for client /127.0.0.1:52026 2014-09-23 16:36:11,735 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@362] - Exception causing close of session 0x148a17bad590007 due to java.io.IOException: An existing con nection was forcibly closed by the remote host 2014-09-23 16:36:11,736 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1007] - Closed socket connection for client /127.0.0.1:52026 which had sessionid 0x148a17bad590007 2014-09-23 16:36:32,001 [myid:] - INFO [SessionTracker:ZooKeeperServer@347] - Expiring session 0x148a17bad590006, timeout of 40000ms exceeded 2014-09-23 16:36:32,001 [myid:] - INFO [ProcessThread(sid:0 cport:-1)::PrepRequestProcessor@494] - Processed session termination for sessionid: 0x148a17bad590006 2014-09-23 16:36:52,000 [myid:] - INFO [SessionTracker:ZooKeeperServer@347] - Expiring session 0x148a17bad590007, timeout of 40000ms exceeded 2014-09-23 16:36:52,001 [myid:] - INFO [ProcessThread(sid:0 cport:-1)::PrepRequestProcessor@494] - Processed session termination for sessionid: 0x148a17bad590007 The relevant code is as follows: (the getDiscovery method is the one which results in the above errors) private ServiceDiscovery&lt;InstanceDetails&gt; getDiscovery() { return ServiceDiscoveryBuilder.builder(InstanceDetails.class) .basePath(Config.basePath) .client(curatorFramework) .serializer(jacksonInstanceSerializer) .bu…
favorite count: 0
tagged with: service-discovery

http://stackoverflow.com/comment/40741563
score: 0
has text: The list is created and each item shows a string which identifies the activity bookmarked and a button to aaccess it. What doesn't work is displaying the name of the string
type: QuestionComment
comment on: http://stackoverflow.com/q/26012348
type: Comment

http://stackoverflow.com/a/26005051
type: Answer
answers question: http://stackoverflow.com/q/26004871
has body: You are making an assumption that is not true. Namely that your thread that does the work of retrieving the string from the server will finish before you show the Toast. In onClick, you have started a background thread where the work is done to retrieve string2. However, you immediately show a toast (on the main UI thread) and include the current value of string2. Because the background thread hasn't finished yet, string2 will not yet have been updated. You should instead use an AsyncTask. Do the DataOutputStream stuff in doInBackground and update your UI (show the Toast) in onPostExecute. This will guarantee the order you desire. http://developer.android.com/reference/android/os/AsyncTask.html There are tons of other posts about AsyncTask here on Stack Overflow.
accepted answer of: http://stackoverflow.com/q/26004871
has comment: http://stackoverflow.com/comment/40729443
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25954302
upvote count: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/8535469
type: Question
linked to: http://stackoverflow.com/q/8535469
answer count: 1
score: -1
has title: Is there a way I can use the FileReader method to read multiple text files?
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: Here is what I have so far. It successfully reads chapter 1.txt and puts it into book.txt however, I need to have it accept 2 more chapters and this is where I am at a loss. Is there a way I can use the FileReader method to read multiple text files? import java.io.*; import java.util.*; public class CatFiles { public static void main(String[] args) throws FileNotFoundException, IOException { File compiledChapters = new File("Book.txt"); if(!compiledChapters.exists()) { compiledChapters.createNewFile(); } FileReader myReader = new FileReader("chapter 1.txt"); Scanner myScanner = new Scanner(myReader); PrintWriter myWriter = new PrintWriter("Book.txt"); while(myScanner.hasNextLine()) { String textLine = myScanner.nextLine(); myWriter.println(textLine); } myReader.close(); myWriter.close(); } }
has answer: http://stackoverflow.com/a/25954351

http://stackoverflow.com/q/25979298
tagged with: methods
has answer: http://stackoverflow.com/a/25979376
type: Question
has answer: http://stackoverflow.com/a/25979388
accepted answer: http://stackoverflow.com/a/25979388
tagged with: arrays
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25979410
favorite count: 0
has body: I have two classes LoanBook &amp; STLoanBook, STLoanBook is an extension of LoanBook. These are both inside the same array: private static final LoanBook[] books = new LoanBook[50]; books[0] = new STLoanBook("B129", "Soil Mechanics", "Engineering"); books[1] = new LoanBook("B238", "Basic Biology", "Science"); books[2] = new LoanBook("B563", "Company Law", "Business"); books[3] = new STLoanBook("B342", "Cost Accounting", "Business"); books[4] = new LoanBook("B754", "Robotics", "Engineering"); I am trying to call a function reserve() that is only within STLoanBook, when I call it through a for loop, it tells me that reserve() doesn't exist as it is checking LoanBook class. How can I fix this, as I've got the loop already checking the class SimpleName(), but it seems to still error. Help!
answer count: 5
possible better answer: http://stackoverflow.com/a/25979376
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/25979382
tagged with: java
has title: Calling extended class function in same arrray Java
has answer: http://stackoverflow.com/a/25982725

http://stackoverflow.com/a/25892223
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25892107
has body: It is because mFooA = new FooA[12]; will create only instance of array, not FooA instances. Each element of array initially will be null and you may create each instance separatly.

ondraw
type: Tag
tag name: ondraw
tags question: http://stackoverflow.com/q/25998446

http://stackoverflow.com/comment/40495759
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25876922
type: Comment
has text: hate autocorrect yes you are correct i meant pin code.

http://stackoverflow.com/q/25881648
accepted answer: http://stackoverflow.com/a/25881669
type: Question
tagged with: split
upvote count: 0
answer count: 1
favorite count: 0
has title: splitting or tokenize comma with space and comma[JAVA]
has comment: http://stackoverflow.com/comment/40504946
has body: January 22, 2014 I want to split the string into three but the second has , and space
has answer: http://stackoverflow.com/a/25881669
has comment: http://stackoverflow.com/comment/40504541
downvote count: 1
type: AnsweredQuestion
tagged with: tokenize
tagged with: java
score: -1

http://stackoverflow.com/comment/53235445
has text: @YonatanNir: Yes, it goes inside of `<build><plugins>`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25994477
type: Comment

http://stackoverflow.com/q/25977150
score: -1
has body: Error: Error: Main method not found in class app, please define the main method as: public static void main(String[] args) Code: class app { public static void main(String[] args) { double accounts[]; accounts=new double[100]; accounts[2]=1225.33; System.out.println("Account 2 is overdue by $"+accounts[2]); } } I am using EditPlus to run and execute this program.
linked to: http://stackoverflow.com/q/3005433
has title: Error: Main method not found in class. can anybody will give me a proper solution for this error please
tagged with: java
has answer: http://stackoverflow.com/a/25977179
has comment: http://stackoverflow.com/comment/40676052
has comment: http://stackoverflow.com/comment/40676707
has comment: http://stackoverflow.com/comment/40676733
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40678982
has comment: http://stackoverflow.com/comment/40678824
has comment: http://stackoverflow.com/comment/40676322
has comment: http://stackoverflow.com/comment/40678679
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/40676239
has answer: http://stackoverflow.com/a/25977599
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26020509
type: Answer
answers question: http://stackoverflow.com/q/26019323
has body: As already suggested you are indeed mixing up the servletContext and the applicationContext. Either have your servletContext(applicationContext.xml file) import the springmvc.xml file or put the mvc-annotation-driven tag in the applicationContext.xml file. Either way you should read up on how to structure your contexts properly.
score: 0

http://stackoverflow.com/q/25896499
score: 0
has answer: http://stackoverflow.com/a/25898019
tagged with: spring-bean
linked to: http://stackoverflow.com/q/13864787
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40531302
duplicate of: http://stackoverflow.com/q/13864787
tagged with: spring
tagged with: java
has body: I would like to ask about the Spring Constructor Injection. So in the class, I have two constructors with different number of arguments. public class MyClassHello() { public MyClassHello(String A) { // do sth } public MyClassHello(String A, int B){ // do sth } } If I try to inject like this to access the 1st constructor, Spring can not work since there is ambiguity. &lt;bean id="injectQuestion" class="MyClassHello"&gt; &lt;constructor-arg index="0" value="A String"/&gt; &lt;/bean&gt; The debug code is like this: Unsatisfied dependency expressed through constructor argument with index 1 of type [java.lang.String]: Ambiguous constructor argument types. I think it means, Spring needs to know if the index 1 argument exists? It is not like the usual case where we have two constructors with same number of arguments. Like that, I could set the type in order to distinguish when injecting. In my case, is there anyway to force Spring to choose the first constructor? Thanks a lot!!
has title: Spring injection issue with constructor-arg overload
tagged with: code-injection
type: Question
tagged with: constructor-injection
has comment: http://stackoverflow.com/comment/40533885
answer count: 1

http://stackoverflow.com/comment/40588325
type: Comment
comment on: http://stackoverflow.com/a/25927008
score: 0
type: AnswerComment
has text: so you want to capture from content 1 to content n without newline character?

http://stackoverflow.com/comment/40563160
score: 0
type: Comment
type: QuestionComment
has text: Thanks @Wizard I will try, but how about replacing values in sub objects ? Can i do like `myClass.getDocument().append("aDictionnary.actionId", myVal )` ?
comment on: http://stackoverflow.com/q/25913281

http://stackoverflow.com/a/25926455
score: 0
has body: You need to set itemclicklistner for your AutoCompleteTextView editAssignee &amp; use BaseAdapter instead of ArrayAdapter. Pass ArrayList of your custom object which contain both id &amp; string value to baseadapter. Custom object can be public class item{ String id; String value; } Now onClickItem you can get both id &amp; value from your Arraylist
answers question: http://stackoverflow.com/q/25925398
has comment: http://stackoverflow.com/comment/40599341
has comment: http://stackoverflow.com/comment/40587248
has comment: http://stackoverflow.com/comment/40590335
type: Answer

http://stackoverflow.com/q/26003184
has answer: http://stackoverflow.com/a/26003950
tagged with: activemq-classic
tagged with: java
tagged with: multithreading
score: 6
type: Question
possible better answer: http://stackoverflow.com/a/26003950
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40723647
has answer: http://stackoverflow.com/a/26003451
tagged with: apache-camel
answer count: 3
has body: Background At a high level, I have a Java application in which certain events should trigger a certain action to be taken for the current user. However, the events may be very frequent, and the action is always the same. So when the first event happens, I would like to schedule the action for some point in the near future (e.g. 5 minutes). During that window of time, subsequent events should take no action, because the application sees that there's already an action scheduled. Once the scheduled action executes, we're back to Step 1 and the next event starts the cycle over again. My thought is to implement this filtering and throttling mechanism by embedding an in-memory ActiveMQ instance within the application itself (I don't care about queue persistence). I believe that JMS 2.0 supports this concept of delayed delivery, with delayed messages sitting in a "staging queue" until it's time for delivery to the real destination. However, I also believe that ActiveMQ does not yet support the JMS 2.0 spec... so I'm thinking about mimicking the same behavior with time-to-live (TTL) values and Dead Letter Queue (DLQ) handling. Basically, my message producer code would put messages on a dummy staging queue from which no consumers ever pull anything. Messages would be placed with a 5-minute TTL value, and upon expiration ActiveMQ would dump them into a DLQ. That's the queue from which my message consumers would actually consume the messages. Question I don't think I want to actually consume from the "default" DLQ, because I have no idea what other internal things ActiveMQ might dump there that are completely unrelated to my application code. So I think it would be best for my dummy staging queue to have its own custom DLQ. I've only seen one page of ActiveMQ documentation which discusses DLQ config, and it only addresses XML config files for a standalone ActiveMQ installation (not an in-memory broker embedded within an app). Is it possible to programmatically configure a cust…
downvote count: 0
tagged with: jms
has title: Can you programmatically alter a queue's "dead letter" handling in a Java embedded broker?
has answer: http://stackoverflow.com/a/26041520
favorite count: 0
accepted answer: http://stackoverflow.com/a/26003451
upvote count: 6

http://stackoverflow.com/comment/41166972
comment on: http://stackoverflow.com/a/25913510
has text: I believe this is achievable via the Java read/write lock where if a thread is attempting to acquire a read lock, its type must be checked to see if it is the current type of thread allowed. If it is, it is granted a read lock, if it's not, it will attempt to acquire the write lock. From my limited understanding of Java read/write locks, a writelock disallows any more granting of readlocks and waits until all threads with read locks are finished to write. In my case the write would write its thread type to the resource so that this different thread type could read the resource next.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26032192
type: Answer
has body: Just capture the part before the number within () to another group, ArrayList&lt;String&gt; portfolioCount = new ArrayList&lt;String&gt;(); String mainText = "USA (45)"; final Pattern p = Pattern.compile("(\\S+)\\s+\\((.*?)\\)"); final Matcher m = p.matcher(mainText); while(m.find()){ portfolioCount.add(m.group(1)); portfolioCount.add(m.group(2)); System.out.println(portfolioCount); } Output [USA, 45] To store the country name and count into two separate lists, ArrayList&lt;String&gt; portfolioCount = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; country = new ArrayList&lt;String&gt;(); String mainText = "USA (45)"; final Pattern p = Pattern.compile("(\\S+)\\s+\\((.*?)\\)"); final Matcher m = p.matcher(mainText); while(m.find()){ portfolioCount.add(m.group(1)); country.add(m.group(2)); System.out.println(portfolioCount); System.out.println(country); } Output: [USA] [45]
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26032100
downvote count: 0

http://stackoverflow.com/a/25891203
type: Answer
score: 2
upvote count: 2
has body: With setVisible(false), if the Component is not already marked invisible, setVisible calls invalidate() which invalidates the Container’s layout and the chain of parents since there is now more screen real estate in the Container and the positions of the siblings must be adjusted to flow into the freed space. API of Component. But the ICONFIED is doing the minimize process of a window.
answers question: http://stackoverflow.com/q/25887915
downvote count: 0

http://stackoverflow.com/a/25964169
has body: The error message is pretty clear: [INFO] [talledLocalContainer] JBAS014775: New missing/unsatisfied dependencies: [INFO] [talledLocalContainer] service jboss.naming.context.java.app.earth.env.EarthDS (missing) dependents: [service jboss.persistenceunit."earth.war#earth".FIRST_PHASE] [ Do you have the data source created ?
has comment: http://stackoverflow.com/comment/40652341
answers question: http://stackoverflow.com/q/25951175
has comment: http://stackoverflow.com/comment/62849358
type: Answer
downvote count: 8
score: -3
upvote count: 5

http://stackoverflow.com/a/28285346
upvote count: 1
downvote count: 0
type: Answer
has body: I used Mike's answer with the following change, to make the returned css selector, shorter. Update: Also using name attribute to shorten the css selector and checking each iteration if the selector, so far, returns a single element on the page Update: As @10basetom pointed out in the comments, in situations where the element doesn't have a unique id or a unique class name or a unique class name + name attribute, the method might produce a non unique css path, but it will produce the shortest css selector in other cases. So, I suggest to check the css path result using document.querySelectorAll(result).length === 1 and fallback on other methods described here function getShortestSelector(element) { var selector = element.id; // if we have an ID, that's all we need. IDs are unique. The end. if(selector.id) { return "#" + selector; } selector = []; var cl, name; while(element.parentNode &amp;&amp; (selector.length === 0 || document.querySelectorAll(selector.join(' ')).length !== 1)) { // if exist, add the first found id and finish building the selector var id = element.getAttribute("id"); if (id) { selector.unshift("#" + id); break; } cl = element.getAttribute("class"); cl = cl ? "." + cl.trim().replace(/ +/g,'.') : ''; name = element.getAttribute("name"); name = name ? ("[name=" + name.trim() + "]") : ''; selector.unshift(element.localName + cl + name); element = element.parentNode; } var result = selector[0]; if (selector.length &gt; 1) { result += " " + selector.slice(1).join(" ").replace(/\[name=[^\]]*]/g, ''); } return result; }
has comment: http://stackoverflow.com/comment/75570725
answers question: http://stackoverflow.com/q/25963295
score: 1

http://stackoverflow.com/q/25913760
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/25915939
linked to: http://stackoverflow.com/q/17936440
has answer: http://stackoverflow.com/a/36028476
has body: Can I get remote IP address inside @OnOpen method of @ServletEndpoint class? I tried follow this Accessing HttpSession from HttpServletRequest in a Web Socket @SocketEndpoint but as in Websocket - httpSession returns null it doesn't work. Anyway I only need clients IP address.
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/36184382
tagged with: java
possible better answer: http://stackoverflow.com/a/36028476
type: Question
has title: Websocket getting remote IP on connect
accepted answer: http://stackoverflow.com/a/25915939
has answer: http://stackoverflow.com/a/75090070
linked to: http://stackoverflow.com/q/22880055
answer count: 3
downvote count: 0
tagged with: websocket
linked to: http://stackoverflow.com/q/20240591
score: 8

http://stackoverflow.com/comment/40779230
type: AnswerComment
has text: Line 83 is : TextView your_first_text_view = (TextView) row.findViewById(R.id.textView1);
type: Comment
comment on: http://stackoverflow.com/a/26026017
score: 0

http://stackoverflow.com/comment/40729696
has text: Can you also post the addNode method of Graph class.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26005775

http://stackoverflow.com/q/25888817
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/41718665
type: AnsweredQuestion
upvote count: 20
tagged with: bluetooth-lowenergy
tagged with: java
has answer: http://stackoverflow.com/a/35317562
type: Question
has answer: http://stackoverflow.com/a/25889137
accepted answer: http://stackoverflow.com/a/25889137
linked to: http://stackoverflow.com/q/25865587
tagged with: bluetooth
possible better answer: http://stackoverflow.com/a/41718665
has title: Android Bluetooth status 133 in onCharacteristicwrite
score: 20
linked to: http://stackoverflow.com/q/25895347
has answer: http://stackoverflow.com/a/65935944
has answer: http://stackoverflow.com/a/31756475
downvote count: 0
favorite count: 0
has body: I'm new to Android and now doing a simple app that requires writing some data into a peripheral device. Actually nothing goes wrong in a Samsung GT-S7272C device. But when I switch to Sony LT29i, there will always be a status 133 when I'm trying to write into a certain characteristic. I will give out some brief code. BluetoothGattService syncService = gatt.getService(SYNC_DATA_SERVICE); BluetoothGattCharacteristic tChar = syncService.getCharacteristic(SYNC_TIME_INPUT_CHAR); if (tChar == null) throw new AssertionError("characteristic null when sync time!"); int diff = /*a int*/; tChar.setValue(diff, BluetoothGattCharacteristic.FORMAT_SINT32, 0); gatt.writeCharacteristic(tChar); and the onCharacteristicWrite function: @Override public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { Log.d(TAG, String.format("Sync: onCharWrite, status = %d", status)); try { if (status != BluetoothGatt.GATT_SUCCESS) throw new AssertionError("Error on char write"); super.onCharacteristicWrite(gatt, characteristic, status); if (characteristic.getUuid().equals(SYNC_TIME_INPUT_CHAR)) { BluetoothGattService syncService = gatt.getService(SYNC_DATA_SERVICE); BluetoothGattCharacteristic tChar = syncService.getCharacteristic(SYNC_HEIGHT_INPUT_CHAR); if (tChar == null) throw new AssertionError("characteristic null when sync time!"); tChar.setValue(/*another int*/, BluetoothGattCharacteristic.FORMAT_SINT32, 0); gatt.writeCharacteristic(tChar); } else if { ... } } catch (AssertionError e) { ... } Writing into first characteristic has nothing wrong and control will reach the onCharacteristicWrite and enter the first if statement with status 0, which means success. Problem is the second writing action in the if statement, which will also trigger onCharacteristicWrite function but yield a status 133, which cannot be found in the official site. Then the device disconnect automatically. I've confirmed that the data type and the offset are all corre…

http://stackoverflow.com/comment/40591615
score: 0
type: Comment
type: QuestionComment
has text: See [DateFormatSymbols#getWeekdays()](http://docs.oracle.com/javase/7/docs/api/java/text/DateFormatSymbols.html) for names of all days in a week !!
comment on: http://stackoverflow.com/q/25929633

http://stackoverflow.com/q/25876750
has comment: http://stackoverflow.com/comment/40495457
has comment: http://stackoverflow.com/comment/40495616
downvote count: 1
tagged with: java-8
type: Question
has comment: http://stackoverflow.com/comment/40496185
has comment: http://stackoverflow.com/comment/40495716
has comment: http://stackoverflow.com/comment/40495895
has comment: http://stackoverflow.com/comment/40495618
tagged with: java
has comment: http://stackoverflow.com/comment/47749734
has answer: http://stackoverflow.com/a/25877843
has comment: http://stackoverflow.com/comment/40495527
has comment: http://stackoverflow.com/comment/47800929
has comment: http://stackoverflow.com/comment/40518668
answer count: 1
accepted answer: http://stackoverflow.com/a/25877843
has comment: http://stackoverflow.com/comment/47168636
has comment: http://stackoverflow.com/comment/40495370
favorite count: 0
has comment: http://stackoverflow.com/comment/40495758
linked to: http://stackoverflow.com/q/10075058
score: 31
has comment: http://stackoverflow.com/comment/40495930
has comment: http://stackoverflow.com/comment/47801837
has body: I have the following model: public class WeightChange { private float value; public float getValue() { return value; } public void setValue(float value) { this.value = value; } } and collection: private List&lt;WeightChange&gt; weightChanges; I have implemented function that gets average weight value using Java 8 features: public float getAvgChangedWeight() { return (float) weightChanges.stream().mapToDouble(WeightChange::getValue).average().getAsDouble(); } Could you please help improve it because I don't think that casting to double is a good idea. Also it throws an exception when the weightChanges collection is empty. How does one improve it in this case?
upvote count: 32
has title: Java 8 stream average for float
type: AnsweredQuestion
tagged with: java-stream
has comment: http://stackoverflow.com/comment/40495610

http://stackoverflow.com/a/25970582
has body: In your onPostExecute method you have to check for situations where result == null. Your current doInBackground method returns null when there is some exception. Also rssReader.getItem() can potentially return null.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25965756
answers question: http://stackoverflow.com/q/25965756

http://stackoverflow.com/comment/40668123
has text: Where does this JAR come from? It's not a good practice to package the source and the class files in the same JAR...
score: 1
comment on: http://stackoverflow.com/q/25972910
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/101266763
comment on: http://stackoverflow.com/a/25916362
type: AnswerComment
score: 0
type: Comment
has text: TransportClient has been replaced by RestHighLevelClient and will be removed in the next major release: https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/_changing_the_client_8217_s_initialization_code.html

http://stackoverflow.com/a/26010796
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40738356
has body: You have to change this part: if (bbb.find()) { comment1.setText(bbb.group()); } to something like this: while(bbb.find()) { comment1.setText(comment1.getText()+bbb.group()+"\n"); } because bbb.find() gives you the next match back. Also you could shorten your Regex String to this: "(?:/\*(?:[^]|(?:\+[^/]))\*+/)|(?://.*)" If you have more questions, just ask :) Here the whole code, this works for me: import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.util.regex.Pattern; import java.util.regex.Matcher; @SuppressWarnings("serial") class RegexTest extends JFrame implements ActionListener { JTextArea area; JTextArea comment1; JButton button1 = new JButton(); private JButton tombol; public RegexTest() { super("program"); tombol = new JButton("button1"); area = new JTextArea(); comment1 = new JTextArea(); button1.addActionListener(this); setLocation(200, 200); setSize(1100, 500); setLayout(null); area.setBounds(10, 10, 450, 400); comment1.setBounds(480, 10, 450, 400); button1.setBounds(10, 410, 450, 25); add(area); add(comment1); add(button1); show(); } public void actionPerformed(ActionEvent e) { if (button1 == e.getSource()) { Pattern aaa = Pattern.compile("(/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/)|(//.*)"); Matcher bbb = aaa.matcher(area.getText()); while (bbb.find()) { comment1.setText(comment1.getText() + bbb.group() + "\n"); } // if (bbb.find()) { // comment1.setText(bbb.group()); // } else // System.out.println("no found"); } } public static void main(String[] args) { new RegexTest(); } } If you want to remove all comments: public void actionPerformed(ActionEvent e) { if (button1 == e.getSource()) { Pattern aaa = Pattern.compile("(/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/)|(//.*)"); Matcher bbb = aaa.matcher(area.getText()); comment1.setText(bbb.replaceAll("")); //This is the new line // while (bbb.find()) { // comment1.setText(comme…
answers question: http://stackoverflow.com/q/26010410
downvote count: 0
has comment: http://stackoverflow.com/comment/40740226
type: Answer

http://stackoverflow.com/comment/40625656
score: 0
comment on: http://stackoverflow.com/a/25948577
type: Comment
has text: I do not really understand your answer. And I want to change neither the positiveButton nor the NegativeButton and the Button is definitly chaanged in runtume...
type: AnswerComment

http://stackoverflow.com/comment/94354775
score: 0
has text: Not an exact duplicate, but very closely related is this question: [How do I write a correct micro-benchmark in Java?](https://stackoverflow.com/questions/504103/how-do-i-write-a-correct-micro-benchmark-in-java)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25963689

http://stackoverflow.com/comment/40661329
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25968826
has text: I want the begin layout will be native code, then button press will call initializeForView to get the Game view. But it looks like i need to call it on onCreate. How can I do that? Is that i need to create all screen by LibGdx?

http://stackoverflow.com/a/25882415
has body: I think you can use @JsonIgnore annotation at the field level to avoid it during serialization.
answers question: http://stackoverflow.com/q/25882250
score: 0
type: Answer

http://stackoverflow.com/q/25879682
type: Question
tagged with: configuration
has title: How to mock a session in Spring 4 Java based config for unit test?
linked to: http://stackoverflow.com/q/5136944
has answer: http://stackoverflow.com/a/25895566
score: 0
tagged with: mocking
answer count: 1
has comment: http://stackoverflow.com/comment/40529070
has comment: http://stackoverflow.com/comment/40528229
has body: So I have a session scoped bean and naturally, I'm getting the error you would expect in my unit tests. java.lang.IllegalStateException: No Scope registered for scope 'Session' What is the proper Java based way to mock a session for a unit test? This was the old way: Spring Test session scope bean using Junit The thing is though that I don't need to test a controller. I'm testing a component with a session scoped bean in it. I just need a fake session so that it works.
accepted answer: http://stackoverflow.com/a/25895566
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40527955
tagged with: spring-4
tagged with: java
tagged with: unit-testing

android-scrollview
type: Tag
tag name: android-scrollview
tags question: http://stackoverflow.com/q/25971440
tags question: http://stackoverflow.com/q/26018333

http://stackoverflow.com/comment/40734506
comment on: http://stackoverflow.com/a/26008988
type: AnswerComment
score: 0
type: Comment
has text: @NirrajSingh that line is not mentioned in your code !

http://stackoverflow.com/a/25974946
has body: You are converting the ByteArrayOutputStream to a byte[] before you have closed the ZipOutputStream. You must ensure zos is closed before you do baos.toByteArray(), the easiest way to ensure this is a try-with-resources construct: try { try (baos = new ByteArrayOutputStream(); zos = new ZipOutputStream(baos)) { for (RepBean rep : repsList) { String filename = rep.getFilename(); ZipEntry entry = new ZipEntry(filename); entry.setSize(rep.getContent().length); zos.putNextEntry(entry); zos.write(rep.getContent()); zos.closeEntry(); } } // this is the zip file as byte[] reportContent = baos.toByteArray(); } // catch blocks as before, finally is no longer required as the try-with-resources // will ensure the streams are closed
has comment: http://stackoverflow.com/comment/103983066
accepted answer of: http://stackoverflow.com/q/25974354
has comment: http://stackoverflow.com/comment/134153082
answers question: http://stackoverflow.com/q/25974354
type: AcceptedAnswer
downvote count: 0
score: 23
has comment: http://stackoverflow.com/comment/98897282
type: Answer
upvote count: 23

http://stackoverflow.com/q/25944573
possible better answer: http://stackoverflow.com/a/25944582
accepted answer: http://stackoverflow.com/a/25944598
upvote count: 0
has answer: http://stackoverflow.com/a/25944582
favorite count: 0
answer count: 5
has title: Compiler cannot find symbol
has answer: http://stackoverflow.com/a/25944583
has answer: http://stackoverflow.com/a/25944595
has body: I have a class that extends another class and I am trying to have it get idnum from it but every time I compile I get the error Student.java:11: error: cannot find symbol this.idnum = idnum; ^ symbol: variable idnum This is my class codes for compile testing, I can get name to be called but not idnum is there something wrong with my code? public class Student extends Person { private int credits; private double gradePoints; public Student(String name, String idnum, int credits, double gradePoints){ this.name = name; this.idnum = idnum; this.credits = credits; this.gradePoints = gradePoints; } public void setName(String name) { this.name = name; } public void setId(String idnum){ this.idnum = idnum; } public void setCredits(int credits){ this.credits = credits; } public void setGradePoints(double gradePoints){ this.gradePoints = gradePoints; } public String getName(){ return name; } public String getId(){ return idnum; } public int getCredits(){ return credits; } public double getGradePoints(){ return gradePoints; } } Person class public class Person { private String name; private String idnum; public Person(String name,String idnum){ this.name = name; this.idnum = idnum; } public void setId(String idnum){ this.idnum = idnum; } public String getId() { return idnum; } public void setName(String name) { this.name = name; } public String getName() { return name; } @Override public String toString() { return name + " " + idnum; } }
has answer: http://stackoverflow.com/a/25944736
linked to: http://stackoverflow.com/q/25706216
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25944598
score: -1
has comment: http://stackoverflow.com/comment/40635647
tagged with: class
type: Question

http://stackoverflow.com/q/25940412
has comment: http://stackoverflow.com/comment/40612606
tagged with: java
has comment: http://stackoverflow.com/comment/40612549
has comment: http://stackoverflow.com/comment/40611861
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/40612607
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40612644
has comment: http://stackoverflow.com/comment/40611834
tagged with: containers
has comment: http://stackoverflow.com/comment/40611855
has comment: http://stackoverflow.com/comment/40611563
has comment: http://stackoverflow.com/comment/40612633
tagged with: application-client
has comment: http://stackoverflow.com/comment/40612162
has comment: http://stackoverflow.com/comment/45837207
has comment: http://stackoverflow.com/comment/40611161
has body: I am trying to learn Java EE properly and am stumped at a problem. I am unable to get a client to work with my EE application. I asked this question earlier and looked around and found that if I need to run my main method with EE features then I need an application client container. The client code that I am trying is package com.anshbansal; import org.jboss.weld.environment.se.Weld; import org.jboss.weld.environment.se.WeldContainer; public class Main { public static void main(String[] args) { Weld weld = new Weld(); WeldContainer container = weld.initialize(); weld.shutdown(); } } How can I run this client through application client container of weblogic 12c?
linked to: http://stackoverflow.com/q/24705017
linked to: http://stackoverflow.com/q/2857376
has comment: http://stackoverflow.com/comment/40612474
has answer: http://stackoverflow.com/a/29049536
type: UnansweredQuestion
tagged with: weblogic12c
has title: How to run application client container of weblogic 12c server

http://stackoverflow.com/comment/40627662
has text: @AlexWhite From your edit, you're still invoking `all()`, which consumes the full `ResultSet`, there's nothing left once you reach the `for` loop. Notice how `size` is 1.
comment on: http://stackoverflow.com/a/25950531
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25895514
has comment: http://stackoverflow.com/comment/40529524
has answer: http://stackoverflow.com/a/25895671
has comment: http://stackoverflow.com/comment/40531711
has comment: http://stackoverflow.com/comment/40530216
tagged with: java
has title: instance variable definitions and instance blocks
type: Question
accepted answer: http://stackoverflow.com/a/25895671
has answer: http://stackoverflow.com/a/25895882
downvote count: 0
has body: I have the following piece of code- {s = "Hello";} String s; This compiles fine, implying that the variable definitions are executed before the instance blocks. However, if I use the following code instead, it does not compile ("error: illegal forward reference"). {s = "Hello"; String ss = s;} String s; So it is not possible to use the value of 's' on the right-hand side of a statement in an instance block that comes BEFORE the variable definition. Is there a sane explanation of what is happening behind the scenes, or is this simply an idiosyncratic feature of Java? P.S. I have seen a similar question asked before, the only explanation given there is that it is a feature of Java. I am writing this to ask the community if that is indeed the final word on this question.
answer count: 3
has comment: http://stackoverflow.com/comment/40529319
has answer: http://stackoverflow.com/a/25895685
has comment: http://stackoverflow.com/comment/40530884
has comment: http://stackoverflow.com/comment/40529490
favorite count: 0
possible better answer: http://stackoverflow.com/a/25895685
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/40529709
has comment: http://stackoverflow.com/comment/40529911
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40532062

http://stackoverflow.com/comment/40770226
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26028375
has text: @DavidConrad I don't get why voted down the perfect explanation :)

http://stackoverflow.com/q/25874078
answer count: 1
tagged with: junit
downvote count: 0
accepted answer: http://stackoverflow.com/a/26027156
favorite count: 0
has body: I am extending ActivityInstrumentationTestCase2 for my unit test. At the end of the unit test, my activity should call startActivity() with an intent. I want to capture that intent, make sure it got created, and test the extra on the intent. It seems strange that I have searched and cannot find an example for this. It looks like maybe getInstrumentation().addMonitor() is the way to go, but I can't even find examples of how to use this.
upvote count: 2
tagged with: android
tagged with: android-intent
has title: How to trap startActivity in my android junit test
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26027156
type: Question

http://stackoverflow.com/comment/40635660
type: Comment
score: 0
has text: @g7k Why? You've just been told you don't need it.
comment on: http://stackoverflow.com/a/25942972
type: AnswerComment

http://stackoverflow.com/a/25947239
answers question: http://stackoverflow.com/q/25947195
has comment: http://stackoverflow.com/comment/40622414
has comment: http://stackoverflow.com/comment/40622699
has comment: http://stackoverflow.com/comment/40622623
has body: java myWebView.loadUrl("javascript:callJS('things from java')") js function callJS(str){ console.log(str) }
has comment: http://stackoverflow.com/comment/40622520
has comment: http://stackoverflow.com/comment/40622820
score: 0
type: Answer

android-fragments
tags question: http://stackoverflow.com/q/25983017
tags question: http://stackoverflow.com/q/25945613
tags question: http://stackoverflow.com/q/25959571
tags question: http://stackoverflow.com/q/25996148
tags question: http://stackoverflow.com/q/25889113
type: Tag
tags question: http://stackoverflow.com/q/25885694
tags question: http://stackoverflow.com/q/25954576
tags question: http://stackoverflow.com/q/25991822
tags question: http://stackoverflow.com/q/25980288
tags question: http://stackoverflow.com/q/25924601
tags question: http://stackoverflow.com/q/25968198
tags question: http://stackoverflow.com/q/26018730
tags question: http://stackoverflow.com/q/25879335
tags question: http://stackoverflow.com/q/25981080
tags question: http://stackoverflow.com/q/25921226
tags question: http://stackoverflow.com/q/25976580
tags question: http://stackoverflow.com/q/25885273
tags question: http://stackoverflow.com/q/25990107
tags question: http://stackoverflow.com/q/26032859
tags question: http://stackoverflow.com/q/25962695
tags question: http://stackoverflow.com/q/25971518
tags question: http://stackoverflow.com/q/25881555
tags question: http://stackoverflow.com/q/25984932
tags question: http://stackoverflow.com/q/25976291
tags question: http://stackoverflow.com/q/25912339
tags question: http://stackoverflow.com/q/25983535
tags question: http://stackoverflow.com/q/25900393
tags question: http://stackoverflow.com/q/25905468
tags question: http://stackoverflow.com/q/25899984
tags question: http://stackoverflow.com/q/25996230
tags question: http://stackoverflow.com/q/25936349
tags question: http://stackoverflow.com/q/25934917
tag name: android-fragments
tags question: http://stackoverflow.com/q/25988192
tags question: http://stackoverflow.com/q/25998567

http://stackoverflow.com/comment/40605591
type: Comment
type: QuestionComment
has text: In that case, please post an example of your XML and _exactly_ what issue you are trying to solve.
score: 1
comment on: http://stackoverflow.com/q/25936568

http://stackoverflow.com/a/25920978
has body: You can try with &lt;c:set var="now" value="&lt;%=new java.util.Date()%&gt;" /&gt; &lt;c:set target="${now}" property="time" value="${now.time + 86400000 * 3}" /&gt; &lt;fmt:formatDate value="${now}" pattern="MMMMM d, yyyy" /&gt;
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40578181
has comment: http://stackoverflow.com/comment/40577704
has comment: http://stackoverflow.com/comment/40576431
has comment: http://stackoverflow.com/comment/40576532
has comment: http://stackoverflow.com/comment/40577060
has comment: http://stackoverflow.com/comment/40577539
has comment: http://stackoverflow.com/comment/40577399
downvote count: 0
has comment: http://stackoverflow.com/comment/40576957
answers question: http://stackoverflow.com/q/25920927
type: Answer
has comment: http://stackoverflow.com/comment/40576596

xsl-fo
tags question: http://stackoverflow.com/q/25946952
tag name: xsl-fo
type: Tag

http://stackoverflow.com/q/25875494
score: 1
tagged with: java
tagged with: socketchannel
has answer: http://stackoverflow.com/a/26456902
tagged with: selector
tagged with: nio
upvote count: 1
answer count: 1
favorite count: 0
has title: java.nio.channels.SocketChannel for both periodic write and immediate read
has comment: http://stackoverflow.com/comment/40621351
has body: I want to write a client application which send messages to server and receive its reply. The client sends messages many times (for example one message in very second periodically) regardless of replies. When a reply comes back, the client want to respond as quickly as possible. Here's the code, which does not work, of the client. I want the runnable instance in startReading() method should respond to the reply from the server but it does not. In this case, _channel.write(buffer) does not return properly. Please let me know the problem of the following code or some other way to implement the above behavior. public class MyClient { private SocketChannel _channel = null; private Selector _selector = null; private InetSocketAddress _addr = new InetSocketAddress("127.0.0.1", 5555); public MyClient () { _selector = SelectorProvider.provider().openSelector(); _channel = SocketChannel.open(); _channel.configureBlocking(false); startReading(); _channel.connect(_addr); } private void startReading () throws IOException { ByteBuffer buffer = ByteBuffer.allocate(1024); _channel.register(_selector, SelectionKey.OP_READ, buffer); Runnable runnable = new Runnable() { @Override public void run () { try { while (0 &lt; _selector.select()) { Iterator&lt;SelectionKey&gt; keyIterator = _selector.selectedKeys().iterator(); while (keyIterator.hasNext()) { SelectionKey key = keyIterator.next(); keyIterator.remove(); if (key.isReadable()) read(key); } } } catch (IOException e) {} } }; ExecutorService service = Executors.newFixedThreadPool(1); service.execute(runnable); } private void read(SelectionKey key) throws IOException { // do some reading operations } @Override public void run() { ByteBuffer buffer = ByteBuffer.allocate(1024); // write message to buffer buffer.flip(); try { _channel.write(buffer); } catch (IOException e) {} } public static void main (String[] args) { MyClient client = new MyClient(); ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor(); ex.sche…
tagged with: client
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40493182
type: Question

http://stackoverflow.com/q/25921902
score: 19
has comment: http://stackoverflow.com/comment/40578192
type: Question
has answer: http://stackoverflow.com/a/25924324
has answer: http://stackoverflow.com/a/25922001
answer count: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25924773
has comment: http://stackoverflow.com/comment/40578159
tagged with: java
has answer: http://stackoverflow.com/a/25922285
has answer: http://stackoverflow.com/a/25922231
has answer: http://stackoverflow.com/a/25922061
linked to: http://stackoverflow.com/q/1779199
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/40578271
has answer: http://stackoverflow.com/a/25922086
accepted answer: http://stackoverflow.com/a/25922001
has comment: http://stackoverflow.com/comment/40590797
favorite count: 0
linked to: http://stackoverflow.com/q/5833529
has body: 1 2 3 4 5 6 7 8 9 this is my normal array, but i need to make it diagonally like this 1 2 4 3 5 7 6 8 9 this is very stupid way to make it work, but even it is not working because i am not able to find 2nd column elements. for (i = 0; i &lt; arr.length; ++i) { for (n = 0; n &lt; arr[0].length; ++n) { if (i == 0 &amp;&amp; n == 0){ arr[i][n] = 0; } else if (i == 0 &amp;&amp; n == 1) { arr[i][n] = 2; } else if (i == 1 &amp;&amp; n == 0) { arr[i][n] = 3; } else if (n == 0) { arr[i][n] = arr[i - 1][n] - arr[i - 2][n] + 1 + arr[i - 1][n]; } else { arr[i][n] = arr[i][n - 1] - arr[i][n - 2] + 1 + arr[i][n - 1]; } } }
has title: 2d array diagonally filling
has answer: http://stackoverflow.com/a/25922140
upvote count: 19
possible better answer: http://stackoverflow.com/a/25924324

http://stackoverflow.com/comment/40607344
type: Comment
type: QuestionComment
has text: Well, according to the page you're supposed to put it in a method with return type int called main(). Maybe that's part of the problem? edit: never mind - didn't realize it was another language XD
comment on: http://stackoverflow.com/q/25938246
score: 0

http://stackoverflow.com/a/26014551
type: Answer
answers question: http://stackoverflow.com/q/26014280
has body: The problem is that you are hard wiring your dependencies. So your code needs to do some imports for the third party libs. What you need is to loosely couple the third party libs so that the core of you application does not need to import anything related to 3rd party libs. Use an interface which defines a method or the set of methods needed to generate reports in any format. Make this interface part of your core application. Format specific implementation goes then in separate modules which are dependent on your core application and on the 3rd party libs. Use a factory in the core application to load the specific implementation at runtime using refelction. If a format is requested from which the relevant module jars are not present in the classpath, a ClassNotFoundException will be thrown, catch it and handle accordingly. Here a sample structure for your application Core application class ReportData { } interface ReportGenerator { byte[] generate(ReportData data); } class ReportGeneratorFactory { public ReportGenerator getInstance(String format) throws InstantiationException, IllegalAccessException, ClassNotFoundException { ReportGenerator reportGenerator = null; if("txt".equals(format)) { reportGenerator = (ReportGenerator) Class.forName("com.foo.TxtReportGenerator").newInstance(); } else if("html".equals(format)) { reportGenerator = (ReportGenerator) Class.forName("com.foo.HtmlReportGenerator").newInstance(); } else if("xl".equals(format)) { reportGenerator = (ReportGenerator) Class.forName("com.foo.XlReportGenerator").newInstance(); } else { throw new UnsupportedOperationException( String.format("Unsupport format %s", format)); } return reportGenerator; } } Txt / Html Export (Could be part of the core application if no 3rd party lib are needed) class TxtReportGenerator implements ReportGenerator { public byte[] generate(ReportData data) { // TODO Auto-generated method stub return null; } } class HtmlReportGenerator implements ReportGenerator { public byte[] gene…
score: 0

http://stackoverflow.com/q/25936387
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25936565
has body: I want to achieve the 2 things at the same time. I have a regular jsp page in Struts2. xx/yy/zz/email.jsp &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;s:property value="email"/&gt; &lt;/body&gt; &lt;/html&gt; The url of this page could be xx/yy/zz/myEmail.action, while some action class will handle it... public class MyEmailAction { private String email; public String execute(){ this.email = 'abc@xyz.com'' } //setter and getter for 'email' ...... } Now, I would like to have another action, which sends the result of the page of xx/yy/zz/myEmail.action as email. public class MyEmailAction { private String email; public String execute(){ this.email = 'abc@xyz.com'' } public String send() { this.email = 'abc@xyz.com'' Map mapping; //put this.email into the mapping String result = getResultOfJSP('../../../xx/yy/zz/email.jsp', mapping); Email.send('me@me.com', 'you@you.com', 'My Subject', result); } //setter and getter for 'email' ...... } So the question is that: HOW CAN I GET THE RESULT OF A RENDERED JSP AS A STRING? This reason why I want this is obviously that I want to manage this template in one place (email.jsp). I know I could use another velocity (vm) page which has exact the same html as the jsp but with velocity markups instead. But then whenever I need to make a change to this template, I have to do it on both places. I think I could also use URL to grab the result, but I prefer not to use this way as it's another request to the server. Thanks
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25936577
has title: Struts2 - How can I get the result of a JSP page as a string in an action class (for emails)
has answer: http://stackoverflow.com/a/25936577
downvote count: 0
tagged with: jsp
tagged with: struts2
tagged with: velocity
score: 3
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
has answer: http://stackoverflow.com/a/25936565

http://stackoverflow.com/comment/40739099
comment on: http://stackoverflow.com/q/26011746
score: 0
type: Comment
type: QuestionComment
has text: I think the question is obvious: how to fix the code? But i really didnt get want you to do, yet. So you start at any position and walk through the matrix, summing up the highest neighbors and returning if you reach a position where you would need to go back?

http://stackoverflow.com/q/26015827
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26016077
answer count: 4
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26015967
downvote count: 7
type: Question
has answer: http://stackoverflow.com/a/26015917
tagged with: for-loop
has title: An if inside my If JAVA
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40746275
has comment: http://stackoverflow.com/comment/40746203
has answer: http://stackoverflow.com/a/26015929
has body: i'm having a problem about the if inside my if, because it does not read the if inside my if. It does only print the "if and goto detected" once i type for example ("if 1 goto A") then next line ("A:") . Supposedly when the program finds ":" it should print there's a colon but it won't print on mine .Please help me. public turing() { String[] input = inputArea.getText().split("\n"); for(int i=0;i&lt;input.length;i++){ if(input[i].startsWith("if")==true &amp;&amp; (input[i].contains("goto")==true)){ System.out.print("If and Goto detected"); if(input[i].contains(":")==true){ System.out.print("There's a Colon"); } } } }
score: -6
has comment: http://stackoverflow.com/comment/40746446
favorite count: 0

http://stackoverflow.com/a/26028379
has comment: http://stackoverflow.com/comment/40770027
score: 1
answers question: http://stackoverflow.com/q/26028356
upvote count: 1
downvote count: 0
type: Answer
has body: Look at moString.equals(moInt), this equates to String.equals(int), which will never be true... You probably meant to use moString.equals(intAsString ) FYI- From a security point of view, String is not a good choice for storing sensitive data, either maintain it in a char array or as it's a number, as an int value

http://stackoverflow.com/a/25961203
has body: You have code in your own program that you're not yet showing us, likely in an ActionListener or in a method that one of your ActionListener's calls, that throws this exception. Find it, and fix it, simple as that. As noted by many, the exception's own Stacktrace message will tell you what lines are causing the exception, but again, I'm betting it will be in a method that has been created by NetBeans and that looks something like: // where the X below is some number private void jButtonXActionPerformed(java.awt.event.ActionEvent evt) { throws new UnsupportedOperationException("Not supported yet."); } To fix this, remove the throws statement and instead add code that should be called when this button is pressed. OK, I was wrong about the location, but correct with my overall thoughts, your code is throwing the exception right here in your Student constructor: public Student() { throw new UnsupportedOperationException("Not supported yet."); } Again, get rid of this, and instead add appropriate code for this constructor public Student() { // add appropriate code here }
has comment: http://stackoverflow.com/comment/40648232
downvote count: 0
has comment: http://stackoverflow.com/comment/40648079
has comment: http://stackoverflow.com/comment/40649771
has comment: http://stackoverflow.com/comment/40647841
answers question: http://stackoverflow.com/q/25961188
has comment: http://stackoverflow.com/comment/40647913
has comment: http://stackoverflow.com/comment/40648784
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40649239

http://stackoverflow.com/q/25948806
has title: Importing input file to integer array
has answer: http://stackoverflow.com/a/25949133
downvote count: 0
has answer: http://stackoverflow.com/a/25948855
favorite count: 0
has body: This is the content of my Input file: 123 I want to take this input content to a int[] Array My code: BufferedReader br = new BufferedReader(new FileReader("yes.txt")); int[] Array = br.readline().toCharArray(); // Error as it has to be int array How to solve this: output: Array[0]=1 Array[0]=2 Array[0]=3
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40624839
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/7413830
has answer: http://stackoverflow.com/a/25948856
answer count: 3

http://stackoverflow.com/a/26003224
has comment: http://stackoverflow.com/comment/40752826
score: 0
answers question: http://stackoverflow.com/q/26003104
has body: It's better to have the last return statement in the end outside any if statements. Also last I remember, if all your returns are inside if statements you will get a compilation error stating the method doesn't have a return or that the return may not always be reached.
has comment: http://stackoverflow.com/comment/40724320
type: Answer
has comment: http://stackoverflow.com/comment/40723854

http://stackoverflow.com/q/26030196
has answer: http://stackoverflow.com/a/26034006
favorite count: 0
tagged with: postgresql
upvote count: 2
type: UnansweredQuestion
has body: I have to modify design of the existing application according to following manner, According to above design each project contains it's own schema and that mapping table (project_schema_table) is under main schema. All schemas are under one Postgresql database and in future users will create another new schemas (on demand) for their new projects. Before displaying login window I have to list all existing projects and once user select his project I have to direct to that project with relevant schema. Other than main schema all other project base schemas are exactly the same. This is a desktop application developed with latest versions of java technologies JavaFX, Spring and JPA with Postgresql database. Currently it has only one project related schema and I have to introduce main schema and all other subsequent project base schemas. I have found similar stack overflow post but it didn't contains any solution. Whether I can accomplish this task with Spring AbstractRoutingDataSource ? or is there any other mechanism. Thanks.
tagged with: spring
score: 2
has title: Spring JPA + dynamically switch the datasource between schemas in postgresql
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40777876
type: Question
has comment: http://stackoverflow.com/comment/40778574
tagged with: jpa
downvote count: 0
answer count: 1

http://stackoverflow.com/q/26032364
has comment: http://stackoverflow.com/comment/40777342
tagged with: ios
has comment: http://stackoverflow.com/comment/40776843
score: 22
has comment: http://stackoverflow.com/comment/40777128
tagged with: android
tagged with: wifi
possible better answer: http://stackoverflow.com/a/26302276
favorite count: 0
has comment: http://stackoverflow.com/comment/41280642
has body: Is there any way to send a notification to the devices which are connected to a particular Wi-Fi network? Say, I have a Wi-Fi network named "My Wi-Fi", which is not secured, that is any one can connect. A public network. There may be N-number of users connected to "My Wi-Fi". These users can perform any kind of transaction, say online payment. Now if I want to turn off or shut down "My Wi-Fi" router or access point, these transactions may fail. So before shutting down, I want to send a text notification to all the users connected to "My Wi-Fi" network. (User does not have any kind of app in their device, to push the notification.) Is this possible?
downvote count: 2
has answer: http://stackoverflow.com/a/26302276
has title: Send notification to all the devices connected to a Wi-Fi network
answer count: 4
has answer: http://stackoverflow.com/a/26306123
has comment: http://stackoverflow.com/comment/40777043
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/66988509
has comment: http://stackoverflow.com/comment/41258808
tagged with: java
upvote count: 24
type: Question
has answer: http://stackoverflow.com/a/26195669
accepted answer: http://stackoverflow.com/a/26195669
has comment: http://stackoverflow.com/comment/40777172
tagged with: network-programming

http://stackoverflow.com/comment/40578430
type: AnswerComment
type: Comment
has text: @halu Finished my implementation. Should work for you.
comment on: http://stackoverflow.com/a/25922001
score: 0

http://stackoverflow.com/q/25982245
tagged with: eclipse
has body: I am very new to java but have been reading up a bit and was trying to make a fairly simple android app in Eclipse. I have the following line of code: ArrayList&lt;String&gt; userNumbers = new ArrayList&lt;&gt;(Arrays.asList(userNumbersArray)); Of course, I get the error: '&lt;>' is not allowed for source level below 1.7 So I change the source level to 1.7 in Eclipse, and then I get the error: Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties. So I do this; the compiler level then goes back to 1.6, and now I get the first error. My question is if there is either a way for it to be compatible with android and with the diamond operator or if there is another way to write that line of code (still using an arraylist; it must be specified that it is a String). Thank you in advance!
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40688296
tagged with: android
linked to: http://stackoverflow.com/q/4166966
has title: Java - need to use diamond operator; conflict between android compiler compliance level and level supporting diamond operator
score: 0
type: UnansweredQuestion
tagged with: diamond-operator
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25982314
type: Question
has comment: http://stackoverflow.com/comment/40685731
has comment: http://stackoverflow.com/comment/40685591
tagged with: java
has comment: http://stackoverflow.com/comment/40685632

http://stackoverflow.com/comment/71341514
score: 0
type: AnswerComment
type: Comment
has text: @Benjamin I agree. I was using Jetty implementation but found no answer at that time. Then I tried most of its API to find a solution for me and post the answer here. I haven't try any other implementation.
comment on: http://stackoverflow.com/a/36028476

cassandra
tags question: http://stackoverflow.com/q/26001566
tags question: http://stackoverflow.com/q/26025047
tags question: http://stackoverflow.com/q/25961103
type: Tag
tag name: cassandra
tags question: http://stackoverflow.com/q/25936749
tags question: http://stackoverflow.com/q/25982263
tags question: http://stackoverflow.com/q/25989680
tags question: http://stackoverflow.com/q/25939818
tags question: http://stackoverflow.com/q/25949693
tags question: http://stackoverflow.com/q/25973377
tags question: http://stackoverflow.com/q/25893945
tags question: http://stackoverflow.com/q/25931568

http://stackoverflow.com/comment/40550222
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25897447
has text: Thank you, yeah got it. I need to maintain the Static fields which am planning to use at multiple places..:)

http://stackoverflow.com/comment/40508110
comment on: http://stackoverflow.com/q/25883866
has text: Post your logcat then....
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25973080
has answer: http://stackoverflow.com/a/25987569
score: 0
has title: Why Jasper Chart Theme throw java.lang.IndexOutOfBoundsException: Index: 7, Size: 7?
has body: I am testing Chart Theme with Jasper Report. Why I get IndexOutOfBoundsException when I use eye.candy.sixties theme? Other themes is ok (eg : aegean, default,....) BarChartTest.java public class BarChartTest { @SuppressWarnings("unchecked") public static void main(String[] args) { String templateFile = "resources/bar.jrxml"; DataBeanList dataBeanList = new DataBeanList(); ArrayList<DataBean> dataList = dataBeanList.getDataBeanList(); JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(dataList); Map parameters = new HashMap(); try { JasperDesign design = JRXmlLoader.load(templateFile); JasperReport report = JasperCompileManager.compileReport(design); JasperPrint print = JasperFillManager.fillReport(report, parameters, beanColDataSource); JasperExportManager.exportReportToPdfFile(print, "D:/temp/bar_chart.pdf"); } catch (JRException e) { e.printStackTrace(); } } } bar.jrxml <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="jasper_report_template" pageWidth="595" pageHeight="860" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" uuid="843cea12-1b23-4ff8-ae94-48b1850662ef"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <field name="subjectName" class="java.lang.String"/> <field name="marks" class="java.lang.Integer"/> Boolean.TRUE <reportElement uuid="5133611e-49a1-4e9a-b4e5-8eff4e29c61b" x="0" y="0" width="515" height="200"/> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> <leftPen lineWidth="1.0"/> <bottomPen lineWidth="1.0"/> <rightPen lineWidth="1.0"/> "My First JR Bar Chart" <chartSubtitle/> <chartLegend/> $F{subjectName} $F{subjectName} $F{marks} <plot/> <itemLabel/> <axisFormat/> …
accepted answer: http://stackoverflow.com/a/25987569
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jasper-reports
answer count: 1

http://stackoverflow.com/comment/40558409
comment on: http://stackoverflow.com/a/25911436
type: Comment
score: 0
type: AnswerComment
has text: Even if I set the mule message in a variable, the jersey component still looks at the current payload. I believe that the jersey component relies on the content of the **current** mule message. @anirban-sen-chowdhary

http://stackoverflow.com/q/25878045
has answer: http://stackoverflow.com/a/64310393
has comment: http://stackoverflow.com/comment/43765868
score: 410
has answer: http://stackoverflow.com/a/44847232
has answer: http://stackoverflow.com/a/68349666
type: Question
linked to: http://stackoverflow.com/q/12745510
has title: Error:java: invalid source release: 8 in Intellij. What does it mean?
has answer: http://stackoverflow.com/a/48927826
has comment: http://stackoverflow.com/comment/40498100
has answer: http://stackoverflow.com/a/39906775
tagged with: intellij-idea
tagged with: compilation
answer count: 19
has answer: http://stackoverflow.com/a/64525877
has answer: http://stackoverflow.com/a/36420204
tagged with: javac
has answer: http://stackoverflow.com/a/61980669
tagged with: intellij-13
has answer: http://stackoverflow.com/a/57063367
upvote count: 411
favorite count: 0
has answer: http://stackoverflow.com/a/32191315
has body: I'm trying to compile some code that I have in IntelliJ Ultimate 13.1.4, but I get the following error, and I have no idea what it means: Information:Using javac 1.7.0_55 to compile java sources Information:java: Errors occurred while compiling module 'Example' Information:Compilation completed with 1 error and 0 warnings in 3 sec Information:1 error Information:0 warnings Error:java: invalid source release: 8 My guess is that it's something related to Java 8 vs Java 7, but I have no idea what specifically. I've tried to Google around for this message, but they either talk about javac or target release, so it doesn't exactly seem to apply.
has answer: http://stackoverflow.com/a/75588193
has answer: http://stackoverflow.com/a/45441525
has answer: http://stackoverflow.com/a/26009627
has answer: http://stackoverflow.com/a/64212651
has comment: http://stackoverflow.com/comment/40498701
has answer: http://stackoverflow.com/a/32273854
has answer: http://stackoverflow.com/a/34677051
has answer: http://stackoverflow.com/a/63673717
possible better answer: http://stackoverflow.com/a/31245931
downvote count: 1
accepted answer: http://stackoverflow.com/a/26009627
has answer: http://stackoverflow.com/a/31245931
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40498034
has answer: http://stackoverflow.com/a/70796869
linked to: http://stackoverflow.com/q/24766591
tagged with: java

http://stackoverflow.com/comment/40595769
has text: thanks let me try this one
comment on: http://stackoverflow.com/q/25931927
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26006179
accepted answer of: http://stackoverflow.com/q/26006057
type: Answer
has body: String[] splitSpeak = speakValue.split(":");
answers question: http://stackoverflow.com/q/26006057
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25901194
has answer: http://stackoverflow.com/a/25901636
type: Question
score: 0
has title: is there a way to add a delay to a java program without using sleep?
has answer: http://stackoverflow.com/a/25901290
tagged with: timer
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25901209
has answer: http://stackoverflow.com/a/25901325
tagged with: java
has answer: http://stackoverflow.com/a/25901235
has body: In my game i have some stats that i want to go down after a certain period of time but i cant use the sleep thing. Can someone give me an example of a better way of doing this? I've seen videos on something called the swing timer but none of the videos are helping me much. I've also heard about the timer util however there seems to be almost no videos on that. here's what I tried to do: int hunger = 10; public void hungerDown(){ try{ Thread.sleep(5000); hunger--; } catch(Exception e){ } }
has comment: http://stackoverflow.com/comment/40539877

priority-queue
tags question: http://stackoverflow.com/q/25941673
tags question: http://stackoverflow.com/q/26017560
tag name: priority-queue
type: Tag
tags question: http://stackoverflow.com/q/25963088
tags question: http://stackoverflow.com/q/25927009
tags question: http://stackoverflow.com/q/25919659

http://stackoverflow.com/a/25908715
upvote count: 3
has comment: http://stackoverflow.com/comment/40661443
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25908550
has comment: http://stackoverflow.com/comment/40664878
type: Answer
accepted answer of: http://stackoverflow.com/q/25908550
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40661376
has comment: http://stackoverflow.com/comment/40669317
has comment: http://stackoverflow.com/comment/40672724
has body: First way Right click on ProjectA and export as jar file. Right click on ProjectB, Goto Build path -> Configure build path -> Libraries Add external jar of ProjectA Second Way, Right click on ProjectB, Goto Build path -> Configure build path -> Projects Click on Add, select ProjectA from list. After this, you will be able to import classes in ProjectB which are defined in ProjectA by, import packageA.fileA Read more at : Java build path

http://stackoverflow.com/comment/40617806
score: 0
type: Comment
has text: @GeroldBroser : Indeed ! Well I'm not an expert so I won't be too affirmative about but if it was me, it would be deprecated.
type: AnswerComment
comment on: http://stackoverflow.com/a/25941769

http://stackoverflow.com/q/25940053
tagged with: list
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40610582
type: Question
has comment: http://stackoverflow.com/comment/40611159
has answer: http://stackoverflow.com/a/25940081
tagged with: arraylist
has body: I have a List of Employee object. class Employee{ private int empId; private String name; } Now I have List&lt;Employee&gt; empList = new ArrayList&lt;Employee&gt;(); How can I find, if my list contains an employee named "ABC"?? empList.contains("ABC"); wont work... Should I put it in Map?? Which one is more efficient?? Just wanted to mention that I get my Employee object from database....
has comment: http://stackoverflow.com/comment/40610719
upvote count: 1
has answer: http://stackoverflow.com/a/25940950
has comment: http://stackoverflow.com/comment/40611698
linked to: http://stackoverflow.com/q/15469795
favorite count: 0
has title: Element's equality check from list of object
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25940107
tagged with: collections
has answer: http://stackoverflow.com/a/26683818
has answer: http://stackoverflow.com/a/25940616

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/26021283
tags question: http://stackoverflow.com/q/25917116
tags question: http://stackoverflow.com/q/25970804
tags question: http://stackoverflow.com/q/25908789
type: Tag
tags question: http://stackoverflow.com/q/26025797
tags question: http://stackoverflow.com/q/25971895
tags question: http://stackoverflow.com/q/25933314
tags question: http://stackoverflow.com/q/25976985

http://stackoverflow.com/comment/40559623
score: 0
comment on: http://stackoverflow.com/a/25911436
type: Comment
has text: You use <copy-properties propertyName="http.*" doc:name="Copy All HTTP Headers"/> after http inbound endpoint that will copy all the HTTP headers you need ..
type: AnswerComment

http://stackoverflow.com/a/25957593
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25957566
answers question: http://stackoverflow.com/q/25957566
type: Answer
upvote count: 1
has body: you increased your variable "count" before you print value. try to move count++; to the line after the System.out.println
type: AcceptedAnswer

http://stackoverflow.com/comment/40689107
score: 0
has text: Are you running on a device or emulator?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25983919

http://stackoverflow.com/q/25875845
has answer: http://stackoverflow.com/a/70439377
linked to: http://stackoverflow.com/q/11331469
score: 15
tagged with: security
answer count: 2
has body: When registering an Android app in the API console for Google API access you have to enter your apps SHA1 certificate fingerprint and the package name of the app. Now I was wondering how Google could verify this values are correct when the api calls are just simple HTTP requests (in the simplest case, when you don't use their API client, that could append some header values)? You must provide your API key when making a API call, but this doesn't proves that the entered values are correct.
has title: How is Google verifying SHA1 and package name in API calls?
downvote count: 1
upvote count: 16
linked to: http://stackoverflow.com/q/33989062
has comment: http://stackoverflow.com/comment/61127751
favorite count: 0
tagged with: google-authentication
type: UnansweredQuestion
tagged with: google-api
tagged with: android
has answer: http://stackoverflow.com/a/36738650
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9293019

http://stackoverflow.com/a/25928737
has body: I have also had to make a Java Swing application which had a lot of painting to do - the JPanel had to paint multiple custom components which moved around on the screen as the user interacted with them. The paintComponent method is there for drawing and that should be the end of it. Conditional painting is, from my side, doable in the paintComponent as long as you are not waiting for conditions, setting states of other objects or anything which might on the one hand slow you down a lot and on the other send you into waiting for ever. I call the logic here reaction logic. On the other hand, don't forget that the repainting can be triggered externally, any time you might need it. This way you can separate the logic from painting to some extent. Use listeners, create your own events, but keep action logic out of the paintComponent. You can easily find a way to set states before entering the painting, so that when you decide to paint, you only react to the state. Don't forget: if you are multi-threading, painting might get messy if you work on half-set states of objects. Thread carefully!
answers question: http://stackoverflow.com/q/25928338
score: 0
type: Answer

http://stackoverflow.com/comment/40644886
type: Comment
comment on: http://stackoverflow.com/a/25956478
has text: Oh. So I add the **int size = r * 2;**, right? How can I call it from the **public static void main(String[] args)**? I tried something like **Circle.inputX();** and it said **"Cannot make a static reference to the non-static method inputX() from the type Circle"**
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40746034
score: 4
type: Comment
type: QuestionComment
has text: If the comparison to Java bothers you, just think of it as "How can I have a 2D array of optional objects in C++?" I think the answer will sufficiently convince the asker that C++ and Java should be treated in different ways.
comment on: http://stackoverflow.com/q/26015704

http://stackoverflow.com/comment/40696550
has text: Possible duplicate of http://stackoverflow.com/questions/18359568/jasperreports-5-0-0-getting-java-lang-noclassdeffounderror-org-apache-commons
comment on: http://stackoverflow.com/q/25988216
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26014280
favorite count: 0
type: Question
tagged with: classloader
answer count: 2
has answer: http://stackoverflow.com/a/26014615
has title: loading jar at runtime and using its class
has body: i have one problem in which i need some help. Problem statement: I'm using one jar to generate reports in excel sheet format. This jar is required only if the user wants to generate report in excel format. Other formats of report available are html and txt which don't require this jar. The current user generates the reports in html format so he says, why should I download this jar and export it in the classpath when I don't need report in the excel format. Now the problem is if this jar is removed, this build will fail/as all the imports to the classes which are being used will give error. Class.forName can load the class at run-time and doesn't give me error but with this I will not be able to use the method of that class since I cannot have the reference of the class. Is there any way out or this is not possible?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40743598
has answer: http://stackoverflow.com/a/26014551
upvote count: 1
downvote count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40743753

http://stackoverflow.com/q/25905835
accepted answer: http://stackoverflow.com/a/25906250
tagged with: jdbc
tagged with: swing
has comment: http://stackoverflow.com/comment/40548076
type: AnsweredQuestion
has title: Mysql exception"out of range"?
has comment: http://stackoverflow.com/comment/40548499
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/40547779
type: Question
has comment: http://stackoverflow.com/comment/40548462
has comment: http://stackoverflow.com/comment/40547969
has answer: http://stackoverflow.com/a/25906250
score: 0
has comment: http://stackoverflow.com/comment/40548331
has comment: http://stackoverflow.com/comment/40548202
answer count: 1
has body: I am working in swing based project and use prepared statement but it give exception like out of range and when i using parameters and do not put '?' but simply ? then show exception like" jdbc syntax error check the manual near '?,?' at line one " i am so confused what is happening.Check my code what is wrong? private void AddActionPerformed(java.awt.event.ActionEvent evt) { if (((JTextField) chose.getDateEditor().getUiComponent()).getText() == null) { String sql = "INSERT INTO expance1 ( Breakfast,Date) VALUES (?,?)"; } else { String sql = "INSERT INTO expance1 ( Breakfast,Date) VALUES (?,?)"; try { pst = conn.prepareStatement(sql); pst.setString(1, breakfast.getText()); pst.setString(2, ((JTextField) chose.getDateEditor().getUiComponent()).getText()); pst.executeUpdate(sql); JOptionPane.showMessageDialog(null, "insert sucessfully"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } finally { try { rs.close(); pst.close(); } catch (Exception e) { } } } }

http://stackoverflow.com/comment/40775302
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26031279
type: AnswerComment
has text: Hi Dr. Ming. You are absolutely right in saying that if this was my only requirement then I would be "swatting a fly with a hammer", but it is not. Actually, the example I gave in the question was just a simple use case of many other things that I have in mind as we are moving towards java 8 from two way object mapping (ala automapper), validation rules (ala fluent validation.net), to workflow DSLs in addition to abstract RESTful queries.

serialization
tags question: http://stackoverflow.com/q/25973062
tags question: http://stackoverflow.com/q/25958044
tags question: http://stackoverflow.com/q/25885634
tags question: http://stackoverflow.com/q/25966551
tags question: http://stackoverflow.com/q/25881694
tags question: http://stackoverflow.com/q/26011679
tags question: http://stackoverflow.com/q/25940298
tags question: http://stackoverflow.com/q/25894957
tags question: http://stackoverflow.com/q/25918232
tags question: http://stackoverflow.com/q/25956217
tag name: serialization
tags question: http://stackoverflow.com/q/25963891
tags question: http://stackoverflow.com/q/25970634
type: Tag
tags question: http://stackoverflow.com/q/25977706
tags question: http://stackoverflow.com/q/25933856
tags question: http://stackoverflow.com/q/25998312
tags question: http://stackoverflow.com/q/26006677
tags question: http://stackoverflow.com/q/25894625
tags question: http://stackoverflow.com/q/25883984
tags question: http://stackoverflow.com/q/26033192
tags question: http://stackoverflow.com/q/25920481
tags question: http://stackoverflow.com/q/26006230
tags question: http://stackoverflow.com/q/26010179
tags question: http://stackoverflow.com/q/25910472
tags question: http://stackoverflow.com/q/25881350
tags question: http://stackoverflow.com/q/25948617
tags question: http://stackoverflow.com/q/25908820
tags question: http://stackoverflow.com/q/25893985

http://stackoverflow.com/q/26015704
linked to: http://stackoverflow.com/q/4405074
has answer: http://stackoverflow.com/a/26016461
has answer: http://stackoverflow.com/a/26016687
type: Question
has comment: http://stackoverflow.com/comment/40748131
has body: I am new to C++ and I am porting over a Java project to C++. Consider the following Java code, where Piece is a class representing a chess piece: Piece[][] myPieces = new Piece[8][8]; It creates an array where all the entries are null. How can I achieve the same thing in C++? I tried: Piece* myPieces = new Piece[8][8]; But this will create an array with all the entries initialized with the default constructor. Thanks Edit: I want the C++ code to be efficient/elegant and I do not care nor wnant to copy paste from Java to C++. I am happy to heavily modify the code structure if needed. Edit 2: The code is for chess programm, the size of the array will never change and performance is critical.
has comment: http://stackoverflow.com/comment/40746386
possible better answer: http://stackoverflow.com/a/26015919
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/26015919
has comment: http://stackoverflow.com/comment/40746085
has title: Array of objects, difference between Java and C++
has comment: http://stackoverflow.com/comment/40747856
has comment: http://stackoverflow.com/comment/40745984
has comment: http://stackoverflow.com/comment/40747643
has comment: http://stackoverflow.com/comment/40746008
has comment: http://stackoverflow.com/comment/40746034
favorite count: 0
answer count: 9
has comment: http://stackoverflow.com/comment/40746225
has comment: http://stackoverflow.com/comment/57785188
has answer: http://stackoverflow.com/a/26015931
has answer: http://stackoverflow.com/a/26016072
has answer: http://stackoverflow.com/a/26015892
has answer: http://stackoverflow.com/a/26015857
score: 6
has answer: http://stackoverflow.com/a/26015900
upvote count: 6
has comment: http://stackoverflow.com/comment/40747925
tagged with: c++
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26015892
has answer: http://stackoverflow.com/a/26015882
tagged with: java
has comment: http://stackoverflow.com/comment/40749336

http://stackoverflow.com/comment/40700072
comment on: http://stackoverflow.com/q/25990166
score: 0
type: Comment
type: QuestionComment
has text: @OliverCharlesworth So accuracy can only be attained by persisting the previous data and computing!

http://stackoverflow.com/q/25912398
type: Question
has body: I can't build my maven java web application, because of the following two errors: diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator) multi-catch statement is not supported in -source 1.5 (use -source 7 or higher to enable multi-catch statement) I'm confused, because i use java 1.8.0 for my project, i never have actually used 1.5 What could be causing this problem and how do i solve it? I tried to build it after adding the follwing lines in the pom.xml, but without succes: 1.8 1.8
possible better answer: http://stackoverflow.com/a/46697655
has title: Maven project Error: Diamond/multicatch operator not supported in -source 1.5
has answer: http://stackoverflow.com/a/46697655
tagged with: multi-catch
has answer: http://stackoverflow.com/a/25912780
answer count: 2
duplicate of: http://stackoverflow.com/q/29258141
downvote count: 0
tagged with: web
favorite count: 0
tagged with: diamond-operator
tagged with: maven
score: 13
accepted answer: http://stackoverflow.com/a/25912780
upvote count: 13
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/29258141

http://stackoverflow.com/comment/40574527
has text: @Ioan-CristianLinte The relevant code is in `getFixedDate()`, called by `computeTime()` (it's slightly different, but essentially doing the same thing.)
type: Comment
comment on: http://stackoverflow.com/a/25918745
score: 0
type: AnswerComment

http://stackoverflow.com/a/25977828
type: AcceptedAnswer
downvote count: 0
has body: Something like this unless = "#result==null or #result.size()==0" More about result and or.
score: 54
has comment: http://stackoverflow.com/comment/40677655
type: Answer
upvote count: 54
answers question: http://stackoverflow.com/q/25977710
accepted answer of: http://stackoverflow.com/q/25977710

http://stackoverflow.com/comment/40555388
type: QuestionComment
type: Comment
has text: What is the return type of Util.generateRandomList?
comment on: http://stackoverflow.com/q/25910020
score: 0

http://stackoverflow.com/comment/40851871
has text: As said, I have created my own custom L&F class for TabbedPane and my jtabbedPane implements that class and my custon L&F class has a long code that works for jTabbedPane so i cannot do all of work for JLabels again. Please I want it to work on my tab header itself without using jlabels because this way I will have to do alot of work on l&F for jLabels as well.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26062618
type: Comment

http://stackoverflow.com/comment/40568156
score: 0
type: Comment
type: QuestionComment
has text: okay just another question, how do i debug?
comment on: http://stackoverflow.com/q/25916494

http://stackoverflow.com/a/26015816
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40817333
downvote count: 0
has comment: http://stackoverflow.com/comment/40817957
answers question: http://stackoverflow.com/q/26013589
type: Answer
has body: In some cases we get this type of problems, i will explain the points in steps wise If two persons works on the project personA, personB. If personB adds new files, those files path saves in our project binary file. so personsB done Commit and pushed the code. and personA also added new files, here also same way files path saves in our project binary file and performed commit operation and pulled the code which on remote side. Here the situation arise when personA pulls the code conflicts arise in the binary file. in this case project disappears from the Project Explorer. i faced this type of problem before. i merged both files not worked. Solution for the above problem Whenever if we perform pull operation and get conflicts in binary file. I follow the below procedure In this case i use this commandgit checkout --ours binaryfilenamewithpath git checkout --ours filename -&gt; it keeps your local file without adding others changes by this we can avoid project disappeared from the Project Explorer cases. Here you get personBs files but files links can not add to the binary file. so manually we have to those files into our project for linking purpose. then you can commit the your project. I prefer this way to resolve this type of problems. If you have any doubts please ask me. Solution for your problem Execute git log command it will show your previous commits information with their ids git reset --hard commitid(c14809fa) it will make your local code and local history be just like it was at that commit. pull your code using git pull origin branchname if you get conflict in binaryfile, then your project disappear from eclipse workspace. use this command git checkout --ours binaryfilewithpath to avoid that. if you want to add files to your project and resolve conflicts in other files. then commit your code by using git commit -a -m 'your commit message'
has comment: http://stackoverflow.com/comment/40755287

http://stackoverflow.com/comment/40707453
has text: That's a comment, not an answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/25994743
type: Comment
score: 3

http://stackoverflow.com/comment/71641107
comment on: http://stackoverflow.com/q/26007201
has text: Can some moderator delete this question ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25963348
tagged with: multithreading
has title: Synchronizing on other objects in java
has comment: http://stackoverflow.com/comment/40651487
tagged with: java
linked to: http://stackoverflow.com/q/442564
type: Question
has answer: http://stackoverflow.com/a/25963393
has body: in the below code snippet public class MsLunch { private long c1 = 0; private long c2 = 0; private Object lock1 = new Object(); // private Object lock2 = new Object(); private Dummy lock2 = new Dummy(); public void inc1() { synchronized(lock1) { c1++; } } public void inc2() { synchronized(lock2) { c2++; } } } i have changed the lock object used to protect the c2 count. i have used a dummy class which is no where related to MsLunch class. Is it fine or should i always put the lock on the object of the current class("this" or MsLunch object or parent class Object). Please answer as i have been struggling a long way to understand the role of object used in synchronized block. Also is it necessary that the synchronized block member fields and variables must be held by the object used to lock ?
duplicate of: http://stackoverflow.com/q/442564
answer count: 1
tagged with: synchronized
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25887219
upvote count: 2
tagged with: java
has title: Does the key material of the secret key need to Hex encode? (Java)
has body: When I want save my secret key to file, I found snap code below. Why should we encode the key with hex format before we save it? What's the difference between those two snap codes below? Snap code 1 public static void saveKey(SecretKey key, File file) throws IOException { byte[] encoded = key.getEncoded(); char[] hex = Hex.encodeHex(encoded); String data = String.valueOf(hex); FileUtils.writeStringToFile(file, data); } Snap code 2 public static void saveKey(SecretKey key, File file) throws IOException { byte[] encoded = key.getEncoded(); FileUtils.writeStringToFile(file, new String(encoded)); }
type: Question
accepted answer: http://stackoverflow.com/a/25887744
has comment: http://stackoverflow.com/comment/40514454
has comment: http://stackoverflow.com/comment/40514171
score: 2
answer count: 1
downvote count: 0
favorite count: 0
tagged with: secret-key
has comment: http://stackoverflow.com/comment/90268318
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25887744

http://stackoverflow.com/a/25929345
score: 0
type: Answer
has body: There are a few ways to "share" variables with Threads. The problem with your code is that you are passing an int which is passed by value. This means that temp and this.temp is not the same variable. Using a Future as other answers suggest is one way that you can share variables. Using a Future, you can ensure that the Thread has finished before actually fetching the result of that Threads execution so might be more relevant to you. Other ways of sharing variables among Threads that are Thread-safe, but does not guarantee that the Thread has finished execution: pass an AtomicInteger and use the set method to set value. use a synchronized getter method that returns the Threads value.
answers question: http://stackoverflow.com/q/25928893

http://stackoverflow.com/comment/40746172
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26005483
score: 0
has text: Update your first post, share the complete error stack trace. I need more details

http://stackoverflow.com/a/25996124
score: 0
has body: The most likely thing is change your connection url. Replace String createDB = "jdbc:derby://localhost:1527/C:/21109220/HotelBookings;create=true"; with String createDB = "jdbc:derby://localhost:1527/HotelBookings;create=true"; or String createDB = "jdbc:derby://localhost:1527/HotelBookings"; Then it should be ok.
type: Answer
answers question: http://stackoverflow.com/q/25995892

http://stackoverflow.com/a/25887711
score: 0
type: Answer
has body: Use decimal format... Double num= Double.parseDouble("1.300"); DecimalFormat format = new DecimalFormat("0.#"); System.out.println(format.format(num)); output: 1.3
answers question: http://stackoverflow.com/q/25887584

http://stackoverflow.com/q/26012285
has comment: http://stackoverflow.com/comment/40740726
has comment: http://stackoverflow.com/comment/40740380
possible better answer: http://stackoverflow.com/a/26012468
has answer: http://stackoverflow.com/a/26012468
tagged with: java
has comment: http://stackoverflow.com/comment/40740343
answer count: 4
has comment: http://stackoverflow.com/comment/40740260
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40740196
has answer: http://stackoverflow.com/a/26012535
tagged with: arrays
downvote count: 0
tagged with: string
has body: If I have a 7 word String (I like it when it rains hard) and I want to print every variation of it that is a) Greater than two words and b) Not changing the original word order. How best to do that? I'll print below what my end-goal is : I like it when it rains hard I like it when it rains I like it when it I like it when I like it I like like it when it rains hard like it when it rains like it when it like it when like it it when it rains hard it when it rains it when it it when when it rains hard when it rains when it it rains hard it rains rains hard My Program is almost achieving that but not quite and I wonder if there is a smarter way of tackling it than what I have... ? //Strings.java //Goal: to print out each possible version of data without changing the original //order and without printing strings of less than 2 words. public class Strings { public static void main (String[] args) { String var = " "; String data = "I like it when it rains hard"; String [] s = data.split(" "); for (int i = 0 ; i &lt;= s.length-1 ; i++) { //inner for (int j = s.length-1 ; j &gt;= 1 ; j--) { //outer for ( int num = i ; num &lt;= j ; num++) { var += s[num] + " "; } System.out.println(var); var = " "; } } } }
favorite count: 0
has comment: http://stackoverflow.com/comment/40740887
type: Question
has comment: http://stackoverflow.com/comment/40740703
score: 1
has comment: http://stackoverflow.com/comment/40740155
has answer: http://stackoverflow.com/a/26013099
has answer: http://stackoverflow.com/a/26012957
accepted answer: http://stackoverflow.com/a/26012535
has comment: http://stackoverflow.com/comment/40740008
upvote count: 1
has title: Most efficient way to print all variations of a String?

http://stackoverflow.com/q/25905848
type: Question
has comment: http://stackoverflow.com/comment/40600760
score: 1
has title: ClassCastException: org.jboss.as.ee.component.BasicComponent cannot be cast to org.jboss.as.webservices.injection.WSComponent
tagged with: jrebel
upvote count: 1
tagged with: cxf
tagged with: java
type: UnansweredQuestion
tagged with: jboss
has body: I get the following error, while automatically publishing the changes made to code. We use JRebel for class reload, I found a few stackoverflow and other links which recommended removing duplicate jars. My guess was probably the issue is due to the CXF library. I tried two approaches, First Approach: Include a jboss-deployment-structure.xml, to exclude the apache cxf library. This didn't work for me as during deployment there were other errors that turned up, probably due to the WebService classes being declared in web.xml as servlets, and the application never comes up. Second Approach: Specify apache cxf library scope as compile in Maven pom. The deployment is successful, but still the issue persists, on change of code and redeployment to JBoss. The application seems to work fine when there is no redeployment of classes by JRebel is involved. But I am not sure if this a JRebel tool issue or Jboss Classloading issue because of jars. Your help in pointing me in the right direction will be helpful. Please comment if you need further details. Complete Stack Trace Below: 5:53:03,750 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http-localhost/127.0.0.1:8080-1) Application {##########}iws#{##########} createSubscriberXxxxxx has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: org.jboss.as.ee.component.BasicComponent cannot be cast to org.jboss.as.webservices.injection.WSComponent at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:66) at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:129) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1…
downvote count: 0
answer count: 0
favorite count: 0

http://stackoverflow.com/q/25993343
has comment: http://stackoverflow.com/comment/40705271
type: AnsweredQuestion
has body: There are something like: &lt;T&gt; Identifier&lt;Set&lt;T&gt;&gt; myMethod(Iterable&lt;? extends Element&lt;Identifier&lt;T&gt;&gt;&gt; input) {…} class MyClass implements Element&lt;Identifier&lt;?&gt;&gt; {…} Iterable&lt;MyClass&gt; a = …; How could I pass a to myMethod to get Identifier&lt;Set&lt;?&gt;&gt;?
score: 1
tagged with: generics
linked to: http://stackoverflow.com/q/3546745
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40705849
has title: How to apply complex generic method to class with wildcard generic type?
has answer: http://stackoverflow.com/a/25993741
linked to: http://stackoverflow.com/q/2723397
tagged with: java
has answer: http://stackoverflow.com/a/25998053
upvote count: 1
possible better answer: http://stackoverflow.com/a/25998053
has comment: http://stackoverflow.com/comment/40706321
downvote count: 0
accepted answer: http://stackoverflow.com/a/25993741

http://stackoverflow.com/a/71683071
downvote count: 0
score: 4
type: Answer
has body: It may sometimes happen that after configuring maven in Intellij and changing as following it does not work by command build, so build it by Intellij maven tool. Setting &gt; Maven &gt; Importer - select the `JDK` Setting &gt; Maven &gt; Runner - select the `JRE` After that, try to build by Intellij maven tool instead of Intellij console.
answers question: http://stackoverflow.com/q/25888023
upvote count: 4

http://stackoverflow.com/comment/40494463
type: Comment
has text: Ok, I ran into one issue first; and I had a feeling this would happen. `Unparseable number "100.00"`. I remember `Number` failing if it was NOT a currency and it just did that. I need in my code, to work if it is currency for not. As I mentioned above, the number being passed in, may look like `100.00` or `$100.`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25875818

http://stackoverflow.com/q/25993517
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25993721
tagged with: command-line-interface
score: 0
answer count: 2
has title: Does (or will) the JRE include a CLI parser
has answer: http://stackoverflow.com/a/25993719
has body: I normally use known CLI parsers (external libraries): Apache Commons CLI http://commons.apache.org/cli/ (version 1.2) Java Gems http://code.google.com/p/javagems/ JArgs http://jargs.sourceforge.net/ ... I haven't found one in the standard Java library, and I wonder if new versions of Java are providing an implementation so I can save a dependency. Does anyone know if there is something like that or a plan to include it in the future?

http://stackoverflow.com/comment/40535042
score: 0
has text: Is there a way to listen to that RST packet in Java?
type: AnswerComment
comment on: http://stackoverflow.com/a/25898560
type: Comment

http://stackoverflow.com/q/25892270
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has title: Hibernate ManyToOne mapping not on PKey
has answer: http://stackoverflow.com/a/25920163
type: Question
has body: i have some entities: @Entity public class Event{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "event_id") private long eventId; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "host_id") private Host host; } @Entity public class Host{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private long id; @Column(name = "host_id") private long hostId; } @Repository public class EventDao{ @PersistenceContext private EntityManager em; @Transactional public List&lt;Event&gt; findEventAfterId(long eventId, long hostId){ Query q=em.createNativeQuery("SELECT * FROM event WHERE event_id&gt;? AND host_id=?, Event.class); q.setParameter(1, eventId); q.setParameter(2, hostId); return (List&lt;Event&gt;)q.getResultList(); } } I am trying to get events from this native query: SELECT * FROM event WHERE event_id&gt;4442 AND host_id=35; And get this exception javax.persistence.EntityNotFoundException: Unable to find entity.Host with id 35 But in my DB i have host with host_id 35. How can i map my event entity to host with host_id column?? Thank you. UPD: Query q=em.createNativeQuery("SELECT * FROM event WHERE event_id&gt;? AND host_id=?, Event.class); q.setParameter(1, eventId); q.setParameter(2, hostId); return (List&lt;Event&gt;)q.getResultList(); Here is full exception: javax.persistence.EntityNotFoundException: Unable to find monitoring.reporter.entity.Host with id 35 at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$JpaEntityNotFoundDelegate.handleEntityNotFound(EntityManagerFactoryBuilderImpl.java:181) at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:218) at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:274) at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:150) at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1070) at org.hibernate.internal.SessionImpl.i…
answer count: 2
upvote count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/40523640
has answer: http://stackoverflow.com/a/25892332
favorite count: 0
has comment: http://stackoverflow.com/comment/40575627

http://stackoverflow.com/q/25934496
has answer: http://stackoverflow.com/a/38722972
score: 12
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31877954
tagged with: file-search
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/25935205
type: Question
upvote count: 12
has answer: http://stackoverflow.com/a/25935290
downvote count: 0
has answer: http://stackoverflow.com/a/26621488
tagged with: keymapping
has title: Open Type (Ctrl+Shift+T) in Eclipse from every window
favorite count: 0
has body: If I type Ctrl+Shift+T in Eclipse, an Open Type window opens. But this works only if I am in a Java file (or in the Package Explorer area). I want to open the same window when I press Ctrl+Shift+T regardless of the resource (E.g.: if the open file is .js, .class or .xml). How can I achieve this? Details: Operating system: Windows 7 IDE: Eclipse Luna (4.4) I tried to: go to Window > Preferences > General > Keys > type "Open Type" / "Ctrl+Shift+T" let only the following line for Ctrl+Shift+T / Open Type: Command: Open Type Binding: Ctrl+Shift+T When: In Windows Category: Navigate but it doesn't work.

http://stackoverflow.com/a/27358917
type: Answer
has body: There is no need to implement AbstractSecurityWebApplicationInitializer. Security is initialized via ApplicationInitializer/RootConfiguration/@ComponentScan/SecurityConfig. Also there si no need to add SecurityConfig in getRootConfigClasses.
upvote count: 3
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/25987115

http://stackoverflow.com/a/25995042
answers question: http://stackoverflow.com/q/25994898
type: Answer
has comment: http://stackoverflow.com/comment/40708878
score: 1
has body: Let's suppose for a moment that this is possible. This means that you (or everyone else) can find password for any mysql running in the world and (unless other security tools stop him) access the data stored there. I hope this answers your question. I am sorry for sarcasm. EDIT After the sarcastic comment I can give you a practical advice. If you do not have any data there just re-install it (as it was already mentioned by several guys). If you have data that you want to preserve do the following. Backup your data first. Re-install database. This time remember (or write down) the password. Create schemas again. Copy your data files on the just created files. I hope this will work. Please follow this link to get to find location of your data files: http://www.mkyong.com/mysql/where-does-mysql-stored-the-data-in-my-harddisk/
upvote count: 1
has comment: http://stackoverflow.com/comment/40708170
has comment: http://stackoverflow.com/comment/40708620
has comment: http://stackoverflow.com/comment/40708830
downvote count: 0
has comment: http://stackoverflow.com/comment/40708128

http://stackoverflow.com/comment/40602113
type: Comment
comment on: http://stackoverflow.com/a/25935140
has text: For Transactions i am just using @Transactional annotation. Not doing anything else and My application is not very huge it works with only one db
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40602605
has text: I have Mediaplayer with 12 differend Buttons/audio and I want the buttons to flash one at a time, depending on which button I press.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25935094

http://stackoverflow.com/q/26003352
has answer: http://stackoverflow.com/a/31064244
has comment: http://stackoverflow.com/comment/40724524
has answer: http://stackoverflow.com/a/42756405
tagged with: classpath
has answer: http://stackoverflow.com/a/26681798
type: Question
upvote count: 15
has comment: http://stackoverflow.com/comment/40723939
has comment: http://stackoverflow.com/comment/40724229
has answer: http://stackoverflow.com/a/40517097
has answer: http://stackoverflow.com/a/50705589
has answer: http://stackoverflow.com/a/36068723
has title: Eclipse error "Could not find or load main class"
has answer: http://stackoverflow.com/a/59730566
has answer: http://stackoverflow.com/a/42071064
has answer: http://stackoverflow.com/a/43165342
has answer: http://stackoverflow.com/a/33818655
has answer: http://stackoverflow.com/a/38662388
tagged with: eclipse
has answer: http://stackoverflow.com/a/48684437
has answer: http://stackoverflow.com/a/26004181
has answer: http://stackoverflow.com/a/29232207
has comment: http://stackoverflow.com/comment/40723942
has answer: http://stackoverflow.com/a/31898241
has answer: http://stackoverflow.com/a/40331338
has comment: http://stackoverflow.com/comment/40724482
has answer: http://stackoverflow.com/a/34364683
tagged with: program-entry-point
answer count: 26
downvote count: 0
has comment: http://stackoverflow.com/comment/40724369
has answer: http://stackoverflow.com/a/52811253
favorite count: 0
has answer: http://stackoverflow.com/a/37345518
has answer: http://stackoverflow.com/a/31958809
has answer: http://stackoverflow.com/a/37295413
has comment: http://stackoverflow.com/comment/40723928
has comment: http://stackoverflow.com/comment/40726008
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/52402086
has answer: http://stackoverflow.com/a/44685430
score: 15
has body: I know there are many duplicates of this question, but I have looked at them all, and none of them have solved the issue. I am trying to run a class that has a main function. I have cleaned the project, checked the classpath for '.', added the bin folder to the classpath under run configurations. I'm not sure what else to try because the class is certainly in the source folder. Could someone please help me with this issue? package testIt; public class MemoryVisualizerApp extends Application{ public static void main(String[] args) { launch(args); } //Setup the scene and launch with given properties @Override public void start(Stage primaryStage) throws IOException{ Parent root = FXMLLoader.load(getClass().getResource("/MemoryVisualizer.fxml")); Scene scene = new Scene(root, 650, 300); //Set whether the screen should be re-sizable (possibly best size = default) primaryStage.setResizable(true); primaryStage.setMinHeight(300); primaryStage.setMinWidth(550); primaryStage.setTitle("Memory Usage"); primaryStage.setScene(scene); scene.getStylesheets().add("testIt/MemoryVisualizer.css"); primaryStage.setOnCloseRequest(new EventHandler&lt;WindowEvent&gt;() { public void handle(WindowEvent e){ /*Currently the threads continue running after window is closed. Looking for a way to stop the app threads when window closed without stopping the program.*/ } }); primaryStage.show(); primaryStage.show(); } } This code is located within a package, withing the src folder. It utilizes some JavaFX files that arent shown but that shouldnt be an issue. This is the error: Error: Could not find or load main class testIt.MemoryVisualizerApp
has answer: http://stackoverflow.com/a/49475754
has answer: http://stackoverflow.com/a/43188591
has comment: http://stackoverflow.com/comment/40724460
has answer: http://stackoverflow.com/a/33979187
tagged with: java

http://stackoverflow.com/a/25882588
downvote count: 0
has comment: http://stackoverflow.com/comment/40653905
accepted answer of: http://stackoverflow.com/q/25882069
score: 1
has comment: http://stackoverflow.com/comment/40511949
has comment: http://stackoverflow.com/comment/40737758
answers question: http://stackoverflow.com/q/25882069
has comment: http://stackoverflow.com/comment/40653930
has body: My approach will be to group all of the method inside a dummy class and use reflection to access it. Below is the example of the implementation: public class StackExample { // Other declaration here ---------- public static void main(String[] args){ MethodCollection collection = new MethodCollection(); String[] methods = {"method1", "method2", "method3"}; // requires to catch exception just in case the method does not exist try { for (String a : methods) { glPushMatrix(); // &lt;----- Push matrix MethodCollection.class.getMethod(a, null).invoke(collection,null); glPopMatrix(); // &lt;----- Pop matrix } } catch (Exception e){ e.printStackTrace(); } } static class MethodCollection { /** * Empty constructor */ public MethodCollection(){} public void method1(){ System.out.println("Method 1"); } public void method2(){ System.out.println("Method 2"); } public void method3(){ System.out.println("Method 3"); } } }
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40653956
type: Answer

http://stackoverflow.com/comment/40700265
comment on: http://stackoverflow.com/q/25974488
type: Comment
type: QuestionComment
has text: @Joffery, sorry, fixed it.
score: 0

http://stackoverflow.com/a/26030664
score: 0
has comment: http://stackoverflow.com/comment/40902916
has comment: http://stackoverflow.com/comment/42129119
type: Answer
has comment: http://stackoverflow.com/comment/41936011
has body: This question is relatively general. Can you provide more specific context or a scenario? For example are you asking about general socket (TCP/UDP) saturation, a particular application level protocol implemented by a codec in Netty, or some other topic?
answers question: http://stackoverflow.com/q/26009749

http://stackoverflow.com/q/25892850
has answer: http://stackoverflow.com/a/25895790
tagged with: java
tagged with: hibernate
tagged with: hql
has title: How to write multiline HQL code?
type: Question
accepted answer: http://stackoverflow.com/a/25895790
has comment: http://stackoverflow.com/comment/40524169
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40524203
upvote count: 2
has body: How can multiline HQL sql queries be written in java so that they remain readable? private static final String QUERY = "SELECT p.FirstName, pp.PhoneNumber" + "FROM AdventureWorks2008R2.Person.Person AS p" + "JOIN AdventureWorks2008R2.Person.PersonPhone AS pp" + "ON p.BusinessEntityID = pp.BusinessEntityID" + "ORDER BY FirstName ASC"; Are there better solutions to this?
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/40739290
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26011652
has text: @WilliamPrice I know and I already visited it this passed few days but I don't get the concept and logic of mine.

http://stackoverflow.com/a/25953341
has comment: http://stackoverflow.com/comment/40643230
has comment: http://stackoverflow.com/comment/40632405
has comment: http://stackoverflow.com/comment/40632436
score: 0
has body: This seems to be a variation of the 3SUM problem and should obey the same restrictions. Computing the 3SUM problem in less than O(n^2) is still a unsvoled problem. Did your teacher ask a trick question or is that some kind of competition?
answers question: http://stackoverflow.com/q/25953127
type: Answer

http://stackoverflow.com/comment/54246818
comment on: http://stackoverflow.com/q/26019608
has text: I, too, would like to know how this was resolved.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40608435
has text: You're not going to get a collection of names (ala Dot-Net). Any quantified repeat resets (overwrites) any containing group. You could however use the `\G` anchor construct to handle both student/parent names in a single regex. Is that something you'd be interested in?
score: 0
comment on: http://stackoverflow.com/q/25937226
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40799895
type: QuestionComment
comment on: http://stackoverflow.com/q/26025093
score: 0
has text: @ElliottFrisch Not if it is already installed and all the have to do is follow our instructions on the web page. We frequently get users of linux that are new, also class path issues sometimes make jar files irritating. Also, linux is not scary if you are non technical, it's the semi-technical people that are scared of new things, not the oblivious.
type: Comment

http://stackoverflow.com/q/25959396
tagged with: java
has body: Is it possible to OCR a picture and identify different sizes of fonts in the picture using Tesseract OCR. If yes, do I need to use any other 3rd party library or can I use pure Java. For an example, I want to detect the headline and the content of a newspaper by using the font size. Any help regarding this matter would be appreciated.
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25961375
has answer: http://stackoverflow.com/a/35415497
favorite count: 0
has title: Detect Large and Small font sizes of Tesseract OCR Java implementation
type: UnansweredQuestion
tagged with: ocr
tagged with: detect
tagged with: fonts
upvote count: 3
type: Question
tagged with: tesseract
score: 3

http://stackoverflow.com/comment/40721769
score: 2
comment on: http://stackoverflow.com/a/26002223
type: AnswerComment
has text: it's easier this way, but why it will fix his/her problem?
type: Comment

http://stackoverflow.com/q/25949078
has body: i want to use mongodb as back-end for java based application (web/Desktop). I am using Spring framework. Could anyone please tell me whether it is possible to connect to mongodb through springDao and is this the best approach? (i need this for both web and desktop application) Since mongodb is not a relational database, is it possible or recommended to use hibernate ORM in order to connect to mongodb. Please advise the best approach for the scenarios. Thanks in advance.
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25949219
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/40627425
score: 0
accepted answer: http://stackoverflow.com/a/25949219
answer count: 1
has comment: http://stackoverflow.com/comment/40625433
has comment: http://stackoverflow.com/comment/40625458
has title: Connecting Java Application (Web and Desktop application using spring) with mongodb
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/q/26003480
accepted answer: http://stackoverflow.com/a/26003860
score: -4
has answer: http://stackoverflow.com/a/26003787
type: AnsweredQuestion
has title: Union of two Arrays without default functions in Java
has comment: http://stackoverflow.com/comment/40724313
tagged with: list
tagged with: java
possible better answer: http://stackoverflow.com/a/26003787
has comment: http://stackoverflow.com/comment/40724192
type: Question
has comment: http://stackoverflow.com/comment/40724247
has body: I've preparing for my Interviews and I've completed the Union of two Arrays in Java. I searched the Internet and it has lot of examples but everything utilises a default function available in Java like Set, etc.. I dont want to use default function whichever may give advantage to my program. Because that is the way companies are going to give me problems like "AuB without using any default functions". So I spend 30 min and atlast I found a solution. I'm not asking any questions, I just need people to give suggestions on my logic whether it's good or it's the dumpest logic which you've seen till now and It'll also be helpfull if anyone looking for solutions without utilising default functions. import java.util.List; import java.util.Scanner; import java.util.ArrayList; public class Union { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.print("Enter Size of A array: "); int asize = input.nextInt(); int[] a = new int[asize]; for(int i=0;i&lt;a.length;i++){ System.out.print("a["+i+"]: "); a[i] = input.nextInt(); } System.out.print("Enter size of B array: "); int bsize = input.nextInt(); int[] b = new int[bsize]; for(int i=0;i&lt;b.length;i++){ System.out.print("b["+i+"]: "); b[i] = input.nextInt(); } int count; List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); for(int i=0;i&lt;a.length;i++){ count = 0; for(int j=0;j&lt;=i;j++){ if(a[i]!=a[j]){ count++; } } if(count==i){ list.add(a[i]); } } for(int i=0;i&lt;b.length;i++){ count = 0; for(Integer e:list){ if(b[i]!=e){ count++; } } if(count==list.size()){ list.add(b[i]); } } for(Integer e:list){ System.out.print(e+" "); } } }
has answer: http://stackoverflow.com/a/26003860
has comment: http://stackoverflow.com/comment/40724235
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40724502
answer count: 2
downvote count: 4
upvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40692420
comment on: http://stackoverflow.com/a/25985797
score: 0
type: AnswerComment
type: Comment
has text: Thanks but its a bit too complex!

http://stackoverflow.com/comment/138078382
type: Comment
comment on: http://stackoverflow.com/a/78319969
type: AnswerComment
has text: Since the question is tagged "android", I assume that the OP was writing an app that required the conversion - which can be done in Java code since JDK 8. I think your solution is a lot more work than is necessary.
score: 0

http://stackoverflow.com/comment/40510942
has text: Shouldn't you be using a `OracleConnectionPoolDataSource` instead? Also make sure you have proper tx setup and that you don't open connections yourself.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25885328
score: 1

http://stackoverflow.com/a/25962581
has body: You haven't started the RMI Registry.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25962162

http://stackoverflow.com/comment/40711197
has text: Yes. Just write any URL like https://acme.com/foo/a.xsd and use a catalog to point it to maven:com.acme.foo:foo-a!/a.xsd. Catalog + entity resolver will get your schema from JAR then, no HTTP requests.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25991572
score: 0

http://stackoverflow.com/a/28026711
upvote count: 2
has body: You could try converting the key to CER (X509) and then try importing it: openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer I have encountered a similar problem even though I was trying to import a .pem file. The file contained only the a single certificate in both humain readable form and encapsulated within —–BEGIN CERTIFICATE—– and —–END CERTIFICATE—–. In java 7 (patch 71) the keytool failed to parse such file and threw the same error you've got. Once I removed the text portion of the file: Certificate: Data: Version: 3 (0x2) Serial Number: 11864724255945479761 (0xa4a7f7d949c31d11) Signature Algorithm: sha1WithRSAEncryption Issuer: C=COM, ST=CA, O=Company, OU=ORG, CN=ORG/emailAddress=admin@company.org Validity Not Before: Jan 5 15:30:35 2015 GMT Not After : Jan 2 15:30:35 2025 GMT it worked alright for me. Please also take a look at the following article (https://myonlineusb.wordpress.com/2011/06/19/what-are-the-differences-between-pem-der-p7bpkcs7-pfxpkcs12-certificates/) as it explains the differences between various formats and provides commands how to convert from one format to another
answers question: http://stackoverflow.com/q/25983440
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/40531846
type: QuestionComment
has text: Yes. It is fixed now, but I have the same problem. Will do more digging into the rest of the code.
comment on: http://stackoverflow.com/q/25896674
score: 0
type: Comment

http://stackoverflow.com/comment/111034159
type: AnswerComment
type: Comment
has text: for me gradlew build fails with /usr/bin/env: ‘sh\r’: No such file or directory
comment on: http://stackoverflow.com/a/50467205
score: 0

http://stackoverflow.com/comment/42032504
comment on: http://stackoverflow.com/q/25905686
type: QuestionComment
has text: I have a similar problem with a fresh install of JBoss AS 7.1.1. In my case I get the error referenced above when I stop the server. There is no additional error detail in either boot.log or server.log.
score: 0
type: Comment

http://stackoverflow.com/q/25937525
has title: Maven Eclipse-Aether: getLicence() method
type: AnsweredQuestion
has body: I'm developing a maven-plugin to check dependencies' licenses, similar to this one, but I can't found any API for that... what I would like to have is something like String licence = artifact.getLicence(); mrice on that license-check plugin just try to find the .pom file of that artifact, read it, and try to find the &lt;license&gt;&lt;/license&gt;. Do you know how can I do this?
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25938249
type: Question
tagged with: aether
accepted answer: http://stackoverflow.com/a/25938249
answer count: 1
tagged with: maven

http://stackoverflow.com/comment/40596920
type: Comment
type: QuestionComment
has text: I'm having an index on `city, airport, zip, country, name`.
comment on: http://stackoverflow.com/q/25932089
score: 0

http://stackoverflow.com/q/26026836
has answer: http://stackoverflow.com/a/26027016
type: UnansweredQuestion
upvote count: 1
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/40767175
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/40767101
score: -2
has title: Pointing to a private method in Java?
has body: I have a public method within a class that needs to point to a private method, how would I do this? public class test1 { private String lastName; private String firstName; public String name; public void setup() { Scanner in = new Scanner(System.in); System.out.println("Please enter the last name followed by the first name of" + " a student: "); lastName = in.next(); firstName = in.next(); } private void setName() { name = firstName + " " + lastName; name = name.replaceAll(",([^,]*)$", "$1"); } How would I point to the setName() method from the setup() method? And yes, I do need the setName() method even though I could just put all of that information into the setup() method.
tagged with: private
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40767034

http://stackoverflow.com/comment/40656476
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25966262
has text: how are you initializing the adapater please show code at mainActivity

http://stackoverflow.com/a/25874151
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40490940
type: Answer
has body: Add a check in your first method: if( 0.0 == UB || 0.0 == UB ) { continue; } and add a check in your second method: if( null == Test[index] ) { continue; } or
accepted answer of: http://stackoverflow.com/q/25873950
has comment: http://stackoverflow.com/comment/40490644
answers question: http://stackoverflow.com/q/25873950
score: 0

http://stackoverflow.com/comment/40504047
score: 1
has text: @HotLicks, in what way does Jackson databinding distort JSON? Also, it's barely more effort to write a custom deserializer that pulls nodes out of a JsonParser and passes them to a constructor compared to pulling items out of a map inside the constructor, and doesn't open you up to the unpleasantness of having to thoroughly document and sanitize the keys of the map. Whenever you need to convert between loosely typed (e.g., JSON) and statically typed data, keep that in its own layer -- it makes life better, if somewhat more verbose, as a result.
comment on: http://stackoverflow.com/a/25881151
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25917580
has comment: http://stackoverflow.com/comment/40569971
answer count: 2
has title: Make JTable cell editor value be selectable, but not editable?
has body: I have tried to keep my JTable's tight and secure, making only editable columns editable via isCellEditable(). However, my clients are insisting that they want to double click on a cell so they can copy its contents, even if it is read only. I could let the cell be editable and not do anything with any edits they could make in the setValueAt() (so it reverts back to original value when editor exits). But I don't want this application to feel so freeform. Is there an easy effective way to make the JTextField used as the cell editor to allow selecting of text in the editor, but not editable? I tried this override on my JTable below, but I don't think I'm looking for the right "instanceof" object. @Override public TableCellEditor getDefaultEditor(Class&lt;?&gt; columnClass) { if (super.getDefaultEditor(columnClass) instanceof JTextField) { JTextField jTextField = new JTextField(); jTextField.setEditable(false); return (TableCellEditor) jTextField; } if (columnClass == null) { return null; } else { Object editor = defaultEditorsByColumnClass.get(columnClass); if (editor != null) { return (TableCellEditor)editor; } else { return getDefaultEditor(columnClass.getSuperclass()); } } }
downvote count: 0
favorite count: 0
tagged with: tablecelleditor
has answer: http://stackoverflow.com/a/25919008
has comment: http://stackoverflow.com/comment/40569782
upvote count: 7
tagged with: swing
tagged with: jtextfield
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25918436
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/25918436
accepted answer: http://stackoverflow.com/a/25919008
type: Question
tagged with: jtable

http://stackoverflow.com/comment/40786408
score: 0
has text: But it is defined in .jar library which was given from third part. But here is structure: http://pastebin.com/aSb3YPen
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26033241

http://stackoverflow.com/a/26028472
type: Answer
has body: Answering my own question, You can not add a component inside another component without a template, you need a template for add a component, this is because tapestry has a static structure.
score: 0
accepted answer of: http://stackoverflow.com/q/26027545
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26027545

http://stackoverflow.com/a/26017012
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/26013412
has body: Here, populating values in dropdown is handled in the javascript itself. I did this to reduce the number of hits on server.But given the large number of records in the hashmaps, is it the correct way to populate data in the dropdowns? It'd bet this is a good idea for Countries: 75 and maybe States: 1,000 and maybe even Divisions: 3,000 but not for Villages: 30,000 Should I do an AJAX call each time a value is selected in a dropdown to populate the values in subsequent dropdown. I'd go for it. Each sublist is a static resource, there's nothing to compute and can be served pretty quickly. If you're lucky, the call takes something like 50-100 milliseconds, i.e., way below human perception. You could also run a AJAX call to get the whole list. This would make you page load fast and the number of requests low. Finally, only measurement can tell you, what works best in you environment. Note, that you don't have to make 4 requests, one for each entity type. You can e.g. put all 75 countries in your page itself and then load everything for the selected country.
upvote count: 1
answers question: http://stackoverflow.com/q/26013412
type: AcceptedAnswer

http://stackoverflow.com/q/25938743
tagged with: akka-persistence
score: 0
tagged with: akka
accepted answer: http://stackoverflow.com/a/25990123
answer count: 1
has body: I am testing event sourcing (akka-persistence) and wrote my own Journal plugin. But when running performance tests, I quickly noticed that not all CPU resources are used. The class which writes messages to the journal is an actor (e.g. is executes all write operations in serial). Is it possible to use multiple instances of this journal actor to increase the write performance to the journal backend? If yes, how? Thanks
has title: How to let akka event sourcing (akka-persistence) use parallel journal actors
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25990123
tagged with: event-sourcing
type: Question

http://stackoverflow.com/q/25970797
has comment: http://stackoverflow.com/comment/40664862
tagged with: spring
type: AnsweredQuestion
tagged with: ehcache
type: Question
has answer: http://stackoverflow.com/a/25971747
accepted answer: http://stackoverflow.com/a/25971747
tagged with: java
tagged with: hibernate
tagged with: caching
score: 0
answer count: 1
has title: hibernate 2nd level cache hits=0 for two successive identical queries
has body: Got a problem setting up 2nd level cache for hibernate for my Spring+Hibernate project or I don't understand how it works. I have one table roughly defined as this @Entity @Cache(usage=CacheConcurrencyStrategy.READ_ONLY, region="testCache") public class TestClass extends MSId { @Transient STATUS statut = STATUS.NORMAL; public FamilleCatalogue(int id) { this.id = id; } } In my configuration I have this : &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt; &lt;property name="hibernate.default_schema" value="dbtest" /&gt; &lt;property name="hibernate.cache.use_query_cache" value="false" /&gt; &lt;property name="hibernate.cache.use_second_level_cache" value="true" /&gt; &lt;property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory" /&gt; &lt;property name="hibernate.generate_statistics" value="true" /&gt; &lt;property name="hibernate.cache.generate_statistics" value="true" /&gt; &lt;property name="hibernate.cache.use_structured_entries" value="false" /&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /&gt; &lt;property name="hibernate.show_sql" value="false" /&gt; &lt;property name="hibernate.format_sql" value="false" /&gt; &lt;property name="hibernate.use_sql_comments" value="false" /&gt; &lt;property name="net.sf.ehcache.configurationResourceName" value="/spring/persistence/single/hibernate/ehcache.xml"/&gt; &lt;property name="hibernate.cache.use_reference_entries" value="true"/&gt; my ehcache.xml contains : &lt;cache name="testCache" eternal="false" timeToIdleSeconds="3600" timeToLiveSeconds="3600" statistics="true" logging="true" maxElementsInMemory="100"&gt; &lt;/cache&gt; Now in my test I query all the element of my test class using this : Query q = this.getEntityManager().createQuery("FROM " + entityClass.getSimpleName()); List&lt;E&gt; result = q.getResultList(); return result; The thing is that I query 2 times the whole lot of them expecting that the second time t…

http://stackoverflow.com/a/25919969
score: 10
has comment: http://stackoverflow.com/comment/40574653
answers question: http://stackoverflow.com/q/25919954
upvote count: 10
type: Answer
accepted answer of: http://stackoverflow.com/q/25919954
has comment: http://stackoverflow.com/comment/40574479
has comment: http://stackoverflow.com/comment/40574223
has comment: http://stackoverflow.com/comment/40574918
has comment: http://stackoverflow.com/comment/40574553
downvote count: 0
has body: public classes have to be in a file with the correct filename. Non-public classes can be in any file you want. Even multiple classes in the same file if it is convenient.
has comment: http://stackoverflow.com/comment/40574595
has comment: http://stackoverflow.com/comment/40574257
type: AcceptedAnswer

http://stackoverflow.com/comment/40607673
comment on: http://stackoverflow.com/q/25938605
type: Comment
type: QuestionComment
has text: Please do some research and take the time to post a question instead of a link to a picture showing text.
score: 4

http://stackoverflow.com/a/25993064
has body: Companys normally have a proxy server to the outside world. Try to configure the proxy data in a Proxy class and open the connection with proxy. Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(&lt;ProxyUrl&gt;,&lt;ProxyPort&gt;)); conn = new URL(urlString).openConnection(proxy); If your proxy has a passwort authentication you have to set the log in data in an Authenticator: Authenticator authenticator = new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return (new PasswordAuthentication(&lt;ProxyUser&gt;,&lt;ProxyPW&gt;.toCharArray())); } }; Authenticator.setDefault(authenticator);
type: Answer
has comment: http://stackoverflow.com/comment/41145230
has comment: http://stackoverflow.com/comment/40731404
answers question: http://stackoverflow.com/q/25992586
score: 0
has comment: http://stackoverflow.com/comment/40735061

conditional-statements
tags question: http://stackoverflow.com/q/26021049
tags question: http://stackoverflow.com/q/25916265
tags question: http://stackoverflow.com/q/25994766
tag name: conditional-statements
tags question: http://stackoverflow.com/q/25924445
type: Tag

http://stackoverflow.com/q/25989299
has body: I am writing a java program where I need to convert(transliterate) English words into their Hindi counterparts. I have found that Google input tools does that wonderfully. But I can't find a jar file or any such method which I can use to integrate the tool into my application. The only possible method is through online requests. Can anybody show me the offline method to take? Thanks in advance.
accepted answer: http://stackoverflow.com/a/28504053
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/28475268
has answer: http://stackoverflow.com/a/28475268
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28504053
has title: Integrate Google input tools in java program
upvote count: 2
tagged with: java
tagged with: integration
type: Question

http://stackoverflow.com/q/26026027
tagged with: user-defined-functions
has title: How to return Struct from Hive UDF?
type: UnansweredQuestion
upvote count: 4
tagged with: hadoop
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/41042422
type: Question
score: 4
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/26031925
has body: I am having trouble finding documentation on how to use a Hive UDF to return a Struct. My major questions are: What types of objects do I start with in Java? How do I convert them so they will be interpreted as a Struct in Hive?
tagged with: hive

http://stackoverflow.com/a/25958850
answers question: http://stackoverflow.com/q/25958783
score: 0
has comment: http://stackoverflow.com/comment/40648918
has comment: http://stackoverflow.com/comment/40676973
type: Answer
has body: You likely need to pass the integer value from one class to another and then you can use YourTextView.setText(YOUR_VARIABLE) to change the value of the TextView. To pass values from one class to another, you can check out these tutorials: here and here.
has comment: http://stackoverflow.com/comment/40645130

http://stackoverflow.com/comment/40509938
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25884635
score: 0
has text: the failure is always at the same time of the day? did you check if there is any ongoing backup job or similar task?

http://stackoverflow.com/comment/40767036
score: 0
comment on: http://stackoverflow.com/q/26026798
type: Comment
type: QuestionComment
has text: Change your loops so you are writing one line at a time. I suggest you do it for just the first line to start with if having one loop is simpler for you. Once you have the first line working adding more lines is easy.

http://stackoverflow.com/a/26312159
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25973854
type: Answer
has body: Looks like a perfect match for Norconex HTTP Collector: It is written 100% in Java. It runs fully on Windows (without the need for Cygwin or a Linux/Unix VM). It is well documented with examples and a forum to ask questions/raise issues (github). It supports incremental crawlings, detecting modified documents as well as deleted ones. It supports both Solr and Elasticsearch, and more (via the use of its "Committers"). It is extensively configurable/flexible. It is easy to integrate with it and provide custom features to it without having to learn complex plugin mechanism (implement an interface, put it in classpath, and voilà). Its development is very active. It is maintained by Norconex, a company of enterprise search professionals. Issues addressed quickly. Version 2.0.0 is heavily being worked on, soon bringing many new features (language detection, document splitting, etc). It is GPL but Norconex offers a commercial license if GPL is a problem for you. It also has many other features you did not list, like the ability to manipulate the document content before sending it to your search engine. It also supports sitemaps, robots rules, etc. I invite you to give it a try: http://www.norconex.com/product/collector-http/
answers question: http://stackoverflow.com/q/25973854

http://stackoverflow.com/comment/40717354
score: 0
type: Comment
type: QuestionComment
has text: Another possibility here: http://zenu.wordpress.com/2011/09/21/aes-128bit-cross-platform-java-and-c-encryption-compatibility/
comment on: http://stackoverflow.com/q/25999115

http://stackoverflow.com/comment/40652450
score: 0
type: Comment
type: QuestionComment
has text: public class User { public String name; public String password;
comment on: http://stackoverflow.com/q/25964233

http://stackoverflow.com/comment/40509166
comment on: http://stackoverflow.com/q/25877458
score: 0
type: Comment
type: QuestionComment
has text: Can you post the code(structure and the content) of your HashMap? You can also set your MyBatis logging level to show the query that is generated. http://mybatis.github.io/mybatis-3/logging.html

http://stackoverflow.com/q/25890072
tagged with: calendar
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25890912
has answer: http://stackoverflow.com/a/25890580
has title: How to compare AM/PM time in Android
has answer: http://stackoverflow.com/a/25956072
has comment: http://stackoverflow.com/comment/40519616
has comment: http://stackoverflow.com/comment/40518770
favorite count: 0
has body: I have a scenario start-time = 4:15 PM end-time = 2:00 AM if my current-time (let say 9:15 PM in the same format as start or end time) fall between start-time and end-time then goto screen 1 other wise goto screen 2 My question is how do I compare current-time greater or equals to 'start-time' and less or equals to 'end-time'. I have tried by converting given time values into milliseconds and compare it but the current-time = 9:15 PM is appeared to be greater than 'end-time = 2:00 AM', as 2:00 AM will come after mid night means if `9:15 PM day = Thursday then 2:00 AM will be the Friday'. I have searching a lot but can't figure it out. Any type of help will be appreciated. EDITED: current-time, start-time and end-time all values taken to be as String EDIT 2 code spinet: long currentTime = getMillis("9:15 PM"); long startTime = getMillis("4:15 PM"); long endTime = getMillis("2:00 AM");//this will be the next day's time confusing part for me if(currentTime &gt;= startTime &amp;&amp; currentTime &lt;= endTime) { //goto screen 1 } else { // goto screen 2 } private long getMillis(String givenTime) { SimpleDateFormat sdf = new SimpleDateFormat("h:mm a"); try { Date mDate = sdf.parse(givenTime); long timeInMilliseconds = mDate.getTime(); System.out.println("Date in milli :: " + timeInMilliseconds); return timeInMilliseconds; } catch (ParseException e) { e.printStackTrace(); } return 0; }
has answer: http://stackoverflow.com/a/25890912
has comment: http://stackoverflow.com/comment/40519156
answer count: 5
tagged with: time
has answer: http://stackoverflow.com/a/25890424
tagged with: android
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/25890278
has answer: http://stackoverflow.com/a/25890278
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40518993
has comment: http://stackoverflow.com/comment/40520620

http://stackoverflow.com/comment/40671541
comment on: http://stackoverflow.com/q/25974488
score: 0
type: Comment
has text: @assylias, to be honest, I am still not getting around it, my problem is that I do not have any mentor to help me learn Java itself, so I am relying more on forums and Javadocs
type: QuestionComment

http://stackoverflow.com/comment/40907975
has text: I agree, I was thinking along the same lines, already modifying the code. I have one more experiment with class loader, and if it fails I'll accept this answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26072536
type: Comment

http://stackoverflow.com/a/26019030
downvote count: 0
has comment: http://stackoverflow.com/comment/40753092
answers question: http://stackoverflow.com/q/26018409
type: Answer
accepted answer of: http://stackoverflow.com/q/26018409
has comment: http://stackoverflow.com/comment/126615137
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/97326801
has comment: http://stackoverflow.com/comment/40752717
has body: You can achieve this in Quartz but you got to twist the normal behaviour by using a CalendarIntervalTrigger to trigger a Job that calculate when your 'real' Job should be scheduled. You schedule a trigger that fire every 1st of your scheduling months : [...] JobDetail jobDetail = newJob(SchedulingCalculationJob.class) .withIdentity("SchedulingCalculation_CalendarIntervaled", "calendarIntervaled") .build(); CalendarIntervalTrigger calendarIntervalTrigger = newTrigger() .withIdentity("calendarIntervalCalculationTrigger", "calendarIntervaled") .withSchedule(calendarIntervalSchedule() .withIntervalInMonths(2)) .startAt(decemberFirst.getTime()) .forJob(jobDetail) .build(); scheduler.scheduleJob(jobDetail, calendarIntervalTrigger); And in the SchedulingCalculationJob Job, you calculate your 'real' Job scheduling day : public class SchedulingCalculationJob implements Job { public void execute(JobExecutionContext context) throws JobExecutionException { Calendar calendar = calculateJobFiringDate(); // Create and schedule a dedicated trigger Trigger calculateFiring = calculateFiring = newTrigger() .withSchedule(SimpleSchedulerBuilder.simpleScheduler()) .startAt(calendar.getTime()) .forJob(yourRealJobDetail) .build(); scheduler.scheduleJob(yourRealJobDetail, calculateFiring); } public static Calendar calculateJobFiringDate() { Calendar result = Calendar.getInstance(); // Set up the scheduling day if (isThereThirtyDaysInCurrentMonth()) { // the 30th of the current month calendar.set(Calendar.DAY_OF_MONTH, 30); } else { // the last day of the current month calendar.add(Calendar.MONTH, 1); calendar.add(Calendar.DATE, -1); } // Set up time of day calendar.set(Calendar.HOUR, ...); calendar.set(Calendar.MINUTE, ...); calendar.set(Calendar.SECOND, ...); return result; } public static boolean isThereThirtyDaysInCurrentMonth() { Calendar thirtydaysInCurrentMonthCalendar = Calendar.getInstance(); Integer currentMonth = thirtydaysInCurrentMonthCalendar.get(Calendar.MONTH); thirtydaysInCu…
has comment: http://stackoverflow.com/comment/97435986
has comment: http://stackoverflow.com/comment/60569328
type: AcceptedAnswer

http://stackoverflow.com/a/25968439
has comment: http://stackoverflow.com/comment/40660422
type: Answer
has body: You should not call your main class String. Additionally, most NoClassDefFound/ClassNotFound can be solved by simply running a clean and build. EDIT Java refers to class names by their FQN (Fully qualified class name), however built in language constructs are automatically recognised (such as String -> java.lang.String) If you need to call your class String you will need to refer to all language (java) based instances by their FQN (assuming your String class is visible to all your classes, i.e. on the classpath)
has comment: http://stackoverflow.com/comment/40660722
has comment: http://stackoverflow.com/comment/40660579
has comment: http://stackoverflow.com/comment/40660502
answers question: http://stackoverflow.com/q/25968390
has comment: http://stackoverflow.com/comment/40660450
has comment: http://stackoverflow.com/comment/40660600
score: 3
accepted answer of: http://stackoverflow.com/q/25968390
has comment: http://stackoverflow.com/comment/40660772
has comment: http://stackoverflow.com/comment/40660524
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40660464

http://stackoverflow.com/a/26027802
upvote count: 2
type: AcceptedAnswer
has body: Basically you just have to multiply the coordinates by scale factor. Below, sx and sy will be numbers (within the interval 0-1) which transform from the larger screen to the smaller screen coordinates. If the screens are the same aspect ratio, then sx == sy, but this need not be true in the general case. &gt;&gt;&gt; w1, h1 = 1920., 1080. &gt;&gt;&gt; w2, h2 = 1280., 720. &gt;&gt;&gt; sx, sy = w2/w1, h2/h1 # scale factors in horizontal and vertical dimensions &gt;&gt;&gt; x1, y1 = 500., 720. &gt;&gt;&gt; x2, y2 = sx*x1, sy*y1 &gt;&gt;&gt; x2, y2 (333.3333333333333, 480.0) By the way, to transform back the other direction the scale factors would be 1/sx and 1/sy.
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26027730
answers question: http://stackoverflow.com/q/26027730

http://stackoverflow.com/a/25882763
accepted answer of: http://stackoverflow.com/q/25882689
score: 1
has comment: http://stackoverflow.com/comment/40507163
upvote count: 1
has comment: http://stackoverflow.com/comment/40507008
has comment: http://stackoverflow.com/comment/40506964
has body: You could try the below regex to replace all the strings mentioned with [%s,%s] (dates)\\s*(?:\\[\\d{4}_\\d{2}_\\d{2},\\d{4}_\\d{2}_\\d{2}\\]|\\d{4}_\\d{2}_\\d{2}|last_\\d{2}_days) Replacement string: $1 [%s,%s] DEMO String s = "select * from someTable t where t.name is not null and dates[2014_09_01,2014_09_15]\n" + "select * from someTable t where t.name is not null and dates 2014_09_01\n" + "select * from someTable t where t.name is not null and dates last_30_days\n"; System.out.println(s.replaceAll("(dates)\\s*(?:(?:\\[\\d{4}_\\d{2}_\\d{2},)?\\d{4}_\\d{2}_\\d{2}\\]?|last_\\d{2}_days)", "$1 [%s,%s]")); Output: select * from someTable t where t.name is not null and dates [%s,%s] select * from someTable t where t.name is not null and dates [%s,%s] select * from someTable t where t.name is not null and dates [%s,%s]
has comment: http://stackoverflow.com/comment/40506938
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25882689
type: Answer

http://stackoverflow.com/a/25926526
answers question: http://stackoverflow.com/q/25926404
has body: ^([a-zA-Z0-9]+[a-zA-Z0-9_\\-\\s]?[a-zA-Z0-9]+)|([a-zA-Z0-9])$ Just add one more or condition which accepting either alphabet or number
has comment: http://stackoverflow.com/comment/40586108
score: 0
type: Answer

dayofweek
type: Tag
tags question: http://stackoverflow.com/q/25880620
tags question: http://stackoverflow.com/q/25956457
tag name: dayofweek

http://stackoverflow.com/comment/40549535
type: Comment
comment on: http://stackoverflow.com/q/25905368
type: QuestionComment
score: 0
has text: @M.Deinum as u have said that there is no more need to use **Class.forName()** now. But I want to ask you one more thing that why it is used before, I mean does there any difference between Class.forName("com.mysql.jdbc.Driver").newInstance(); and new com.mysql.jdbc.Driver();

http://stackoverflow.com/a/26014046
answers question: http://stackoverflow.com/q/26013922
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26013922
downvote count: 0
score: 4
type: AcceptedAnswer
has body: 1.Create a Customer class 2.Create a CustomerInfo class 3.Customer has CustomerInfo 4.Now create using Jaxb your xml file.

http://stackoverflow.com/q/25957247
type: AnsweredQuestion
score: 3
tagged with: android-notifications
downvote count: 0
has comment: http://stackoverflow.com/comment/40776128
has title: Android Proximity Alert - Not Triggering
favorite count: 0
has body: I am going crazy not getting what I am doing wrong and I am now turning to StackOverflow for help. I am trying to add locations with proximity alerts and when the proximity alert triggers I get a notification. I am getting location updates when moving around and I have application continiously printing my distance to the location where my proximity alert is centered. The issue is that the proxmity alerts never trigger. I have been using the physical device with the actual GPS when trying this. Code for setting the proximity alert. The toast at the end is shown so I know that this code runs. LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Intent intent = new Intent(PROX_ALERT_INTENT); intent.putExtra(PROXIMITY_ITEM_ID, item.getID()); PendingIntent proximityIntent = PendingIntent.getBroadcast(this, item.getID(), intent, 0); locationManager.addProximityAlert( item.getPlace().getLocation().latitude, // the latitude of the central point of the alert region item.getPlace().getLocation().longitude, // the longitude of the central point of the alert region 200, // the radius of the central point of the alert region, in meters -1, // time for this proximity alert, in milliseconds, or -1 to indicate no expiration proximityIntent // will be used to generate an Intent to fire when entry to or exit from the alert region is detected ); IntentFilter filter = new IntentFilter(PROX_ALERT_INTENT); this.registerReceiver(new ProximityAlertBroadcastReceiver(), filter); Toast.makeText(this, "Added new proximity alert event...", Toast.LENGTH_SHORT).show(); And then I have the code for the broadcast receiver. This code never runs so I never get the toast or the notification. public class ProximityAlertBroadcastReceiver extends BroadcastReceiver { private void createNotification(Context context, ToDoItem todoItem) { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.todomaps_icon) .setContentT…
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/26055054
linked to: http://stackoverflow.com/q/12638668
upvote count: 3
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40818011
has answer: http://stackoverflow.com/a/26055054

exception
tags question: http://stackoverflow.com/q/25906609
tags question: http://stackoverflow.com/q/25997950
tags question: http://stackoverflow.com/q/25953197
tags question: http://stackoverflow.com/q/25962814
tags question: http://stackoverflow.com/q/25892015
tags question: http://stackoverflow.com/q/25925978
tags question: http://stackoverflow.com/q/25921475
tags question: http://stackoverflow.com/q/25968072
tags question: http://stackoverflow.com/q/25944608
tags question: http://stackoverflow.com/q/25881742
tags question: http://stackoverflow.com/q/25916300
tags question: http://stackoverflow.com/q/25954172
tags question: http://stackoverflow.com/q/26015238
tags question: http://stackoverflow.com/q/25971031
tags question: http://stackoverflow.com/q/25877722
tags question: http://stackoverflow.com/q/25883984
tags question: http://stackoverflow.com/q/26007389
tags question: http://stackoverflow.com/q/25927093
tags question: http://stackoverflow.com/q/26031766
tags question: http://stackoverflow.com/q/25879171
type: Tag
tags question: http://stackoverflow.com/q/25963110
tags question: http://stackoverflow.com/q/25913081
tags question: http://stackoverflow.com/q/25986750
tags question: http://stackoverflow.com/q/25898486
tags question: http://stackoverflow.com/q/26024717
tags question: http://stackoverflow.com/q/25897677
tags question: http://stackoverflow.com/q/26028388
tags question: http://stackoverflow.com/q/25896377
tags question: http://stackoverflow.com/q/25897909
tags question: http://stackoverflow.com/q/25951742
tags question: http://stackoverflow.com/q/25920223
tags question: http://stackoverflow.com/q/26027463
tags question: http://stackoverflow.com/q/25890034
tags question: http://stackoverflow.com/q/25959817
tags question: http://stackoverflow.com/q/25896378
tags question: http://stackoverflow.com/q/25891317
tags question: http://stackoverflow.com/q/25886545
tags question: http://stackoverflow.com/q/25953864
tags question: http://stackoverflow.com/q/25905941
tags question: http://stackoverflow.com/q/25891737
tags question: http://stackoverflow.com/q/25997841
tags question: http://stackoverflow.com/q/26031149
tags question: http://stackoverflow.com/q/25903245
tags question: http://stackoverflow.com/q/25962056
tags question: http://stackoverflow.com/q/25881598
tag name: exception
tags question: http://stackoverflow.com/q/26028044
tags question: http://stackoverflow.com/q/25877199
tags question: http://stackoverflow.com/q/25892982
tags question: http://stackoverflow.com/q/25901407
tags question: http://stackoverflow.com/q/25923071
tags question: http://stackoverflow.com/q/25947796
tags question: http://stackoverflow.com/q/25939486
tags question: http://stackoverflow.com/q/25918163
tags question: http://stackoverflow.com/q/25940187
tags question: http://stackoverflow.com/q/25961188
tags question: http://stackoverflow.com/q/25988270
tags question: http://stackoverflow.com/q/25994288
tags question: http://stackoverflow.com/q/26006323
tags question: http://stackoverflow.com/q/25904416

http://stackoverflow.com/comment/40603092
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25935952
has text: It's clear that returned value is of type `SimpleMatrix`. Refer to your library OR code as to what is the behaviour of SimpleMatrix class!!!

http://stackoverflow.com/comment/40633540
type: Comment
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/25953958
has text: What version of Java are you using?

http://stackoverflow.com/comment/40549870
has text: You don't need to store the json, You just recall them when you need them. Otherwise if you really want to store them then do Caching. So if you are retrieving them successfully then you might be having problem in recalling them, when you need them.
comment on: http://stackoverflow.com/q/25900899
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25904831
answers question: http://stackoverflow.com/q/25903781
type: Answer
has body: You can use JSP EL like this: &lt;logic:iterate id="aList" name="SomeForm" property="MyList"&gt; &lt;html:text styleClass="input-text" name="SomeForm" property="lalalala" size="${aList.SomeLength}"&gt; &lt;/logic:iterate&gt;
score: 3
downvote count: 0
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25903781

http://stackoverflow.com/comment/40774701
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26029707
has text: What error are you getting right now?

http://stackoverflow.com/a/25991097
has body: No need to worry about a session being shared across multiple threads. By default the SessionFactory will bind a Session per thread in each of the 3 possible configurations. Here it is an extract from Hibernate 4 docs: However, as of version 3.1, the processing behind SessionFactory.getCurrentSession() is now pluggable. To that end, a new extension interface, org.hibernate.context.spi.CurrentSessionContext, and a new configuration parameter, hibernate.current_session_context_class, have been added to allow pluggability of the scope and context of defining current sessions. ... Out-of-the-box, Hibernate comes with three implementations of this interface: org.hibernate.context.internal.JTASessionContext: current sessions are tracked and scoped by a JTA transaction. The processing here is exactly the same as in the older JTA-only approach. See the Javadocs for details. org.hibernate.context.internal.ThreadLocalSessionContext:current sessions are tracked by thread of execution. See the Javadocs for details. org.hibernate.context.internal.ManagedSessionContext: current sessions are tracked by thread of execution. However, you are responsible to bind and unbind a Session instance with static methods on this class: it does not open, flush, or close a Session.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40702262
accepted answer of: http://stackoverflow.com/q/25989277
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40702910
has comment: http://stackoverflow.com/comment/40702655
upvote count: 2
has comment: http://stackoverflow.com/comment/40703349
has comment: http://stackoverflow.com/comment/40701984
answers question: http://stackoverflow.com/q/25989277

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/25911517
tags question: http://stackoverflow.com/q/25946103
tags question: http://stackoverflow.com/q/25963481
tags question: http://stackoverflow.com/q/25921378

http://stackoverflow.com/q/25911025
tagged with: javascript
has answer: http://stackoverflow.com/a/25911419
possible better answer: http://stackoverflow.com/a/25911123
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25911123
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40557143
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40557345
tagged with: android
accepted answer: http://stackoverflow.com/a/25911419
has title: Start new Activity when html button clicked in Cordova
has body: I am trying to build Android Application with Cordova and Java. I want to build intent that start a new Intent when button clicked in the HTML code. This is my HTML code: Demo Phonegap Hello Android test And this is my Java code: public class MyActivity extends DroidGap { /** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); super.loadUrl("file:///android_asset/www/index.html"); } public void NewIntent() { Intent i = new Intent(this,HelpActivity.class); startActivity(i); } } How can I call the NewIntent() void from the html file without building plugin. Thanks for answers Haim. EDIT:I using the phonegap for the GUI of my application.I want to call to another activity when button is clicked in the cordova html file.
tagged with: cordova
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40557067
has comment: http://stackoverflow.com/comment/40557315

http://stackoverflow.com/q/25960436
has comment: http://stackoverflow.com/comment/40645517
upvote count: 5
tagged with: java
type: Question
has title: How can I exclude null fields form my JSON request in Jersey?
answer count: 2
score: 5
tagged with: jersey
downvote count: 0
has answer: http://stackoverflow.com/a/68138005
favorite count: 0
linked to: http://stackoverflow.com/q/11757487
has body: What I'm trying to do is to avoid null fields in my request. I use this Jersey dependencies org.glassfish.jersey.core jersey-client 2.5 com.sun.jersey jersey-json 1.18 com.sun.jersey.contribs jersey-multipart 1.17 org.glassfish.jersey.media jersey-media-json-jackson 2.5.1 Here is my Jersey configuration Client client = ClientBuilder .newClient() .register(authenticationFeature) .register(CustomTypeProvider.class) .register(MultiPartWriter.class) .register(JacksonFeature.class); And that's what I'm trying to send { "locale": "en_US", "file": { "file": { "version": null, "permissionMask": null, "creationDate": null, "updateDate": null, "label": "my.properties", "description": null, "uri": null, "type": "prop", "content": null } } } but I need { "locale": "en_US", "file": { "file": { "label": "my.properties", "type": "prop", } } } How can I exclude all null fields form my request?
has answer: http://stackoverflow.com/a/25960533
type: UnansweredQuestion

http://stackoverflow.com/a/25881401
score: 0
answers question: http://stackoverflow.com/q/25881355
has body: You can deduct the character 'a' from the character itself so that would give 0 for 'a', 1 for 'b' etc. int[] digits = new int[plaintext.length()]; for(int i = 0; i &lt; digits.length; i++) { digits[i] = plaintext.charAt(i) - 'a'; } NOTE: this will only work for lowercase letters
type: Answer

http://stackoverflow.com/q/25973836
has answer: http://stackoverflow.com/a/51723841
tagged with: weblogic
tagged with: cursors
accepted answer: http://stackoverflow.com/a/51723841
has title: ORA-01000 - Maximum open cursors exceeded - Spring JDBC 3.2.5
tagged with: java
has comment: http://stackoverflow.com/comment/40669911
type: Question
upvote count: 2
answer count: 2
tagged with: oracle11gr2
favorite count: 0
has body: we have a Java Enterprise Application running on Weblogic Server 12c using Spring JDBC 3.2.5 to access Oracle 11gR2 Database. In production environment after some time we got this exception: "ORA-01000 - Maximum open cursors exceeded" and server instance need to be restarted; it seems that open cursors increase more and more until they reach the maximum threshold set on Oracle. Increasing the threshold didn t solve the problem. We check the (very large) source code but we didn t find any point where we miss closing connection, at the moment; moreover we usually don t open and close connections but we use Spring JdbcTemplate to handle database interaction. Could be a Spring problem? Any hints?
linked to: http://stackoverflow.com/q/12192592
possible better answer: http://stackoverflow.com/a/25973977
tagged with: spring
has answer: http://stackoverflow.com/a/25973977
score: 2
downvote count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/40896358
type: Comment
has text: Scaled my data but that was very bad experience accuracy drop to 50.2%.
comment on: http://stackoverflow.com/a/25922951
type: AnswerComment
score: 0

http://stackoverflow.com/q/26005726
has answer: http://stackoverflow.com/a/26006540
has comment: http://stackoverflow.com/comment/40728603
tagged with: animated-gif
type: AnsweredQuestion
tagged with: image-rotation
has comment: http://stackoverflow.com/comment/40728643
tagged with: java
accepted answer: http://stackoverflow.com/a/26006540
has body: I am trying to rotate an animated gif stored in an ImageIcon using an AffineTransform. The result is that the image does not get drawn. Here's my code: AffineTransform trans = AffineTransform.getRotateInstance(imgYaw, img.getImage().getWidth(null) / 2, img.getImage().getHeight(null) / 2); AffineTransformOp transo = new AffineTransformOp(trans, AffineTransformOp.TYPE_BILINEAR); BufferedImage bufferedimg = new BufferedImage(img.getImage().getWidth(null), img.getImage().getHeight(null), BufferedImage.TYPE_4BYTE_ABGR); img.setImage(atransO.filter(bufferedimg, null)); img.paintIcon(null, g, x, y);
type: Question
has title: Rotate an animated GIF (ImageIcon) using AffineTransform
tagged with: affinetransform
has comment: http://stackoverflow.com/comment/40728565
has comment: http://stackoverflow.com/comment/40729587
linked to: http://stackoverflow.com/q/20275424
score: 0
has comment: http://stackoverflow.com/comment/40728929
answer count: 1

http://stackoverflow.com/comment/40491117
has text: When I use the phrase "Would you rather have tea, eat cookie, or push up?" the array's values are nullhave tea, null eat cookie, and null push up.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25874028

http://stackoverflow.com/comment/40686895
comment on: http://stackoverflow.com/q/25982791
has text: Create a new BufferedImage, copy (draw) the old one onto, offset by the number of new titles you need. Draw the new titles into the new space...
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26032951
type: Question
tagged with: java
has title: Unable to get exact values on another intent using simpleadapter
answer count: 1
has body: Hey guys i am using a custom list adapter class that extends to simpleadapter for populating a multicolumn listview. I set onclick listener event on each of the textview in a column but I am unable to retrieve the values from that row associated with that textview and all its elements to another intent where I want to show data. Now on implementing this code I am getting random integers instead of correct values of the textview that was clicked. this is my custom list adapter.java class package com.example.category_wise_colored_newreport; public class CustomList_adapter extends SimpleAdapter{ private List&lt;Map&lt;String, Object&gt;&gt; itemList; //private ArrayList&lt;HashMap&lt;String , String&gt;&gt; itemList; private Context mContext; String ofc_code="ofc_code "; String ofc_desg="ofc_desg "; String ofc_name="ofc_name "; String dep_name="dep_name "; String total_comp="total_comp "; String pending="pending "; String desposed="disposed "; String interim="interim "; String defaulter="defaulter "; String diposed_perc="disposed_percent "; String TAG_COLOR1="color1"; String TAG_COLOR2="color2"; String TAG_COLOR3="color3"; String TAG_COLOR4="color4"; String TAG_COLOR5="color5"; ViewHolder holder=null; public CustomList_adapter(Context context, List&lt;? extends Map&lt;String, ?&gt;&gt; data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); // TODO Auto-generated constructor stub this.itemList=(List&lt;Map&lt;String,Object&gt;&gt;) data; this.mContext=context; } class ViewHolder { TextView code; TextView desg; TextView name; TextView dep; TextView comp; TextView pend; TextView disp; TextView intr; TextView defl; TextView dispper; } @SuppressWarnings("unused") @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub LayoutInflater inflater=(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if(convertView==null) { convertView=inflater.inflate(R.layout.li…
has answer: http://stackoverflow.com/a/26201629
type: UnansweredQuestion
tagged with: android
score: 0
tagged with: android-intent

http://stackoverflow.com/q/25958094
tagged with: wavelet-transform
tagged with: matlab
has title: java equivalent of [cA,cH,cV,cD] = dwt2(X,'wname') in matlab
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: image-processing
type: Question
has comment: http://stackoverflow.com/comment/43716309
has comment: http://stackoverflow.com/comment/43763161
has body: How can I do same thing in java as does [cA,cH,cV,cD] = dwt2(X,'wname') in matlab ? More specifically I need wavelet transform coefficients for "Daubechies 2" wavelet of an Image or 2D array of numeric values. This can be done very easily in matlab in single line just by [cA,cH,cV,cD] = dwt2(X,'db2'). But I need it too be done in java. Thanks in advance! :)
score: 0
has comment: http://stackoverflow.com/comment/40640944

http://stackoverflow.com/q/25878948
answer count: 3
tagged with: higher-order-functions
has title: How to sort a stream by parameter using a comparator in Java 8?
favorite count: 0
type: UnansweredQuestion
tagged with: lambda
tagged with: java-8
score: 4
tagged with: java-stream
has body: How to sort a collection using comparator and a parameter in Java 8? Here is a piece of code: List&lt;Point&gt; sortedNeurons = neurons.parallelStream() .sorted((n1, n2) -&gt; Double.compare( n1.getEuclideanDistanceFrom(inputVector), n2.getEuclideanDistanceFrom(inputVector))) .collect(Collectors.toList()); You are given a parameter inputVector that can be passed to a function that returns a primitive double value. If applied to an element of the collection, it returns some number. I want the collection to be ordered by this value. Something like: select id from neurons order by getEuclideanDistanceFrom(inputVector, id); There are three problems here: nx.getEuclideanDistanceFrom(inputVector) gets repeated twice. I would like to use natural ordering of a double type, without declaring it, just like in an SQL query, when using order by clause. Perhaps n1, n2 -> n1, n2 could be substituted with a double colon :: notation. P.S. I have a strong feeling that it can be fixed using something like bifunction or biconsumer... but couldn't figure it out...
tagged with: java
has answer: http://stackoverflow.com/a/25922559
type: Question
upvote count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/25922264
has answer: http://stackoverflow.com/a/25879067

http://stackoverflow.com/comment/40556692
comment on: http://stackoverflow.com/q/25909606
has text: have you checked that profile in public mode?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40819830
has text: It's just an alternative way to check equality, it's like saying with getters (if I had any) cell.getRow()==r&&cell.getColumn()==c
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26050017
type: Comment

http://stackoverflow.com/a/26012481
type: AcceptedAnswer
type: Answer
has body: The last answer from this thread: How to get classpath from classloader? may be what you want: ClassLoader cl = ClassLoader.getSystemClassLoader(); URL[] urls = ((URLClassLoader) cl).getURLs(); for (URL url: urls) { System.out.println(url.getFile()); }
answers question: http://stackoverflow.com/q/26011802
accepted answer of: http://stackoverflow.com/q/26011802
score: 0

http://stackoverflow.com/comment/40561505
has text: check this http://stackoverflow.com/questions/17818058/android-ndk-unsatisfiedlinkerror-a-surprising-reason?rq=1
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25911962

http://stackoverflow.com/q/25952749
tagged with: android
tagged with: chromecast
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: google-cast
has answer: http://stackoverflow.com/a/25952903
accepted answer: http://stackoverflow.com/a/25952903
score: 0
answer count: 1
has body: I'm very new to the google cast sdk and I have registered a app on the cast developer console with a style media receiver. My idea is to send images to the chromecast device from an android application. I have tried a few examples and tried writing my own now and following is the code snippets I have used to get the device discovered. but it doesn't seem to work. I have set the correct permissions in the manifest as well but I can't get the cast button to display on the action bar for some reason. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable( android.R.color.transparent)); mMediaRouter = MediaRouter.getInstance(getApplicationContext()); mMediaRouteSelector = new MediaRouteSelector.Builder() //.addControlCategory( //CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID).build(); .addControlCategory( CastMediaControlIntent.categoryForCast(getResources() .getString(R.string.app_id))).build(); mMediaRouterCallback = new MyMediaRouterCallback(); } @Override protected void onResume() { super.onResume(); // Start media router discovery mMediaRouter.addCallback(mMediaRouteSelector, mMediaRouterCallback, MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY); } @Override protected void onPause() { if (isFinishing()) { // End media router discovery mMediaRouter.removeCallback(mMediaRouterCallback); } super.onPause(); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.main, menu); MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item); MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat .getActionProvider(mediaRouteMenuItem); // Set the MediaRouteActionProvider selector for device discovery. mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector); return t…
has title: cast device discovery won't work with my application ID

http://stackoverflow.com/comment/91175819
has text: can you share the "getAudioInputStream" mthod
type: QuestionComment
comment on: http://stackoverflow.com/q/25954052
type: Comment
score: 0

http://stackoverflow.com/q/26004651
has body: I am sorry for the poor title, but I was not sure what my problem is called. (Please let me know in the answer if you can) I have two classes in which I am trying to interact with. Class 'Setup' has variables I need in class 'Begin', and vice versa. I have tried extending class 'Setup' in the 'Begin' class by doing: public class Begin extends Setup { Something to note, I do reference the 'Begin' class in the 'Setup' class in this manner: Begin b = new Begin(); I have also tried referencing both the 'Setup' and 'Begin' class in each respective class. This did not help. I am getting the 'java.lang.StackOverflowError' error in both classes. I get the error where I refrence the other class. (Error in 'Begin': 'Setup s = new Setup();' Error in 'Setup': 'Begin b = new Begin();') I am not aware of why I am getting this error, and I did not know what 'referencing' a class was properly called. I apologize if this is a duplicate. If it is, please link me to the page. If not, please let me know what I can do to get my program working properly again. The code and classes I mentioned in this topic are just examples. They are not the classes I am working with. I thought it may be helpful to note that I am working with JFrame. I am only extending one class to JFrame, but both classes are working with JFrame. I have created a new JFrame in the class that is not extending JFrame though. If you are not able to give an answer you think will help, I will post the code my two classes. Thanks in advance! ~Rane EDIT: Thanks guys! I am really glad you were able to help me out with the example I gave. Thanks again!
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40726586
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40801429
upvote count: 1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26004753
has comment: http://stackoverflow.com/comment/40726578
tagged with: class
accepted answer: http://stackoverflow.com/a/26004753
has comment: http://stackoverflow.com/comment/40726642
downvote count: 0
has comment: http://stackoverflow.com/comment/40801198
answer count: 1
has comment: http://stackoverflow.com/comment/40726640
favorite count: 0
has title: I get a StackOverflow Error when I refrence two classes. Why?
has comment: http://stackoverflow.com/comment/40726791
tagged with: jframe
has comment: http://stackoverflow.com/comment/40727688

http://stackoverflow.com/a/26007194
score: 2
has body: You need to stop using recursion. You are running out of stack space due to the recursive call in your number method. You can modify the method to use a loop rather than a recursive call to itself. That will keep you from running out of stack space.
downvote count: 0
answers question: http://stackoverflow.com/q/26007167
upvote count: 2
type: Answer

http://stackoverflow.com/a/25958641
has comment: http://stackoverflow.com/comment/40643571
has comment: http://stackoverflow.com/comment/40644047
type: Answer
answers question: http://stackoverflow.com/q/25958251
has body: Please check if you are using the correct API-call. The API documentation states for getInstance() /** * Get the instance of {@link SimpleFacebook}. * * Important: Use this method only after you initialized this library * or by: {@link #initialize(Activity)} or by {@link #getInstance(Activity)} * * @return The {@link SimpleFacebook} instance */ public static SimpleFacebook getInstance() { return mInstance; } I did not see a call like initialize(Activity) or getInstance(Activity) in your code snippet.
upvote count: 1
has comment: http://stackoverflow.com/comment/40643252
score: 1
downvote count: 0

http://stackoverflow.com/q/26005336
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26006696
downvote count: 0
score: 1
has title: Java program Check-in timer
favorite count: 0
has comment: http://stackoverflow.com/comment/40727837
has body: I'm trying to setup a "check-in" thread in my program that will throw an exception if another thread doesn't perform a "check-in" command before time is up. If another thread does check-in before time is up, the timer resets and listens for another check-in. I'm not overly familiar with Java's Timer object, but I'm assuming the best way to do this would be using the Timer, as the only other method I can think of is starting a new thread with a Thread.sleep(time) and interrupting it before it wakes, then re-instantiating/starting it; if it gets through the Thread.sleep(time) it throws the exception. This seems extremely crude and inefficient, though. So, the basic idea is this: Start some kind of timer with a "timeout" of 60 seconds. If the timeout is reached, an exception is thrown. If another thread "checks-in" before timer times out, the timer resets. How can I properly do this?
tagged with: timer
accepted answer: http://stackoverflow.com/a/26006696
has comment: http://stackoverflow.com/comment/40727854
type: Question
has answer: http://stackoverflow.com/a/26005450
tagged with: checkin
has comment: http://stackoverflow.com/comment/40727824
possible better answer: http://stackoverflow.com/a/26005450
tagged with: java
tagged with: multithreading
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/40728694

http://stackoverflow.com/q/25936749
tagged with: java
upvote count: 1
tagged with: unit-testing
has title: cassandraUnit TestExecutionListener Error?
type: UnansweredQuestion
has body: I'm new to Cassandra-unit and I've been stuck trying to get a simple test going with Spring testing. I am trying to get Cassandra-Unit working but I can't get a test running and I'm getting the following error message: 2014-09-19 11:08:22,438 [main] WARN test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.cassandraunit.spring.CassandraUnitTestExecutionListener@6221a451] to process 'before' execution of test method [public void controllerTests.cassandraTest.test()] for test instance [controllerTests.cassandraTest@52719fb6] java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122) at org.cassandraunit.spring.AbstractCassandraUnitTestExecutionListener.dataSetLocations(AbstractCassandraUnitTestExecutionListener.java:88) at org.cassandraunit.spring.AbstractCassandraUnitTestExecutionListener.startServer(AbstractCassandraUnitTestExecutionListener.java:57) at org.cassandraunit.spring.CassandraUnitTestExecutionListener.beforeTestMethod(CassandraUnitTestExecutionListener.java:18) at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:348) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.…
answer count: 0
downvote count: 0
score: 1
favorite count: 0
tagged with: cassandra
type: Question
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/40629447
type: AnswerComment
type: Comment
has text: Yes it is correct, but whenever we call parse method we will loose the timezone information which Date object will not contain. I want the returned string to be in CST timezone
comment on: http://stackoverflow.com/a/25951878
score: 0

http://stackoverflow.com/comment/40666348
comment on: http://stackoverflow.com/a/25967516
has text: @EJP Then how can the compiler avoid the class lookup in `new A()`? If the class associated with `A` can change at runtime the compiler has to look it up every time, even using the other syntax. If the class doesn't change, then the compiler *can* optimize away `Class.forName("A")` with just `A` (I mean, a reference to the class object, thus avoiding lookup by name).
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/40688655
has text: This is not thread-safe. Somebody had to say it.
type: QuestionComment
comment on: http://stackoverflow.com/q/25983775
type: Comment
score: 0

http://stackoverflow.com/comment/40649934
comment on: http://stackoverflow.com/q/25962780
type: Comment
has text: And? Where is the problem? Have you tried `TextView2.setText(String.valueOf(ship1.getAddSpend()))` already?
type: QuestionComment
score: 0

http://stackoverflow.com/q/25915296
favorite count: 0
type: UnansweredQuestion
answer count: 0
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40565812
downvote count: 1
type: Question
has title: ComboLock code Java
has comment: http://stackoverflow.com/comment/40565796
has comment: http://stackoverflow.com/comment/40565265
has comment: http://stackoverflow.com/comment/40566088
has comment: http://stackoverflow.com/comment/40565199
has body: Alright so the program works for the most part but when I test it regardless of if I input the correct code for the combination lock it says it is wrong. The checks are not coming up correctly. public class ComboLock { // ********* you will need to create appropriate instance variables here private boolean nutural = true; private int position = 0; // current value lock dial is set to private boolean flag1, flag2, flag3; private int one, two, three; private boolean unlock = true; ComboLock lock = new ComboLock(35, 12, 37); // more variables here .... /** * Initializes the combination of the lock. */ // **** COMPLETE THIS CONSTRUCTOR - input should be 3 number combination // **** You may need to set other instance variables other than the // **** arguments here // You should verify that the secret number are in the range 0-39 // (inclusive) // if the values given are not in that range, clamp them. // i.e. the call new ComboLock(0, -20, 45) would create a combination of // 0, 0, 39 (the -20 gets clamped to 0 because it was less than 0) // (the 45 gets clamped to 39 because it was &gt; 39). public ComboLock(int secret1, int secret2, int secret3) { this.one = secret1; this.two = secret2; this.three = secret3; } /** * Resets the state of the lock so that it can be opened again. */ // ********* COMPLETE THIS METHOD public void reset() { nutural = true; flag1 = false; flag2 = false; flag3 = false; } /** * Turns lock left given number of ticks. * * @param ticks number of ticks to turn left */ // *********COMPLETE THIS METHOD // you can assume that ticks will be a valid value between 0-40 // note that 40 ticks in either direction should return us back to the // number we started on public void turnLeft(int ticks) { if (position + ticks &lt; 40) { position = (position + ticks); flag2 = false; if (position == two) { flag2 = true; } } else { position = ((position + ticks) - 40); flag2 = false; if (position == two) { flag2 = true; } } } /** * Turns lock right given number of tick…

http://stackoverflow.com/comment/40571995
type: QuestionComment
score: 0
has text: Java doesn't provide an unsigned 32-bit integer. Sorry!
type: Comment
comment on: http://stackoverflow.com/q/25918757

jersey
tags question: http://stackoverflow.com/q/25915049
tags question: http://stackoverflow.com/q/25875947
tags question: http://stackoverflow.com/q/25877575
tags question: http://stackoverflow.com/q/25912403
tags question: http://stackoverflow.com/q/25905941
tags question: http://stackoverflow.com/q/25960436
tags question: http://stackoverflow.com/q/25907630
tags question: http://stackoverflow.com/q/25993922
tags question: http://stackoverflow.com/q/26002462
tags question: http://stackoverflow.com/q/25991034
tags question: http://stackoverflow.com/q/25975679
tags question: http://stackoverflow.com/q/25996562
tags question: http://stackoverflow.com/q/25957721
tags question: http://stackoverflow.com/q/25909518
tags question: http://stackoverflow.com/q/25957818
tags question: http://stackoverflow.com/q/25910876
tags question: http://stackoverflow.com/q/26027275
tags question: http://stackoverflow.com/q/25937821
tag name: jersey
tags question: http://stackoverflow.com/q/25875367
tags question: http://stackoverflow.com/q/25988851
tags question: http://stackoverflow.com/q/25984191
tags question: http://stackoverflow.com/q/25957856
tags question: http://stackoverflow.com/q/25892831
tags question: http://stackoverflow.com/q/25874896
tags question: http://stackoverflow.com/q/25895808
tags question: http://stackoverflow.com/q/25890909
type: Tag

http://stackoverflow.com/comment/40529319
score: 0
has text: Whenever you find yourself writing "it does not compile," remember to include the specific error you're getting. I've added what I got when I did this with Java 8.
comment on: http://stackoverflow.com/q/25895514
type: Comment
type: QuestionComment

keymapping
tag name: keymapping
type: Tag
tags question: http://stackoverflow.com/q/25934496

http://stackoverflow.com/a/25948694
accepted answer of: http://stackoverflow.com/q/25948659
answers question: http://stackoverflow.com/q/25948659
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40624939
type: Answer
has comment: http://stackoverflow.com/comment/40624825
has comment: http://stackoverflow.com/comment/40624760
has body: Read the JTable tutorial. Understand that you're already using components of a sort inside JTable cells. When displayed the JTable is rendering a TableCellRenderer, an object that must return a Component that is displayed by each cell. When a cell is being edited, then the JTable will display a (usually) different object, a component produced by theTableCellEditor. Your job then is to change your table's renderor and or editor, depending on your need, the steps of which are too long to show simply in this answer. Again, the tutorials will show you the way. Note that no matter what route you take in your solution, the JTable's cell renderer will not be displaying any actual components, but rather will only be displaying renderings of a component, and that's a big difference. The cell editor however will show an actual component, but only when the cell is in the act of being edited. As a second aside, the table is used as a tabular presentation of data, and usually, the same type of data is displayed in each column, so you'd have to make a strong argument to convince me to have a single JTable column sometime display a JButton and at other times a JComboBox. For instance, to have one JTable column's editor show a combo box, you could set its default cell editor to use the combobox like so: String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" }; JComboBox&lt;String&gt; petCombo = new JComboBox&lt;&gt;(petStrings); String[] columnNames = {"name", "elem"}; Object[][] data = { {"Pet 1", null}, {"Pet 2", null} }; DefaultTableModel model = new DefaultTableModel(data, columnNames); JTable table = new JTable(model); table.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(petCombo));

http://stackoverflow.com/q/25962165
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40648777
favorite count: 0
has title: Big-O notation for LinkedList and BinarySearch
has comment: http://stackoverflow.com/comment/40648864
has comment: http://stackoverflow.com/comment/40648801
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25962359
tagged with: big-o
linked to: http://stackoverflow.com/q/11032015
tagged with: linked-list
tagged with: java
duplicate of: http://stackoverflow.com/q/11032015
type: Question
has comment: http://stackoverflow.com/comment/40648792
tagged with: algorithm
linked to: http://stackoverflow.com/q/8185079
score: 4
tagged with: binary-search
upvote count: 4
has body: I am trying to calculate the Big-Oh for this code, which is for performing a binary search on a linked list: public int search( List&lt;T&gt; list, T target ) { int low = 0; int high = list.size() - 1; int middle; while ( low &lt;= high ) { // frequency &lt;&lt; log( n ) middle = ( low + high ) / 2; int cmp = target.compareTo( list.get( middle ) ); // time &lt;&lt; n if ( cmp &lt; 0 ) high = middle - 1; else if ( cmp &gt; 0 ) low = middle + 1; else return middle; } // time &lt;&lt; n log( n ) return -1; } // time &lt;&lt; n log( n ) I get O(n log(n)) as the answer. Is this a correct way of calculating this search method for this type of list?
has comment: http://stackoverflow.com/comment/40648796

http://stackoverflow.com/a/25926238
answers question: http://stackoverflow.com/q/25926226
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40585532
has body: My friend, it's time to learn about loops! for (int i = 0; i &lt; 40; ++i) { pen.drawOval(num1,num2); num1 += 5; }
accepted answer of: http://stackoverflow.com/q/25926226
has comment: http://stackoverflow.com/comment/40585442
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/26003271
upvote count: 23
score: 22
has comment: http://stackoverflow.com/comment/54408734
tagged with: java
linked to: http://stackoverflow.com/q/18649486
has comment: http://stackoverflow.com/comment/45679751
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40724058
has comment: http://stackoverflow.com/comment/40724086
has comment: http://stackoverflow.com/comment/40723748
answer count: 1
favorite count: 0
has body: When I execute mvn release:perform on a parent POM, the server is responding with this error about one of the child projects (filenames redacted): [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project: Failed to deploy artifacts: Could not transfer artifact from/to repository: Failed to transfer file. Return code is: 400, ReasonPhrase: Bad Request. However, all the files for this child project are successfully uploaded! I see a new directory (named after the release version number) and it contains all the .jar, .pom, .md5, and .sha1 files one would expect. I don't have access to the Nexus server, but I'm wondering what might cause this and how to fix it. Is it possible that Maven is trying to upload this particular child project twice? If so, why would Maven be doing this and how can I stop it? UPDATE: If you're having the same problem, check out the answer with the most upvotes in this post. I ran mvn help:effective-pom and found that the project in question actually had two executions of the deploy phase. Removing one of those executions solved my problem.
linked to: http://stackoverflow.com/q/4251488
has title: Nexus accepts upload but says it failed
tagged with: nexus
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36173745
tagged with: maven

http://stackoverflow.com/a/25947999
has body: You can create an overview HTML file and place it anywhere you like in your source tree. The convention is to call it overview.html and place it at the root of your tree, but you are certainly not obligated to do so. In fact, you can create multiple overview files for different purposes. When you generate your javadocs, you use the -overview flag and pass it the path to the target overview file. You can find more information about overview file requirements here.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/118192704
score: 21
has comment: http://stackoverflow.com/comment/117974954
has comment: http://stackoverflow.com/comment/67134327
has comment: http://stackoverflow.com/comment/118095715
type: Answer
has comment: http://stackoverflow.com/comment/118157043
accepted answer of: http://stackoverflow.com/q/25947627
upvote count: 21
answers question: http://stackoverflow.com/q/25947627
has comment: http://stackoverflow.com/comment/67130676
downvote count: 0

http://stackoverflow.com/comment/40698265
type: AnswerComment
comment on: http://stackoverflow.com/a/25988686
type: Comment
score: 0
has text: I see, then try to look into the handlers? http://docs.oracle.com/cd/E13222_01/wls/docs103/webserv_adv/handlers.html

http://stackoverflow.com/a/25878534
answers question: http://stackoverflow.com/q/25878303
has comment: http://stackoverflow.com/comment/40499736
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40499021
has body: Depending on what your trying to achieve: You can use the TreeSet.iterator() and iterate N times. In Java 8 you can use bookSet.stream().limit(N) You can simply copy to an new ArrayList(bookSet) and then take a subList
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40499940
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25878303
has comment: http://stackoverflow.com/comment/40499398

http://stackoverflow.com/a/25991956
type: Answer
answers question: http://stackoverflow.com/q/25991705
score: 0
has body: It is possible to do it that way, but then you'll have to pass the filename into the commandline when starting the program. Like this: java [program] [filename] Another solution is hardcoding: File inputFile = new File ("filename");

http://stackoverflow.com/q/25895696
has title: Rounding a decimal in Java
duplicate of: http://stackoverflow.com/q/153724
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/40529594
has body: I created a program that calcuates the average acceleration using 3 inputs. Here's my code: Scanner input = new Scanner(System.in); System.out.print("Enter v0, V1, and t: "); double v0 = input.nextDouble(); double v1 = input.nextDouble(); double t = input.nextDouble(); double acceleration = (v1 - v0) / t; System.out.println("The average acceleration is " + acceleration); Here's the output: Enter v0, V1, and t: 5.5 50.9 4.5 The average acceleration is 10.088888888888889 Here's the expected output: Enter v0, V1, and t: 5.5 50.9 4.5 The average acceleration is 10.0889 I'm not quite sure how to trim the excess 8's in my code. I tried casting acceleration into a float and that somewhat works, but there is still too many 8s with it.
type: Question
has comment: http://stackoverflow.com/comment/40529552
tagged with: rounding
has comment: http://stackoverflow.com/comment/40530299
score: -3
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25895741
linked to: http://stackoverflow.com/q/153724
type: UnansweredQuestion

http://stackoverflow.com/comment/40542731
comment on: http://stackoverflow.com/q/25902853
has text: I try to run your code, and it goes forever?!!!!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25894110
type: Answer
has body: I can't speak about xfwm4 specifically but yes, many window managers have some form of input stealing prevention. You don't want any random application being allowed to steal your focus or force your attention away from what you are doing. How they implement this behaviour differs between window managers however. Most should (ideally) allow the currently focused application to give focus to a newly created window of that application but I imagine not all do that.
has comment: http://stackoverflow.com/comment/40552395
has comment: http://stackoverflow.com/comment/40529066
has comment: http://stackoverflow.com/comment/40529109
answers question: http://stackoverflow.com/q/25892951
has comment: http://stackoverflow.com/comment/40528965
score: 0

http://stackoverflow.com/a/44359421
upvote count: 0
has body: I encountered this same error message when trying to run a Cucumber feature file in Eclipse ("No backends were found. Please make sure you have a backend module on your CLASSPATH"). What fixed it for me was going into my pom.xml and changing the cucumber-java and cucumber-junit versions away from 1.2.5 (per their documentation) to 1.2.0. I'm not 100% sure if I'm ignoring a real issue by doing this or not. Here is more information about my setup: Windows 10 Eclipse Neon (4.6.0) Apache Maven 3.5.0 Java 1.8 I verified via quick commands that java and maven are installed successfully and running on my machine. I also verified that Maven pulled in the cucumber-java, and cucumber-core jars in my Eclipse project. Odd.
type: Answer
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/25923405

http://stackoverflow.com/comment/85725710
type: AnswerComment
comment on: http://stackoverflow.com/a/26157868
type: Comment
has text: What was unclear about my answer? Did you even read the mailing list thread?
score: 0

http://stackoverflow.com/a/25910201
upvote count: 1
has body: I think you need support library version 4 if you want to use the notification builder from the support library. Try to import android.support.v4.app.NotificationCompat; and use: NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext()) I assumed you wanted to use the support version since you were talking about the support library. Otherwise if you want to use the normal notificationbuilder, i don't see where the error is. Added this as an answer since i don't have enough rep to comment.
type: Answer
answers question: http://stackoverflow.com/q/25907626
downvote count: 0
score: 1

http://stackoverflow.com/comment/40701663
type: QuestionComment
has text: Could you provide you project structure? How is it packaged? Do you have a `BeanManger` declared?
comment on: http://stackoverflow.com/q/25982947
score: 0
type: Comment

http://stackoverflow.com/comment/40728936
has text: Whether you're using [Java Swing](http://docs.oracle.com/javase/tutorial/uiswing/) or [JavaFX](http://docs.oracle.com/javase/8/javase-clienttechnologies.htm), the placement and sizing of containers and the components you put within them falls in the domain of [layout managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html). I cannot emphasize this enough: *Do the reading* - learn how they work, and they'll be your best friend. Don't, and they'll lead you to early baldness...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26005885

http://stackoverflow.com/q/26024134
accepted answer: http://stackoverflow.com/a/26025055
has body: I have 16 JTextarea's placed on my panel (in gridlayout). I didn't use the design tools netbeans for this. The code generates them for me: for (int i = 0; i &lt; 16; i++) { JTextArea vak = maakVak(gridLayoutPanel); //make new JTextArea and add them to gridlayout. tekstvakken.add(vak); //save Jtextarea to ArrayList. } This is the method for generating a new JTextArea and adding them to the GUI. public JTextArea maakVak(JPanel p) { JTextArea vak = new JTextArea(80, 120); vak.setEditable(false); p.add(vak); return vak; //return JTextarea to save in the ArrayList } I have an ArrayList that contains objects from a class that I made for the software. The Objects contain multiple Strings. I need to "print" all the strings from one object to one JTextArea, and I do that for the first 16 objects in my ArrayList (hence I've only 16 JTextArea's). This works fine, I have 16 JTextArea's on my GUI and they contain the correct Strings. Now I want to add more functionality to my software, and I need in some way to make these JTextArea's clickable (when this event occurs, a screen should pop-up where I can change/delete the object). How is this possible (with minor changes)?
tagged with: swing
has title: How to create clickable textcontainer
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26025055
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40762728
possible better answer: http://stackoverflow.com/a/26025259
score: 0
has answer: http://stackoverflow.com/a/26025259

http://stackoverflow.com/q/25930035
favorite count: 0
has title: How do I use this set method in a loop
type: UnansweredQuestion
upvote count: 1
has body: This is a homework question so preferably I would like to write as much code as possible, just need a pointer. I have a class called Sandwich that has a Method to set a main Ingredient and a few other things - public class Sandwich { private String mainIngredient, bread; String getMainIngredient(){ return mainIngredient; } void setMainIngredient(String mainIng){ mainIngredient = mainIng; } void setBread(String dough){ bread = dough; } void setPrice(double cost){ price = cost; } Now in another class TestSandwich I've initialized an Array, as part of the question; Sandwich[] sandwiches = new Sandwich[5]; Now what I need to do is loop through and assign a value to mainIngredient and bread each time. I think I would want to do something along the lines of this but I'm not really sure how to do it correctly. for(int i = 0; i &lt; 5; i++){ System.out.println("Insert a main ingredient"); String userInput = sc.next(); sandwiches[i].setBread(userInput); System.out.println("Insert a bread"); userInput = sc.next(); sandwiches[i].setMainIngredient(userInput); System.out.println(sandwiches[i].getMainIngredient()); System.out.println(""); } The main issue is - sandwiches[i].setMainIngredient(userInput); Im not really experienced with arrays and methods such as these so any help with the correct syntax would be great. Thanks
has answer: http://stackoverflow.com/a/25930092
score: 1
has answer: http://stackoverflow.com/a/25930377
tagged with: java
has comment: http://stackoverflow.com/comment/40592254
type: Question
has comment: http://stackoverflow.com/comment/40592192
answer count: 2
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/40592303

http://stackoverflow.com/q/26005885
tagged with: width
has answer: http://stackoverflow.com/a/26005947
has comment: http://stackoverflow.com/comment/40728936
has body: Just began GUI programming a few days ago and I am wondering how I know what dimensions to give my window and the objects inside of it. I know in my head what I want them to look like but I am just not sure how to know the measurements. Any tips?
score: 0
answer count: 1
tagged with: user-interface
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40728931
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40729510
has title: How to know length and width to set?

http://stackoverflow.com/comment/40529548
type: AnswerComment
comment on: http://stackoverflow.com/a/25892425
type: Comment
has text: That's a good point. I haven't read up on the spec, so I can't tell for sure. I've reformulated my answer into something that should take it into account.
score: 0

http://stackoverflow.com/q/25918757
has comment: http://stackoverflow.com/comment/40571974
has answer: http://stackoverflow.com/a/25918851
type: AnsweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25918825
accepted answer: http://stackoverflow.com/a/25918825
has body: Can someone please explain to me why I'm getting these results? public static int ipv4ToInt(String address) { int result = 0; // iterate over each octet for(String part : address.split(Pattern.quote("."))) { // shift the previously parsed bits over by 1 byte result = result &lt;&lt; 8; System.out.printf("shift = %d\n", result); // set the low order bits to the current octet result |= Integer.parseInt(part); System.out.printf("result = %d\n", result); } return result; } For ipv4ToInt("10.35.41.134"), I get: shift = 0 result = 10 shift = 2560 result = 2595 shift = 664320 result = 664361 shift = 170076416 result = 170076550 10.35.41.134 = 170076550 This is the same result that I get when I do the math myself. For ipv4ToInt("192.168.0.1"), I get: shift = 0 result = 192 shift = 49152 result = 49320 shift = 12625920 result = 12625920 shift = -1062731776 result = -1062731775 192.168.0.1 = -1062731775 For this one, when I do the math manually, I get 3232235521. Interestingly: 3232235521 = 11000000101010000000000000000001 And when I enter 1062731775 into my Windows calc and hit the +/- button, I get: -1062731775 = 11111111111111111111111111111111 11000000101010000000000000000001 The function still works for my purposes, but I'm just really curious to know why on earth result is going negative when I do that last bit shift?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40571995
favorite count: 0
possible better answer: http://stackoverflow.com/a/25918865
upvote count: 3
has answer: http://stackoverflow.com/a/25918865
answer count: 4
has answer: http://stackoverflow.com/a/25918868
tagged with: bit-manipulation
has comment: http://stackoverflow.com/comment/40572022
has title: Bitwise op unexpectedly goes negative

http://stackoverflow.com/comment/40698440
score: 0
has text: actually with your way it brings me to: content://media/external/images/media: . So in general to the gallery. I need exactly to that picture
type: Comment
comment on: http://stackoverflow.com/a/25989125
type: AnswerComment

http://stackoverflow.com/comment/40524007
has text: True! Regex is used as input in `repeatAll` http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String), so it's not enough to escape it once, gotta be sure regex isn't going to escape it too haha. Check some useful functions such as `Matcher.quoteReplacement` http://docs.oracle.com/javase/7/docs/api/java/util/regex/Matcher.html#quoteReplacement(java.lang.String) and `Pattern.quote` http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#quote(java.lang.String)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25892386
score: 1

http://stackoverflow.com/comment/40721449
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26001933
score: 0
has text: I'm not using Eclipse i'm using NetBeans , that code is "correct" according netbeans

http://stackoverflow.com/comment/40618533
has text: @IshanBansal - The first bit is the sign bit. If it's 1 then you have a negative number. So +128 can't be represented.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25944554

http://stackoverflow.com/a/34531013
has comment: http://stackoverflow.com/comment/64123947
downvote count: 1
has comment: http://stackoverflow.com/comment/118775214
answers question: http://stackoverflow.com/q/26021141
has body: Child module [...]projectName\projectName-war\pom.xml of [...]projectName\pom.xml does not exist If you are getting the above error when using mvn install from command line (the same pom may work in eclipse) you have to change your pom.xml little Instead of the below: ../my-util ../my-server Follow the below (enclose in a profilers): ../my-util ../my-server
has comment: http://stackoverflow.com/comment/131213547
score: 38
upvote count: 39
type: Answer

http://stackoverflow.com/a/25973697
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25972394
answers question: http://stackoverflow.com/q/25972394
upvote count: 2
has body: In the tuple E, A is the set of all inter-thread actions committed by an execution of the program P.
score: 2

http://stackoverflow.com/a/26012320
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26012224
answers question: http://stackoverflow.com/q/26012224
upvote count: 1
type: AcceptedAnswer
has body: Maybe the most simple solution is to use a RayCaster. Simply choose a random direction (basically horizontally or vertically), and draw a line following it from your point. Count how many times it cross a limit : inside if odd, outside if even. Ref : Wiki

http://stackoverflow.com/comment/40599125
comment on: http://stackoverflow.com/q/25922151
score: 0
type: QuestionComment
type: Comment
has text: check parameters you are passing to `createSession()`

http://stackoverflow.com/comment/40692435
type: Comment
has text: Yes it is, but generics are a fairly large concept to wrap your head around, I recommend you start by looking at the tutorial I linked to.
comment on: http://stackoverflow.com/a/25985729
type: AnswerComment
score: 0

http://stackoverflow.com/a/26020467
type: Answer
has body: String[] chunks = test.split("\\s+"); String newtest = new String(""); for ( String chunk : chunks) { if (chunk.length() &gt; 1) { newtest+= chunk + " "; } } newtest = newtest.trim(); //to remove the last space
has comment: http://stackoverflow.com/comment/40755407
score: 0
answers question: http://stackoverflow.com/q/26020326
has comment: http://stackoverflow.com/comment/40755162
has comment: http://stackoverflow.com/comment/40755121

http://stackoverflow.com/a/25917687
has comment: http://stackoverflow.com/comment/40619185
score: 6
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40569928
has comment: http://stackoverflow.com/comment/40570321
has body: No you are not missing anything. I am not a fan either. In Scala it is a bit better because the onReceive method can be swapped out to simulate the changing state of a protocol and it uses partial functions which are a little nicer than if/elseif/else... but it is still icky. It is nicer in Erlang, which is where this model originated but that said given the limitations faced by the akka team, they made the right design choices and did an excellent job. An alternative strategy is to perform a double dispatch. So pass the command into the actor to be actions, or lookup in a map a handler for the message. Akka agents are essentially the former, and when used to their strength are quite nice. But in general a double dispatch just adds complexity, so for most cases one just has to get used to the standard approach. Which in java means either if instanceof or a switch statement. An example of double dispatch (psuedo code), included here for completeness, to aid understanding. As an approach it comes with health warnings, so I reiterate; the standard approach is standard for a reason and that one should use that 99% of the time. onReceive( msg ) { msg.doWork() } The problem with this approach is that now the message needs to know how to process itself, which is dirty; it causes tight coupling and can be fragile. Yuck. So we can go with using a lookup for handlers (command pattern stylie) val handlers = Map( "msgid1"-&gt;Handler1, "msgid2-&gt;Handler2 ) onReceive( msg ) { val h = handlers(msg.id) h.doWork( msg ) } the problem here is that now it is unclear what the commands are and following the code through involves jumping around more. But there are times that this is worth while. As pointed out by Roland, care must be taken when passing around a reference to the actor itself. The examples above do not fall foul of that problem, but it would be an easy temptation to do.
type: Answer
accepted answer of: http://stackoverflow.com/q/25917613
upvote count: 6
has comment: http://stackoverflow.com/comment/40570190
has comment: http://stackoverflow.com/comment/40616658
answers question: http://stackoverflow.com/q/25917613
has comment: http://stackoverflow.com/comment/40570538
has comment: http://stackoverflow.com/comment/40570322
downvote count: 0

http://stackoverflow.com/comment/40659657
has text: Thanks :) I got answer focused to the point and good understanding in short literature.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25967516

http://stackoverflow.com/q/26014031
has body: Im getting this error: incompatible types k0= (i==0 * 2); .........^ import java.util.Scanner; public class pers5 { public static void main(String[] args) { int k0,k1,k2,k3,k4,k5,k6,k7,k8,k9; int produkt; System.out.print("ange ett personnummer: "); String indata = new Scanner(System.in).nextLine(); for (int i=0; i&lt;10; i++){ int nummer=indata.charAt(i) -48; System.out.print(indata.charAt(i)+ " "); System.out.println(indata.charAt(i)); //this code has lots of stuff between these two but its irrelevant. k0= (i==0 * 2); k1= (i==1 * 1); k2= (i==2 * 2); k3= (i==3 * 1); k4= (i==4 * 2); k5= (i==5 * 1); k6= (i==6 * 2); k7= (i==7 * 1); k8= (i==8 * 2); k9= (i==9 * 1); produkt= k0+k1+k2+k3+k4+k5+k6+k7+k8+k9;
score: -2
has answer: http://stackoverflow.com/a/26014069
favorite count: 0
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26014075
tagged with: java
downvote count: 3
tagged with: jcreator
tagged with: types
type: UnansweredQuestion
has title: Incompatible types very simple

http://stackoverflow.com/comment/40670768
type: Comment
has text: In that case, when you copied the code to StackOverflow, something must have changed those strange control characters into ... something else. Anyway, you have solved your problem. You know that you have weird control characters in the files ... and replacing them with kosher white-space will make the errors go away.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25973451

http://stackoverflow.com/a/28406900
type: Answer
answers question: http://stackoverflow.com/q/25913710
downvote count: 0
score: 3
upvote count: 3
has body: For PyCharm 4 in Mac OS X Yosemite: Edit /Applications/[PyCharm app name]/Contents/Info.plist Find and Replace - this JVMVersion 1.6* with JVMVersion 1.8*

http://stackoverflow.com/a/25968327
answers question: http://stackoverflow.com/q/25958699
downvote count: 0
type: Answer
has body: Huge Thanks to Marco13 for pointing this out! Apparently mortennobel lib doesnot do Nearest Neighbour, instead AWT's Graphics2D can if used with RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR rendering hint. Here is the code snippet that worked for me and produced photoshop's exact image. destinationBufferedImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = destinationBufferedImage.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); g2.drawImage(sourceBufferedImage, 0, 0, newWidth, newHeight, null); g2.dispose();
upvote count: 2
score: 2

http://stackoverflow.com/comment/40665902
has text: Please add what you have tried and what leads to the exception.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25971685

http://stackoverflow.com/a/49110721
type: Answer
has body: First of all, "reading an IDoc from SAP" is not possible! (Ok, it would be possible, if you have the database user and password of the R/3 system's underlying database and then execute direct SELECT statements on the DB tables, where IDoc data is stored -- bypassing the SAP system...! But I hope, this is not what you are trying to do... :-) It would get you into deep deep trouble...) You can only "send an IDoc into SAP" (= Java side is RFC client) or "wait for SAP to send an IDoc to you" (= Java side is RFC server). In your case, as you are using the IDocServerExample, it looks like you want to wait for IDocs being sent from SAP to your server program. In that case the JCo parameters you need are explained in the JCo JavaDoc of the interface ServerDataProvider. Just take a look there, it even has some examples.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26025449

http://stackoverflow.com/comment/40779967
has text: 5 4 00001221 Java_videoDetectionJNI_VideoDetecion_getFrame0 = @ILT+ 540(Java_videoDetectionJNI_VideoDetecion_getFrame0) 6 5 00001226 Java_videoDetectionJNI_VideoDetecion_getFrame1 = @ILT+ 545(Java_videoDetectionJNI_VideoDetecion_getFrame1) 7 6 00001230 Java_videoDetectionJNI_VideoDetecion_getFrame2 = @ILT+ 555(Java_videoDetectionJNI_VideoDetecion_getFrame2)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26032713

http://stackoverflow.com/q/25885790
favorite count: 0
has answer: http://stackoverflow.com/a/25885895
has comment: http://stackoverflow.com/comment/40517170
answer count: 9
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25885874
has answer: http://stackoverflow.com/a/25886378
has answer: http://stackoverflow.com/a/25886160
tagged with: java
has answer: http://stackoverflow.com/a/25885894
upvote count: 1
has title: Need Help - Java Else/If Statement
tagged with: eclipse
downvote count: 1
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/25885902
tagged with: ide
score: 0
has answer: http://stackoverflow.com/a/25885904
has body: I am currently trying to finish up this Java programming practice project and am stuck... I am not sure what my problem is so can I get some help? Here is the code in full: package AreaElseIf; import java.io. *; import java.util. *; public class AreaElseIf { public static void main(String[] args) { final double PI = 3.14; Scanner input = new Scanner(System.in); System.out.println("This program uses an else/if statement."); System.out.println("1 = circle, 2 = square, 3 = rectangle, 4 = triangle."); int object = input.nextInt(); if (input = 1) { System.out.println("Enter circle's radius: "); double radius = input.nextDouble(); double cArea = radius * radius * PI; System.out.println("The area of a circle with the radius of " + radius + " is " + cArea + "."); } else if (input = 2) { System.out.println("Enter length of square's sides: "); double sSide = input.nextDouble(); double sArea = sSide * sSide; System.out.println("The area of a square with a side length of " + sSide + " is " + sArea + "."); } else if (input = 3) { System.out.println("Enter length of rectangle's base: "); double base = input.nextDouble(); System.out.println("Enter length of rectangle's height: "); double height = input.nextDouble(); double rArea = base * height; System.out.println("The area of a rectangle with a base length of " + base + " and a height of " + height + " is " + rArea + "."); } else if (input = 4) { System.out.println("Enter traingle's side length: "); double tSide = input.nextDouble(); double tArea = tSide * tSide * tSide; System.out.println("The area of a triangle with a side length of " + tSide + " is " + tArea + "."); } else { System.out.println("Error: Please enter a number between 1-4 only."); } }//end main }//end class The purpose of the program is to ask the user to input a number between 1 and 4, and each number is assigned to a shape. If you click on that shape's number, it asked you a couple question in order to calculate the area of said shape. And the point of this prog…
has answer: http://stackoverflow.com/a/25885850
has answer: http://stackoverflow.com/a/25885865

http://stackoverflow.com/comment/40640256
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25926860
has text: the same exception oucured
score: 0

http://stackoverflow.com/comment/40735331
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26009086
has text: Please don't use StringBuffer, it was replaced by StringBuilder ten years ago, `toString()` should never return `null`. What you are getting is `"null"` which is a string with the letters `n` `u` `l` `l` in it.
score: 0

http://stackoverflow.com/comment/40585082
score: 0
type: Comment
type: QuestionComment
has text: See similar question/answer: http://stackoverflow.com/questions/14014631/get-the-k-best-parses-of-a-sentence-with-stanford-parser
comment on: http://stackoverflow.com/q/25887246

http://stackoverflow.com/comment/40741365
type: AnswerComment
comment on: http://stackoverflow.com/a/26013020
has text: if i delete this question will you guys loose rep of the up-voting? Because i feel like this question is so stupid
type: Comment
score: 0

http://stackoverflow.com/a/25896046
has comment: http://stackoverflow.com/comment/40574272
answers question: http://stackoverflow.com/q/25875674
has comment: http://stackoverflow.com/comment/40573169
has comment: http://stackoverflow.com/comment/40590336
has body: If you use getClassloader().getResourceAsStream() it means you are trying to access a file which is available on the classpath. However, you are referring to a file which is not on the classpath. So you have to options: add the config-folder to the classpath. You can do that by adding a &lt;resource&gt; to the pom.xml, but the effect is exactly the same as having src/main/resources/config/config.properties. don't read the properties from a classpath file, but from a file on a known location. This would be my preferred solution. For this solution I'd like to refer to the other link. In your case you could add it as an argument, pick it up from the public static void main(String[]). Or read it from new File("config/config.properties"), which works because it is calculated relative to the execution root.
type: Answer
has comment: http://stackoverflow.com/comment/40591169
has comment: http://stackoverflow.com/comment/40591501
has comment: http://stackoverflow.com/comment/40602449
has comment: http://stackoverflow.com/comment/40572204
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41044045
downvote count: 0
has comment: http://stackoverflow.com/comment/40551972

http://stackoverflow.com/a/25991992
has comment: http://stackoverflow.com/comment/40715687
has comment: http://stackoverflow.com/comment/40715810
accepted answer of: http://stackoverflow.com/q/25916460
has comment: http://stackoverflow.com/comment/40716108
score: 4
upvote count: 4
type: AcceptedAnswer
has body: I ran into the same situation: The STRUCT Constructor is really slow, because Oracle queries the Database for attributes and a complete dependency chain, this is not only a separate DB-call, which slows you down, but also a query against some system-dictionaries. This is somewhat implied in the JavaDoc for the STRUCT-Constructor, because constraints and validity is tested at construction time which is only possible by a database query for the whole object-definition. The solution is to use a custom java-class and stream the values directly into the Procedure call, which will eliminate the constructor-time completely! It will look like this: public final class MyUserType implements SQLData { public String userId; public String userName; public MyUserType(){} public MyUserType( final String userId, final String userName ) { this.userId = userId; this.userName = userName; } @Override public String getSQLTypeName() throws SQLException { return "one_user_type"; } @Override public void readSQL( final SQLInput stream, final String typeName ) throws SQLException { userId = stream.readString(); userName = stream.readString(); } @Override public void writeSQL( final SQLOutput stream ) throws SQLException { stream.writeString( userId ); stream.writeString( userName ); } } Then you just use: MyUserType param = new MyUserType( "010", "Peter" ); statement.setInputParameter( 1, param );
downvote count: 0
has comment: http://stackoverflow.com/comment/40716182
type: Answer
answers question: http://stackoverflow.com/q/25916460

http://stackoverflow.com/q/25912963
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25913143
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/40560945
has comment: http://stackoverflow.com/comment/40568881
tagged with: compare
has body: The topic explains my wish pretty well i think. So what i want to reach is: madeOutOfSameLetters("aaasdf", "xyz") // false madeOutOfSameLetters("aaasdf", "asdf") // false madeOutOfSameLetters("aaasdf", "aaasdd") // false madeOutOfSameLetters("aaasdf", "fdsaaa") // true Is there a (combination of) method(s) I can use for, or do I need to do it by my own? In second case I would count each letter of both strings, write it into arrays and compare them to each other. But that seems to be more complicated than it has to be to me. Any easier ideas?
has comment: http://stackoverflow.com/comment/40561258
has comment: http://stackoverflow.com/comment/40561104
upvote count: 3
has answer: http://stackoverflow.com/a/25913055
has title: Check if a string is build out of the same letters as another string
has answer: http://stackoverflow.com/a/25913143
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40561133
possible better answer: http://stackoverflow.com/a/25913055

http://stackoverflow.com/comment/40568494
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25904162
has text: Could you elaborate on the "once in spring-security.xml" comment? I thought I was configuring the springSecurityFilterChain with the filter line in web.xml.
type: AnswerComment

http://stackoverflow.com/q/26026960
tagged with: android
has comment: http://stackoverflow.com/comment/40767824
has title: Can't run android test app on real device
has comment: http://stackoverflow.com/comment/40802559
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40768100
has comment: http://stackoverflow.com/comment/40767949
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40767268
has comment: http://stackoverflow.com/comment/40767318
has comment: http://stackoverflow.com/comment/40767780
has comment: http://stackoverflow.com/comment/40768175
has comment: http://stackoverflow.com/comment/40767368
downvote count: 1
has comment: http://stackoverflow.com/comment/40767428
favorite count: 0
has comment: http://stackoverflow.com/comment/40767470
has comment: http://stackoverflow.com/comment/40767896
has body: I am starting to learn how to make Android apps and I am very happy about that. However, everything seems to be going wrong for me. I had problems with the sdk (fixed) and with eclipse (why was it crashing?!). But now I just created my new Hello World app and when I connect my phone to the computer (ZTE Skate Acqua, Android 4.0.4, Debbugging enabled) it gives me this in the console: [2014-09-24 22:19:39 - AndroidTest] ------------------------------ [2014-09-24 22:19:39 - AndroidTest] Android Launch! [2014-09-24 22:19:39 - AndroidTest] adb is running normally. [2014-09-24 22:19:40 - AndroidTest] Performing me.pta2002.androidtest.MainActivity activity launch [2014-09-24 22:19:40 - AndroidTest] Automatic Target Mode: using device 'emulator-5554' [2014-09-24 22:19:40 - AndroidTest] Uploading AndroidTest.apk onto device 'emulator-5554' [2014-09-24 22:19:41 - AndroidTest] Installing AndroidTest.apk... [2014-09-24 22:19:42 - AndroidTest] Installation error: Unknown failure [2014-09-24 22:19:42 - AndroidTest] Please check logcat output for more details. [2014-09-24 22:19:42 - AndroidTest] Launch canceled! [2014-09-24 22:19:44 - AndroidTest] ------------------------------ [2014-09-24 22:19:44 - AndroidTest] Android Launch! [2014-09-24 22:19:44 - AndroidTest] adb is running normally. [2014-09-24 22:19:44 - AndroidTest] Performing me.pta2002.androidtest.MainActivity activity launch [2014-09-24 22:19:45 - AndroidTest] Automatic Target Mode: using device 'emulator-5554' [2014-09-24 22:19:45 - AndroidTest] Uploading AndroidTest.apk onto device 'emulator-5554' [2014-09-24 22:19:46 - AndroidTest] Installing AndroidTest.apk... [2014-09-24 22:19:47 - AndroidTest] Installation error: Unknown failure [2014-09-24 22:19:47 - AndroidTest] Please check logcat output for more details. [2014-09-24 22:19:47 - AndroidTest] Launch canceled! [2014-09-24 22:21:14 - AndroidTest] ------------------------------ [2014-09-24 22:21:14 - AndroidTest] Android Launch! [2014-09-24 22:21:14 - AndroidTest] a…
type: UnansweredQuestion

http://stackoverflow.com/comment/40651060
type: Comment
comment on: http://stackoverflow.com/a/25963194
has text: According to my question, instead of D:\\backup\\aaa.sql ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26003196
type: Answer
has comment: http://stackoverflow.com/comment/40724643
has comment: http://stackoverflow.com/comment/40724205
has comment: http://stackoverflow.com/comment/40733399
answers question: http://stackoverflow.com/q/26002075
has body: While the idea of dropping the "get" appeals to me, the problem comes when you also have a setter. You would have to do something like public String name(); // getter and public void name(String newName); // setter, xor use the below **instead** but not both public Foo name(String newName); // if you prefer fluent/builder style Which "looks weird" to a Java programmer. And until 1 minute ago I thought it was illegal, and my original post mistakenly said so until I tested it. You learn something everyday... Added in response to @DwB One good reason to use get/set is that many 3rd party frameworks expect this convention, as they use reflection to reason about your class. However, a framework could be able to look for combinations like the above, or be configured to use these methods instead of the usual get/set. This was almost in my original post but I haven't used Spring, Hibernate etc. in a few years so I'm not up to speed on what some of them will on won't allow if you aren't using get/set. For example, Jackson can use annotations and mixins to define mappings, no need to follow get/set convention. I would think that Spring, JSF etc. could do likewise, (somebody please edit this answer with details as needed) though with some extra work. Whether this extra work is worth the "conciseness" of eliminating get/set is unclear. I'd say no, but YMMV.
has comment: http://stackoverflow.com/comment/40748020
has comment: http://stackoverflow.com/comment/40725414
has comment: http://stackoverflow.com/comment/40725935
score: 0
has comment: http://stackoverflow.com/comment/40728432
has comment: http://stackoverflow.com/comment/40725977
has comment: http://stackoverflow.com/comment/40724246
has comment: http://stackoverflow.com/comment/40724937

http://stackoverflow.com/comment/40683397
has text: See edits above. echo %JAVA_HOME% outputs: `C:\Program Files(x86)\Java\jdk1.8.0_20`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25976977

http://stackoverflow.com/comment/40566398
has text: You need to break this problem down into steps. Think about how to read and write files line by line. Once you can read a file line by line and write it back out, think about how to compare it with another file. From these steps the answer to your homework assignment will work out.
comment on: http://stackoverflow.com/q/25915934
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25892369
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/40525920
downvote count: 0
has comment: http://stackoverflow.com/comment/40523204
has body: I wrote this code but I am getting error on isEmpty method saying cannot find symbol? import java.io.*; import java.util.Scanner; public class ITDLinkedStack{ public int peek() { if (isEmpty()) // this is where i get the error throw new RuntimeException("Peek attempted on empty stack"); else return top.data; } }
has answer: http://stackoverflow.com/a/25902745
accepted answer: http://stackoverflow.com/a/25902745
type: AnsweredQuestion
score: 3
tagged with: stack
tagged with: java
type: Question
has title: Why do i get an error for (top method and isempty method) saying cannot find symbol?
answer count: 1
has comment: http://stackoverflow.com/comment/40523250

checkin
tag name: checkin
type: Tag
tags question: http://stackoverflow.com/q/26005336

maven
tags question: http://stackoverflow.com/q/25990411
tags question: http://stackoverflow.com/q/25875674
tags question: http://stackoverflow.com/q/26002483
tags question: http://stackoverflow.com/q/25985182
tags question: http://stackoverflow.com/q/25904779
type: Tag
tags question: http://stackoverflow.com/q/25900245
tags question: http://stackoverflow.com/q/26031664
tags question: http://stackoverflow.com/q/26031187
tags question: http://stackoverflow.com/q/25909060
tags question: http://stackoverflow.com/q/25904809
tags question: http://stackoverflow.com/q/25989575
tags question: http://stackoverflow.com/q/25888365
tags question: http://stackoverflow.com/q/25971832
tags question: http://stackoverflow.com/q/25936424
tags question: http://stackoverflow.com/q/25991831
tags question: http://stackoverflow.com/q/25902727
tags question: http://stackoverflow.com/q/26011446
tags question: http://stackoverflow.com/q/25891610
tags question: http://stackoverflow.com/q/25884213
tags question: http://stackoverflow.com/q/25920748
tags question: http://stackoverflow.com/q/25957881
tags question: http://stackoverflow.com/q/26027475
tags question: http://stackoverflow.com/q/25875947
tags question: http://stackoverflow.com/q/25937525
tags question: http://stackoverflow.com/q/25888996
tags question: http://stackoverflow.com/q/25989843
tags question: http://stackoverflow.com/q/25887663
tags question: http://stackoverflow.com/q/25910909
tags question: http://stackoverflow.com/q/25942081
tags question: http://stackoverflow.com/q/25896081
tags question: http://stackoverflow.com/q/25893945
tags question: http://stackoverflow.com/q/25975088
tags question: http://stackoverflow.com/q/25910505
tags question: http://stackoverflow.com/q/26009248
tags question: http://stackoverflow.com/q/25958838
tags question: http://stackoverflow.com/q/25994145
tags question: http://stackoverflow.com/q/26024421
tags question: http://stackoverflow.com/q/25893312
tags question: http://stackoverflow.com/q/25912727
tags question: http://stackoverflow.com/q/25990884
tags question: http://stackoverflow.com/q/25905073
tags question: http://stackoverflow.com/q/26017742
tags question: http://stackoverflow.com/q/25963919
tags question: http://stackoverflow.com/q/25980860
tags question: http://stackoverflow.com/q/25894513
tags question: http://stackoverflow.com/q/25970207
tags question: http://stackoverflow.com/q/25913490
tags question: http://stackoverflow.com/q/26002682
tags question: http://stackoverflow.com/q/26020642
tags question: http://stackoverflow.com/q/25921723
tags question: http://stackoverflow.com/q/25964475
tags question: http://stackoverflow.com/q/25968357
tags question: http://stackoverflow.com/q/26012735
tags question: http://stackoverflow.com/q/26012661
tags question: http://stackoverflow.com/q/25876897
tags question: http://stackoverflow.com/q/25887073
tags question: http://stackoverflow.com/q/25978267
tags question: http://stackoverflow.com/q/25894393
tags question: http://stackoverflow.com/q/25950196
tags question: http://stackoverflow.com/q/25938248
tags question: http://stackoverflow.com/q/25984373
tags question: http://stackoverflow.com/q/25992986
tags question: http://stackoverflow.com/q/25947576
tags question: http://stackoverflow.com/q/25887957
tags question: http://stackoverflow.com/q/26011148
tags question: http://stackoverflow.com/q/26004168
tags question: http://stackoverflow.com/q/25911217
tags question: http://stackoverflow.com/q/25991520
tags question: http://stackoverflow.com/q/25886641
tags question: http://stackoverflow.com/q/25999717
tags question: http://stackoverflow.com/q/25910289
tags question: http://stackoverflow.com/q/25966089
tags question: http://stackoverflow.com/q/25995129
tags question: http://stackoverflow.com/q/25898900
tags question: http://stackoverflow.com/q/25887950
tags question: http://stackoverflow.com/q/25917448
tags question: http://stackoverflow.com/q/25973919
tags question: http://stackoverflow.com/q/25932578
tags question: http://stackoverflow.com/q/26027990

http://stackoverflow.com/q/25942165
upvote count: 6
has answer: http://stackoverflow.com/a/25942381
has comment: http://stackoverflow.com/comment/65897284
tagged with: jce
downvote count: 0
answer count: 1
favorite count: 0
tagged with: pkcs#7
tagged with: encryption
score: 6
has comment: http://stackoverflow.com/comment/40614759
has comment: http://stackoverflow.com/comment/40614859
tagged with: aes
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10193567
has comment: http://stackoverflow.com/comment/40614645
has comment: http://stackoverflow.com/comment/40615027
tagged with: java
has body: I have a couple of library, C#, PHP and Android where they all encrypt/decrypt a string in the same way so they are all compatible with each other, i.e. C# writes and encrypts data to a database and PHP can successfully decrypt it and return the original string. I now need to do the same thing with a standard Java application, so I've taken the code from my Android library and need libraries but I am getting an exception. As far as I know the code wasn't Android specific so it shouldn't be a problem. Below is my encryption function public static String encrypt(String plainPasword) { String password = ""; try { SecretKeySpec key = new SecretKeySpec("hcxilkqbbhczfeultgbskdmaunivmfuo".getBytes("US-ASCII"), "AES"); IvParameterSpec iv = new IvParameterSpec("ryojvlzmdalyglrj".getBytes("US-ASCII")); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); cipher.init(Cipher.ENCRYPT_MODE, key, iv); byte[] encoded = cipher.doFinal(plainPasword.getBytes()); password = new String(Base64.encodeBase64(encoded)); } catch (Exception ex) { System.err.println("Encryption Exception: " + ex.toString()); } return password; } When I call Encryption.encrypt("myString") I get the following exception: Encryption Exception: java.security.NoSuchAlgorithmException: Cannot find any provider supporting AES/CBC/PKCS7Padding As I said this code is working fine on Android and it shouldn't make any difference where it is running from. Update I found that I needed PKCS5Padding instead of 7 thanks to a link on a comment. I am now though getting the following exception: Encryption Exception: java.security.InvalidKeyException: Illegal key size
type: Question
accepted answer: http://stackoverflow.com/a/25942381
has title: AES-256 and PKCS7Padding fails in Java

http://stackoverflow.com/q/25922201
favorite count: 0
has answer: http://stackoverflow.com/a/44939485
type: UnansweredQuestion
answer count: 4
tagged with: linked-list
has comment: http://stackoverflow.com/comment/40579717
tagged with: stack
tagged with: java
score: 17
has answer: http://stackoverflow.com/a/25922420
type: Question
has answer: http://stackoverflow.com/a/25922596
has comment: http://stackoverflow.com/comment/40578784
has body: In java, you can use stack implemented by LinkedList. In other words, you can use linkedlist to achieve all functionality of stack. In this sense, why we still need stack class, why don't we just stick with linked list to keep the simplicity? Thanks
has answer: http://stackoverflow.com/a/68783385
upvote count: 19
has title: LinkedList vs Stack
downvote count: 2
has comment: http://stackoverflow.com/comment/40579665
has comment: http://stackoverflow.com/comment/40579191

http://stackoverflow.com/comment/40688129
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25982998
has text: Isn't it simply that `while(curr.next != null)` should just be `while(curr != null)`?

http://stackoverflow.com/comment/51267502
type: Comment
comment on: http://stackoverflow.com/a/25964758
has text: Sorry! It wasn't a down vote. I was doing some more work related to securing passwords and just thought the other answer was closer to my query. So i changed just the accepted answer.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25938542
score: 0
has title: How to get an Instance reference for a newly created EC2 instance in aws java sdk?
has answer: http://stackoverflow.com/a/25939590
accepted answer: http://stackoverflow.com/a/25939590
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/50522365
tagged with: java
has answer: http://stackoverflow.com/a/50522365
has body: Assume I have several running EC2 instances. Now I launch a new instance using this java code: RunInstancesRequest runInstancesRequest = new RunInstancesRequest() .withInstanceType("m1.small") .withImageId("some-ami") .withMinCount(1) .withMaxCount(1) .withKeyName("some-key") ; RunInstancesResult runInstancesResule = ec2.runInstances(runInstancesRequest); I know I can iterate the whole instance list to find a pending instance, but this seems stupid. Is there any easier way to get an Instance reference to this newly created EC2 instance?
type: Question
answer count: 2
tagged with: amazon-ec2
tagged with: amazon-web-services

http://stackoverflow.com/q/25966456
has answer: http://stackoverflow.com/a/25966714
has comment: http://stackoverflow.com/comment/40656821
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40656829
favorite count: 0
has body: if(code==1) { System.out.print("Enter product number: "); int productnumber=Integer.parseInt(a.readLine()); System.out.print("Enter product name: "); String productname=a.readLine(); System.out.print("Enter price: "); int price1=Integer.parseInt(a.readLine()); System.out.println(""); { int p=0; for(int q=1;q&lt;=1;q++) { System.out.println("1. Maintenance"); System.out.println("2. Transaction"); System.out.println(""); System.out.print("Enter Code: "); int code1=Integer.parseInt(a.readLine()); System.out.println(""); } } { int w; for(productnumber=2; productnumber&lt;=2; productnumber++) { System.out.println("Product number: "+productnumber); System.out.print("Product name: "); String prodname=a.readLine(); System.out.print("Price: "); int price2=Integer.parseInt(a.readLine()); System.out.println(""); } } } else if(code==2) { System.out.println("Display List of Product-Prices"); System.out.print("Display product number: "); int productnumber2=Integer.parseInt(a.readLine()); System.out.println("Total: "); System.out.print("Payment: "); int payment=Integer.parseInt(a.readLine()); } } //What's the problem in this code guys? There's an option which is the 1. Maintenance and 2. Transaction. If i press the number 1, it will read this following codes: int w; for(productnumber=2; productnumber&lt;=2; productnumber++) { System.out.println("Product number: "+productnumber); System.out.print("Product name: "); String prodname=a.readLine(); System.out.print("Price: "); int price2=Integer.parseInt(a.readLine()); System.out.println(""); //But if i press the number 2, it will read the same code with the number 1.. What will I do to read the statements inside the "else if(code==2)" when i press the number 2? Thankyou for those who will help me. :)
has comment: http://stackoverflow.com/comment/40657130
has comment: http://stackoverflow.com/comment/40657330
score: -3
has title: for loop inside the if and else if
type: UnansweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/40656759
type: Question
has comment: http://stackoverflow.com/comment/40658542
has comment: http://stackoverflow.com/comment/40690861
has comment: http://stackoverflow.com/comment/40694800
has comment: http://stackoverflow.com/comment/40657153

http://stackoverflow.com/q/25876064
type: AnsweredQuestion
tagged with: java-stream
upvote count: 2
has answer: http://stackoverflow.com/a/25876304
tagged with: java
type: Question
tagged with: microbenchmark
accepted answer: http://stackoverflow.com/a/25876304
score: 2
has body: While trying out the JDK 8 Streaming features, I decided to try out the parallel/serial streaming performance test. I tried to solve for the value of pi using the throwing random darts on a unit square and checking how many land up within the unit circle. I found the example for apache-spark. Here is the code. package org.sample; import java.util.concurrent.TimeUnit; import java.util.stream.IntStream; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) @Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) @Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) @Fork(1) @State(Scope.Benchmark) public class MyBenchmark { @Param({ "1000000", "10000000" }) int MAX_COUNT; @Benchmark public double parallelPiTest() { long count = IntStream.range(1, MAX_COUNT).parallel().filter(i -&gt; { double x= Math.random(); double y= Math.random(); return (x*x + y* y) &lt; 1.0 ; }).count(); double pi = 4 * count * 1.0 /MAX_COUNT; return pi; } @Benchmark public double sequentialPiTest() { long count = IntStream.range(1, MAX_COUNT).filter(i -&gt; { double x= Math.random(); double y= Math.random(); return (x*x + y* y) &lt; 1.0 ; }).count(); double pi = 4 * count * 1.0 /MAX_COUNT; return pi; } On simple testing on my 8 core machine ( windows 7 laptop),the time for parallel execution were almost 5x that of serial and CPU utilization of all the cores were almost at 100%. Serial on the other hand used roughly about 20% of one core ! As confusing the results were I tried out benchmarks using JMH ( code above) and als…
answer count: 1
downvote count: 0
favorite count: 0
has title: Java 8 Stream parallel performance and CPU resource consumption seems really poor compared to serial
tagged with: java-8
has comment: http://stackoverflow.com/comment/40495052
tagged with: parallel-processing

http://stackoverflow.com/comment/40576201
has text: @cfrick comment should be an answer.
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25920833

http://stackoverflow.com/comment/40775444
score: 0
type: Comment
has text: This has already been answered here - http://stackoverflow.com/questions/13620555/case-sensitive-file-extension-and-existence-checking
type: QuestionComment
comment on: http://stackoverflow.com/q/26031519

http://stackoverflow.com/a/26010719
answers question: http://stackoverflow.com/q/26010361
score: 0
type: Answer
has body: Clearly the error is self-explanatory. The solder module has defined an interceptor and annotated a method with '@AroundInvoke' whose signature does not comply with the specs (section 2.5 of Interceptor Specs) Lifecycle callback interceptor methods defined on an interceptor class must have one of the following signatures: void (InvocationContext) Object (InvocationContext) throws Exception

http://stackoverflow.com/comment/40634730
type: QuestionComment
has text: I would go with 'load them at start-up' unless `OutOfMemeryError` or visible app. slow down occurs.
comment on: http://stackoverflow.com/q/25954312
score: 0
type: Comment

http://stackoverflow.com/comment/73302465
has text: `createIndex` will soft-fail in fact (at least at 3.0). On subsequent calls it will return "ok", but also "note" stating that "all indexes already exist"
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25968802
type: Comment

http://stackoverflow.com/q/26018657
favorite count: 0
has answer: http://stackoverflow.com/a/39255620
has comment: http://stackoverflow.com/comment/104678297
has comment: http://stackoverflow.com/comment/40752278
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23452484
has comment: http://stackoverflow.com/comment/40753091
downvote count: 1
upvote count: 6
tagged with: java
has comment: http://stackoverflow.com/comment/40751685
has body: I am trying to get the project context path in Java web application. My project is located in D:\GED\WSysGED directory, I want to get that path. In my research, I found two ways to do this: The first uses System.getProperty like so: String path= System.getProperty("user.dir"); System.out.println(path); But that code returns D:\eclipse-jee-luna-R-win32\eclipse, where the Eclipse executable file is located. The second way is using a servlet. I created that one following this tutorial public class ContextPathServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { ServletContext servletContext = getServletContext(); String contextPath = servletContext.getRealPath("/"); PrintWriter out = response.getWriter(); out.println("&lt;br/&gt;File system context path (in TestServlet): " + contextPath); } } But it is showing C:\Users\Juan\SysGED\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\wtpwebapps\WSysGED What is the correct way to get the project path?
has comment: http://stackoverflow.com/comment/101302581
type: Question
score: 5
has comment: http://stackoverflow.com/comment/40752749
has title: Get context path in Java web application
answer count: 1

http://stackoverflow.com/comment/40598263
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25933361
has text: @madhawapriyashantha no i have provided the correct password in pass.. its not blank
score: 0

http://stackoverflow.com/q/26005684
tagged with: https
type: Question
has title: Determining which certificate to use in two way ssl
has answer: http://stackoverflow.com/a/26006530
tagged with: ssl
accepted answer: http://stackoverflow.com/a/26006436
score: 0
answer count: 2
tagged with: tomcat
has answer: http://stackoverflow.com/a/26006436
type: AnsweredQuestion
has body: I'm having an issue sending our certificate (client) to another server during a web service call. We're expected to return the certificate with the CN: b2b-test however whenever we receive the servers certificate and attempt to send our own, we're getting: Unable to find valid certificate path to requested target From my understanding, if I put our certificate b2b-test inside of our keystore jre/lib/security/cacerts, then when receiving the server request, it should send the appropriate certificate. How does the client know which key from the keystore it should send to the server? Should I be specifying the exact certificate to send during my request, or is it enough for it to be in the keystore? Currently the server is sending back the certificate b2b-a The certificate chain shows: *** Certificate chain chain [0] = [ [ Version: V3 Subject: CN=b2b-a, OU=Web Technologies The URL for the service is: https://b2b-a/service If I configure it like one way ssl, and put the servers certificate into our cacerts, then it picks up their cert and fails the handshake (I'm assuming because it's expecting our cert and not theirs back due to it being a two way setup). I'm a little stumped here. Any clarification on what I've said is greatly appreciated.
tagged with: java
possible better answer: http://stackoverflow.com/a/26006530

http://stackoverflow.com/comment/40652222
type: Comment
has text: thanks! I found that finish() is the right way to fully shutdown the first activity. I will implement it and see if it is working. It was helpful. :)
comment on: http://stackoverflow.com/a/25963888
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40769825
type: QuestionComment
has text: Look at `moString.equals(moInt)`, this equates to `String.equals(int)`, which will never be `true`...
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26028356

http://stackoverflow.com/comment/40615023
type: QuestionComment
has text: You will probably find byt & 0xFF is an integer; you might try byt & ((byte)0xFF) or add another (byte) in front of it. It should not cause this error though
comment on: http://stackoverflow.com/q/25942010
score: 0
type: Comment

http://stackoverflow.com/comment/40620822
type: QuestionComment
has text: i think your bs contains `string` value not a `integer` that's why this error. make sure `setting[postion]` is an `integer` value. i mean like "somevalue".
score: 0
comment on: http://stackoverflow.com/q/25946263
type: Comment

http://stackoverflow.com/q/25951124
tagged with: modelmapper
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40628246
has comment: http://stackoverflow.com/comment/40646703
has comment: http://stackoverflow.com/comment/40640793
has comment: http://stackoverflow.com/comment/40628179
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has title: ModelMapper: how to map this json to Java?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40681368
has body: I am attempting to use ModelMapper to map the following json as explained here http://modelmapper.org/user-manual/gson-integration/ but I am getting a NullPointerException and I can't figure what is wrong. Any tips please? {"a": "aaa", "b": [{"c": "ccc"}]} public class Foo { private String a; private ArrayList&lt;Bar&gt; b; } public class Bar { private String c; } ModelMapper mapper = new ModelMapper(); mapper.getConfiguration().addValueReader(new JsonElementValueReader()); JsonElement responseElement = new JsonParser().parse(json); Foo foo = mapper.map(responseElement, Foo.class);
has answer: http://stackoverflow.com/a/25951333
accepted answer: http://stackoverflow.com/a/25951333
has comment: http://stackoverflow.com/comment/40662294

http://stackoverflow.com/a/26037522
score: 2
accepted answer of: http://stackoverflow.com/q/26033737
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has body: According to your grammar, I'm going to assume that your input uses ASCII characters. If you store the file on disk as UTF-8, then simply loading the file into the ANTLRInputStream, which uses UTF-16, will consume 220MB. In addition to that you'll have overhead of approximately 48 bytes per CommonToken (last I checked), along with overhead from the DFA cache and the ParserRuleContext instances. The only way to get an accurate picture of the memory used by a Java application is through a profiler, and in 64-bit mode not all profilers properly account for Compressed OOP object storage (YourKit does though). The first thing to try is simply increasing the allowed heap size. Once you know the specific data structure(s) using the memory, you can target that area for reduction.
type: Answer
answers question: http://stackoverflow.com/q/26033737
has comment: http://stackoverflow.com/comment/40792752

http://stackoverflow.com/a/25967527
has comment: http://stackoverflow.com/comment/40659448
answers question: http://stackoverflow.com/q/25967481
downvote count: 0
has comment: http://stackoverflow.com/comment/40659713
has comment: http://stackoverflow.com/comment/40659342
has comment: http://stackoverflow.com/comment/40659593
has comment: http://stackoverflow.com/comment/40659682
type: Answer
has body: The question is, why should it (resize)? You've only told the Graphics context that it should draw the image at the top left corner of the component (0x0). You should have a look at Graphics#drawImage(Image, int, int, int, int, ImageObserver) and Graphics2D#drawImage(Image, AffineTransform, ImageObserver) You should also have a look at: Java: maintaining aspect ratio of JPanel background image Quality of Image after resize very low -- Java The Perils of Image.getScaledInstance() For discussions over different approaches to scaling images You're also breaking the paint chain, which is causing the "wall of white". You should be calling super.paintComponent before performing any custom painting. When overriding a container like JPanel or JComponent for the purpose of custom painting, you should also consider overriding the getPreferredSize method, this will provide the means for layout managers to size the component to an appropriate default size instead of using 0x0 which is normally the default size.
upvote count: 3
score: 3

http://stackoverflow.com/q/26028367
score: 2
has comment: http://stackoverflow.com/comment/40769876
has answer: http://stackoverflow.com/a/26028669
upvote count: 2
has title: Java projects forcing dependents to adopt Java versions?
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26028409
type: Question
tagged with: compatibility
answer count: 2
downvote count: 0
favorite count: 0
tagged with: javac
has body: Here's a question. Suppose I have a Maven project ("A") that pulls in a different Maven project ("B") as a dependency. Both currently use Java 7 to compile. If Project B switches to Java 8, does it force Project A to use Java 8 as well? If so, is there a way around it - that is, have Project B generate code that Project A can use, without downgrading Project B to Java 7 or upgrading Project A to Java 8? For example, having Project B do some form of "source 1.8 target 1.7", for example. (javac doesn't seem to like that, and I can't find an alternative compiler that will - for example, plexus-compiler-eclipse doesn't support Java 8, but that's another issue altogether; the issue is that of decoupling the generated bytecode from the source version that was used to generate it)
tagged with: maven-compiler-plugin
tagged with: maven

http://stackoverflow.com/a/25927879
has comment: http://stackoverflow.com/comment/40605165
has comment: http://stackoverflow.com/comment/40653919
has comment: http://stackoverflow.com/comment/40589564
has comment: http://stackoverflow.com/comment/40671381
has body: Try insert into pair tags. or try this one on ur jsp file like this: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%--Contents--%>
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25927827
has comment: http://stackoverflow.com/comment/40589769
score: 0
has comment: http://stackoverflow.com/comment/40730706

http://stackoverflow.com/q/26000144
type: Question
score: 0
has answer: http://stackoverflow.com/a/26000343
has comment: http://stackoverflow.com/comment/40718234
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/26000343
answer count: 4
has comment: http://stackoverflow.com/comment/40718402
has title: How to split ArrayList into another List
has answer: http://stackoverflow.com/a/26000402
accepted answer: http://stackoverflow.com/a/26000402
has answer: http://stackoverflow.com/a/26000480
has body: I'm trying to split an ArrayList into separate blocks. I have a function that returns table data collected in jsoupie, just as individual elements. I wonder how to make a second list, so that it consisted of every 5 subsequent elements of the first list. example: 1 list: lista1.get (0) = Monday; lista1.get (1) = Tuesday; ... lista1.get (6) = Sunday; and here I would like to make it //lista1.get(1) .. lista1.get(6) lista2.get (0) = Monday, Tuesday, Wednesday, Thursday, Friday; lista2.get (1) = any, other data contained in, this, leaves, stated below; Thanks
has comment: http://stackoverflow.com/comment/40718217
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26000347

http://stackoverflow.com/q/26019605
has comment: http://stackoverflow.com/comment/40753321
type: Question
has answer: http://stackoverflow.com/a/26019710
accepted answer: http://stackoverflow.com/a/26019710
has comment: http://stackoverflow.com/comment/40753567
score: 0
answer count: 2
has title: Amerpsand format flag in java
possible better answer: http://stackoverflow.com/a/26019711
has comment: http://stackoverflow.com/comment/40753460
has answer: http://stackoverflow.com/a/26019711
type: AnsweredQuestion
has body: I have existing java code that is used to format a string. This code fails for the below format - java.util.FormatFlagsConversionMismatchException:..Based on other SO issues, I see its more related to Java version thats used. Question.. What does the '%1$#' format does..Mostly Im not able to find the '$' &amp; '#' format rules while I googled. How to fix this issue? Java code String test = String.format("%1$#" + 2 + "s", 01);
tagged with: java

http://stackoverflow.com/q/25877199
tagged with: java
tagged with: warnings
has answer: http://stackoverflow.com/a/25877338
has title: Scanner Class InputMismatchException and Warnings
accepted answer: http://stackoverflow.com/a/25877338
answer count: 1
score: 0
has body: I am having trouble running this program. The program takes an expression such as "A = 7" and puts the variable A (String) and the number 7 in a Map container. I'm not if i'm not parsing the string correctly which is causing the error or for some other reason. Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:909) at java.util.Scanner.next(Scanner.java:1530) at java.util.Scanner.nextInt(Scanner.java:2160) at java.util.Scanner.nextInt(Scanner.java:2119) at Commander.main(Commander.java:21) Furthermore, I get the following warning message which is actually a first Note: Commander.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. The CODE import java.util.Scanner; import java.util.Map; import java.util.HashMap; public class Commander { public static void main(String[] args) { Map&lt;String,Integer&gt; expression = new HashMap(); Scanner sc = new Scanner(System.in); String Variable , assignmentOperator; int Value; while(sc.hasNextLine()) { Variable = sc.nextLine(); assignmentOperator = sc.nextLine(); Value = Integer.parseInt(sc.nextInt()); expression.put(Variable,Value); for(String key: expression.keySet()) System.out.println(key + " - " + expression.get(key)); } } }
tagged with: exception
type: AnsweredQuestion
tagged with: java.util.scanner
tagged with: string-parsing
type: Question

http://stackoverflow.com/q/25929395
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40596887
accepted answer: http://stackoverflow.com/a/25932903
downvote count: 0
has title: CDI Cross container injection
tagged with: cdi
has comment: http://stackoverflow.com/comment/40592125
answer count: 1
has body: We have trouble finding the correct way of injecting a SessionBean from another container. Lets say we have two ear-files earA and earB and an shared jar: earA @Stateless public class MyBean implements BeanInterface{...} earB @Stateless public class OtherBean{ @Inject BeanInterface myBean; } apiJar A jarfile containing BeanInterface is present in both earA and earB We don't want to explicitly use the JNDI name via @EJB, because earB will be implemented and deployed by an external customer. We want to make as easy as possible (and with as little knowledge of earA as possible) for earB to inject MyBean through the BeanInterface.
tagged with: jboss7.x
favorite count: 0
has comment: http://stackoverflow.com/comment/40596370
upvote count: 1
has answer: http://stackoverflow.com/a/25932903
tagged with: ejb-3.1
type: AnsweredQuestion

http://stackoverflow.com/a/25938965
has comment: http://stackoverflow.com/comment/40610428
score: 0
answers question: http://stackoverflow.com/q/25938092
type: Answer
has body: Following http://jena.apache.org/documentation/ontology/ OntModel m = ModelFactory.createOntologyModel(); m.read(&lt;your ontology file&gt;); // or for each class OntClass clazz = m.createClass( NS + "MyClass" ); // Then, your individuals Individual ind0 = m.createIndividual( NS + "ind0", clazz );
has comment: http://stackoverflow.com/comment/40614030

http://stackoverflow.com/q/26006804
has comment: http://stackoverflow.com/comment/40730565
answer count: 1
has body: I have a 2d arrays centroids which each of its elements is an array itself. How can I check to see if say centroids[1][1] list contains any element? I thought this code would work but it is not. for (int j=0; j&lt;centroids[clusterAssignment[i]].length;j++) if(centroids[clusterAssignment[i]].length==0) firstly because centroids[clusterAssignment[i]].length doesn't give me the correct list of number of centroids and just tell me that it is 2 because centroids have dimension x and y (2d). Secondly because I don't know how to check if the clusterAssignment[i] which is an array has a length of zero or not for centroids i in the list of all the available centroids. UPDATE: This code doesn't work: for (int i = 0; i &lt; centroids.length; i++){ //System.out.println("centroids[clusterAssignment[i]] "+ Arrays.toString(centroids[clusterAssignment[i]])); //System.out.println("clusterassignment of centroid is"+centroids[clusterAssignment[i]]); for (int j=0; j&lt;centroids[clusterAssignment[i]].length;j++) // System.out.println("cluster assignment of centroid is: "+Arrays.toString(centroids[clusterAssignment[i]])); if (centroids[clusterAssignment[i]] == null){ //save the centroid number if there's no point assigned to it orphanCentroid = i; System.out.println("orphan centroid i is "+i); hasOrphanCentroid=true; break; } }
tagged with: iteration
tagged with: multidimensional-array
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40730410
has answer: http://stackoverflow.com/a/26006866
has comment: http://stackoverflow.com/comment/40730923
tagged with: java
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/40730649
has comment: http://stackoverflow.com/comment/40730497
has comment: http://stackoverflow.com/comment/40730667
score: 0
has title: How can I check to see if elements of a 2D array are null in java?

http://stackoverflow.com/comment/40541797
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25902347
has text: Yes this is the obvious way and the way I *would* do it. But I'm technically not supposed to know what an array is until chapter 6. (We're on chapter 4 right now). This is week 4 of an intro Java class. The only reason I personally know about arrays is past classes in Visual Basic. I'll probably just turn it in like this and my professor can suck it up.
type: AnswerComment

http://stackoverflow.com/comment/40601808
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25935308
has text: I have used http://sourceforge.net/projects/jdatepicker/ and they have discontinued its development even the site domain is also expired. I used many other datepicker but this one is great just need to change font size the rest is just awesome.

http://stackoverflow.com/q/25944876
downvote count: 0
has comment: http://stackoverflow.com/comment/40672576
has comment: http://stackoverflow.com/comment/40618965
favorite count: 0
has comment: http://stackoverflow.com/comment/40632239
has comment: http://stackoverflow.com/comment/40623031
upvote count: 2
type: UnansweredQuestion
has title: Eclipse will not Work?
score: 2
has answer: http://stackoverflow.com/a/25944933
has comment: http://stackoverflow.com/comment/40620449
tagged with: java
has comment: http://stackoverflow.com/comment/40618998
type: Question
has body: I have two different versions of eclipse that both quit working on me, I am using windows 7 home premium, the versions of eclipse that I have are Eclipse Luna 4.4 and Eclipse Juno. I have done the following things to correct the error but I am not getting a crash report or anything. In the following order I have tried: Restarting my computer, Deleting eclipse and reinstalling, From command running Eclipse.exe -clean Eclipse.exe -clean -clearPersistedState Eclipse.exe -debug I have also checked my JAVA_HOME environment variable which is properly set, and the PATH environment Variable which is also properly set. Still not sure what is going on. :::EDIT::: Ok I did Find a report on my windows compatibility checker saying that the application is incompatible with windows and the repair the issue section failed to repair it. I do know that two days ago I was working in the eclipse environment without a problem. When I got home yesterday my machine showed that there had been new updates installed. I didn't have any issues until yesterday. So I guess my next question is how do I find what made the application incompatible with my machine, and if it was the updates how do I reverse them so that I can get my IDE back, I could switch to Netbeans But I prefer to not have to do so It just doesn't make any sense to do so if I could somehow manage to get eclipse working again. all give me the same result, a quick flicker of what I imagine is the Eclipse splash screen and that is it, so my question is where might I find a crash or debug report (if one is generated by eclipse) other wise does any on have any idea what may be happening.
tagged with: eclipse
tagged with: development-environment
answer count: 1

http://stackoverflow.com/comment/40689134
type: Comment
score: 0
has text: The link: [https://forum.hibernate.org/viewtopic.php?f=1&t=935715](https://forum.hibernate.org/viewtopic.php?f=1&t=935715)
comment on: http://stackoverflow.com/q/25964864
type: QuestionComment

http://stackoverflow.com/a/25881944
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/25881588
accepted answer of: http://stackoverflow.com/q/25881588
has comment: http://stackoverflow.com/comment/40507029
has comment: http://stackoverflow.com/comment/40547427
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40548244
upvote count: 3
has body: It happen for many reason like The database configuration details you have entered are incorrect or have changed, e.g. the database name or database username/password for your Confluence database. 1)The URL for the database is incorrect. 2)The database server is not running. If your database server is down, restart it and check the logs to see why it had failed or stopped. 3)The network is down (or there is a firewall in between confluence and the database server which is interfering) and the connection to the database cannot be established. 4)Your database password has expired. 5)Check your driver,if its present or not in your class-path.
has comment: http://stackoverflow.com/comment/40506843
type: Answer
has comment: http://stackoverflow.com/comment/40551130
has comment: http://stackoverflow.com/comment/40505002

http://stackoverflow.com/q/26013769
has title: How to map bean property for one to many in Hibernate
possible better answer: http://stackoverflow.com/a/26013913
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26013958
type: Question
has body: I have two tables vehicleregister and groupdetails for that I have beans as VehicleRegisterBean and GroupDetails common field is groupid. Here 1 group can contains many vehicles for that I am performing OnetoMany relation for that I have defined bean as, VehicleRegiserBean , @Entity @Table(name = "vehicle_register") public class VehicleRegisterBean { // somefields @ManyToOne @JoinColumn(name="groupid", nullable=false) private GroupDetails groupDetails; //getter setters } and GroupDetails, @Entity @Table(name = "group_details") public class GroupDetails { //some fields @OneToMany(mappedBy="GroupDetails") private Set&lt;VehicleRegisterBean&gt; vehicleRegisterBean; //getters setters } but I am getting exception as, org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.abc.its.beans.VehicleRegisterBean.GroupDetails in com.abc.its.beans.GroupDetails.vehicleRegisterBean at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:685) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:645) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:65) at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1716) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1423) can anyone help me to solve this.
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26013958
has answer: http://stackoverflow.com/a/26013913
score: 0
answer count: 2
tagged with: jpa

http://stackoverflow.com/a/25985729
has comment: http://stackoverflow.com/comment/40692267
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/25985679
upvote count: 3
answers question: http://stackoverflow.com/q/25985679
has comment: http://stackoverflow.com/comment/40692435
type: AcceptedAnswer
downvote count: 0
has body: When you do Map.Entry me = (Map.Entry)i.next(); you're creating an untyped instance of Map.Entry, which is like doing Map.Entry&lt;Object, Object&gt; me = ... Then, when you try to do Iterator&lt;Student&gt; it = (me.getValue()).iterator(); this is the equivalent of trying to do ArrayList&lt;Object&gt; objects; Strudent s = objects.get(0); which, obviously, you cannot do. Instead, you need to instantiate your Map.Entry object with the appropriate type: Map.Entry&lt;YourKeyType, ArrayList&lt;Student&gt;&gt; me = (Map.Entry&lt;YourKeyType, ArrayList&lt;Student&gt;&gt;) i.next(); Note that you can avoid the cast there, and take full advantage of generic type safety, by making your iterator an Iterator&lt;YourKeyType, ArrayList&lt;Student&gt;&gt; rather than declaring it as a raw type.
has comment: http://stackoverflow.com/comment/40692708

http://stackoverflow.com/comment/40602005
type: AnswerComment
type: Comment
has text: @Barranka In what way does it not answer the question? The question asked if his statements were correct. They are. That answers the question.
comment on: http://stackoverflow.com/a/25921451
score: 1

http://stackoverflow.com/q/25959089
has answer: http://stackoverflow.com/a/25959287
score: 0
has comment: http://stackoverflow.com/comment/40642936
has comment: http://stackoverflow.com/comment/40643031
accepted answer: http://stackoverflow.com/a/25959287
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40642980
has title: socket not writing to server
tagged with: java
has comment: http://stackoverflow.com/comment/40642891
has comment: http://stackoverflow.com/comment/40653412
has body: There are question with the same problem but they are not helping me out. Below is the code I've been working on where the ServerSocket not receiving any message from client Socket. Server package rescue_server; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.TreeMap; /** * * @author Mohammad Faisal */ public class RServer { private TreeMap&lt;String, PrintWriter&gt; clients; private static final int PORT = 6621; private class ClientHandler implements Runnable { private PrintWriter writer; private BufferedReader reader; public ClientHandler(Socket client) { try { writer = new PrintWriter(client.getOutputStream()); reader = new BufferedReader(new InputStreamReader(client.getInputStream())); } catch (IOException ex) { System.out.println(ex.getMessage()); } } @Override public void run() { System.out.println("client handler thread started"); String msg; try { while ((msg = reader.readLine()) != null) { System.out.println(msg); } } catch (IOException ex) { System.out.println(ex.getMessage()); } } } public RServer() { clients = new TreeMap&lt;&gt;(); } public void start() { try { ServerSocket server = new ServerSocket(RServer.PORT); while (true) { System.out.println("waiting...."); Socket client = server.accept(); Thread tclient = new Thread(new ClientHandler(client)); tclient.setDaemon(true); tclient.start(); System.out.println("got a connection."); } } catch (IOException ex) { System.out.println(ex.getMessage()); } } public static void main(String[] args) { new RServer().start(); } } Client package rescue_client; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; /** * * @author M…
has comment: http://stackoverflow.com/comment/40654812
answer count: 1
linked to: http://stackoverflow.com/q/19561941
has comment: http://stackoverflow.com/comment/40643731
tagged with: sockets
has comment: http://stackoverflow.com/comment/40643013

http://stackoverflow.com/comment/40687879
type: AnswerComment
comment on: http://stackoverflow.com/a/25981179
score: 0
type: Comment
has text: The code is posted above. Sorry I could not post the code here again as it exceeds the word limit. After the above code I am calling the function Array=createFrequencyTable(Line);

http://stackoverflow.com/q/25911946
upvote count: 1
score: 1
tagged with: java
type: Question
has title: Unable to set Window State to Exclusive in Struts2 Liferay Portlet
tagged with: liferay
has body: Overview: Porting a struts2 web-appp to liferay struts2 6.2 portlet Issue: Unable to set windowState to be "Exclusive" in the the struts2 tag <s:url ..../> Description:I need to set windowState to be "Exclusive" in the the struts2 tag <s:url ..../>. I am trying the below option but not able to set url's window state as exclusive. <s:url var="billingOverview" action="%{billingOverviewURL}" portletMode="view" portletUrlType="struts.portlet.action" windowState=<%=LiferayWindowState.EXCLUSIVE.toString()%> /> Initially I got the exception: "according to tld or attribute windowState, does not accept any expressions".I modified the struts2 core jar(struts2-core-2.3.7.jar)'s "struts-tags.tld" file , in which I made the below changes to accept the expressions as well in the windowState tag by changing rtexprvalue as TRUE: The resulting portlet window state windowState false true It would be really great if I can get some pointer on above issue. Thanks in Advance!
tagged with: struts2
tagged with: portlet
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25912460
type: UnansweredQuestion

http://stackoverflow.com/q/25916887
score: 1
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40569466
possible better answer: http://stackoverflow.com/a/25916999
has comment: http://stackoverflow.com/comment/40568545
upvote count: 1
tagged with: function
has answer: http://stackoverflow.com/a/25916962
has title: Run functions simultaneously in Java (Eclipse)
has body: I am new to Eclipse and Java and I have researched this a fair amount, but most answers and examples (SO included) assume you have a basic understanding of where you are heading, so please explain simply (I am sure it must be simple). I have a function such as this, which runs successfully in eclipse. However I need to be able to call this function twice and for them to run simultaneously, opposed to one after the other. public static void reporting(String category, String message) { // Code for this function } public static void main(String[] args) { // Call the function once reporting("one","Starting"); // Call the function a second time reporting("two","Starting"); } So currently instance 1 is running, then the second instance executes after the first completes. I need the first to start executing and then for the second to start straight away after. My only vague idea to this so far is this: public static void main(String[] args) { // Call the function once async reporting("one","Starting"); // Call the function a second time async reporting("two","Starting"); } However this just throws errors about async not being a variable so clearly it isn't right. As far as I can gather this is possible using async somehow - but as I say everywhere I look (SO answers included) assume you have an idea of where this should fit. (Ps, I am fully away that I maybe to totally wrong about async or there maybe a more efficient way altogether, but anything to help me learn in the right direction is beneficial)
has answer: http://stackoverflow.com/a/25916999
has comment: http://stackoverflow.com/comment/40568320
answer count: 3
has answer: http://stackoverflow.com/a/25917000
accepted answer: http://stackoverflow.com/a/25917000
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/40568940
favorite count: 0
downvote count: 0
type: AnsweredQuestion

http://stackoverflow.com/a/25918422
type: Answer
has body: Overriding shoud be the answer for my crazy question
answers question: http://stackoverflow.com/q/25918067
score: 0

http://stackoverflow.com/a/25972875
has body: The core Java classes don't have debug symbols/parameter metadata, so Spring can't determine the name of the constructor arguments. In that case, you have to use the index attribute with value 0 for the first constructor-arg, like this: &lt;constructor-arg index="0" value="10"/&gt;
type: Answer
accepted answer of: http://stackoverflow.com/q/25972255
upvote count: 2
answers question: http://stackoverflow.com/q/25972255
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40584969
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25925917
has text: are you using a proxy server?
type: Comment

http://stackoverflow.com/comment/40618447
has text: Oh ok! Override, overrides the method of the super class and overload overloads the methods data type? Thanks again, I really appreciate your help!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25944423

http://stackoverflow.com/q/25936153
has comment: http://stackoverflow.com/comment/40603036
has answer: http://stackoverflow.com/a/59975405
tagged with: android
possible better answer: http://stackoverflow.com/a/66541390
answer count: 7
accepted answer: http://stackoverflow.com/a/25946884
has comment: http://stackoverflow.com/comment/40604385
has answer: http://stackoverflow.com/a/30109543
has comment: http://stackoverflow.com/comment/40605163
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/25946884
type: AnsweredQuestion
has title: Validate routing number
tagged with: java
has answer: http://stackoverflow.com/a/66541390
downvote count: 3
score: -1
has comment: http://stackoverflow.com/comment/40604242
has answer: http://stackoverflow.com/a/47493056
has comment: http://stackoverflow.com/comment/40603201
favorite count: 0
has answer: http://stackoverflow.com/a/30109508
has answer: http://stackoverflow.com/a/47850677
has body: How to validate bank routing number in java ? can any one help me out. for example void boolean validate(String str){ // some code return true; //if valid otherwise return false }

http://stackoverflow.com/q/25916476
accepted answer: http://stackoverflow.com/a/37919432
tagged with: java.util.scanner
has title: how to make scanner object as static
has answer: http://stackoverflow.com/a/25916581
answer count: 3
downvote count: 1
tagged with: object
possible better answer: http://stackoverflow.com/a/25916581
tagged with: java
has body: how can i refer to Scanner object which is defined globally from a static method(say main() ).. That is, how to make Scanner object as static. Program (# for reference to my problem) : import java.util.Scanner; class spidy { Scanner input = new Scanner(System.in); /*DECLARING SCANNER OBJECT OUTSIDE MAIN METHOD i.e Static method */ public static void main(String args[]) { System.out.println("Enter a number"); int n = input.nextInt(); } } Error: non static variable input cannot be referenced from the static content
tagged with: global-variables
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30860296
favorite count: 0
has comment: http://stackoverflow.com/comment/40567399
tagged with: static
type: Question
has answer: http://stackoverflow.com/a/37919432
score: 5
upvote count: 6
has comment: http://stackoverflow.com/comment/40567774

http://stackoverflow.com/comment/40770241
type: AnswerComment
type: Comment
has text: @Deduplicator Can you explain a bit more about the empty() method? I still don't really understand how it works. Thanks
comment on: http://stackoverflow.com/a/26016072
score: 0

http://stackoverflow.com/q/26024821
has body: Is it possible to have Eclipse only indent new lines when you start typing code? For example, hitting enter brings the text cursor back to the left-hand margin, but starting to type on that line would tab it to the appropriate indentation? I currently strip trailing whitespace on save, but that's not really the behavior I want.
has comment: http://stackoverflow.com/comment/40763455
answer count: 1
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40763195
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26025425
has title: Eclipse - Only Auto-Indent On Typing
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40769169
type: Question
has comment: http://stackoverflow.com/comment/40763397
accepted answer: http://stackoverflow.com/a/26025425
has comment: http://stackoverflow.com/comment/40763326
downvote count: 0
has comment: http://stackoverflow.com/comment/40763283

swing
tags question: http://stackoverflow.com/q/25874459
tags question: http://stackoverflow.com/q/25976055
tags question: http://stackoverflow.com/q/25908921
tags question: http://stackoverflow.com/q/25883532
tags question: http://stackoverflow.com/q/25981409
tags question: http://stackoverflow.com/q/25906979
tags question: http://stackoverflow.com/q/25937819
tags question: http://stackoverflow.com/q/25918569
tags question: http://stackoverflow.com/q/25971152
tags question: http://stackoverflow.com/q/26012709
tags question: http://stackoverflow.com/q/25939446
tags question: http://stackoverflow.com/q/25925945
tags question: http://stackoverflow.com/q/25995126
tags question: http://stackoverflow.com/q/25921445
tags question: http://stackoverflow.com/q/25996956
tags question: http://stackoverflow.com/q/25934749
tags question: http://stackoverflow.com/q/25993145
tags question: http://stackoverflow.com/q/26033330
tags question: http://stackoverflow.com/q/25945061
tags question: http://stackoverflow.com/q/25955951
tags question: http://stackoverflow.com/q/25945630
tags question: http://stackoverflow.com/q/25952730
tags question: http://stackoverflow.com/q/26011768
tags question: http://stackoverflow.com/q/25931665
tags question: http://stackoverflow.com/q/26008008
tags question: http://stackoverflow.com/q/25927426
tags question: http://stackoverflow.com/q/25922067
tags question: http://stackoverflow.com/q/25992718
tags question: http://stackoverflow.com/q/25880133
tags question: http://stackoverflow.com/q/25923060
tags question: http://stackoverflow.com/q/26002948
tags question: http://stackoverflow.com/q/26031383
tags question: http://stackoverflow.com/q/25950467
tags question: http://stackoverflow.com/q/25882978
tags question: http://stackoverflow.com/q/25949055
tags question: http://stackoverflow.com/q/25905406
tags question: http://stackoverflow.com/q/25982306
tags question: http://stackoverflow.com/q/25985711
tags question: http://stackoverflow.com/q/25963481
tags question: http://stackoverflow.com/q/25959860
tags question: http://stackoverflow.com/q/25910712
tags question: http://stackoverflow.com/q/25966504
tags question: http://stackoverflow.com/q/25906337
tags question: http://stackoverflow.com/q/25910918
tags question: http://stackoverflow.com/q/25946557
tags question: http://stackoverflow.com/q/25907061
tags question: http://stackoverflow.com/q/25985037
tags question: http://stackoverflow.com/q/25928338
tags question: http://stackoverflow.com/q/25987739
tags question: http://stackoverflow.com/q/26020724
tags question: http://stackoverflow.com/q/25948659
tags question: http://stackoverflow.com/q/25933331
tags question: http://stackoverflow.com/q/25941625
tags question: http://stackoverflow.com/q/25962789
tags question: http://stackoverflow.com/q/25908905
tags question: http://stackoverflow.com/q/26024134
tags question: http://stackoverflow.com/q/26005758
tags question: http://stackoverflow.com/q/25946545
tags question: http://stackoverflow.com/q/26004365
tags question: http://stackoverflow.com/q/25885959
tags question: http://stackoverflow.com/q/26021258
tags question: http://stackoverflow.com/q/25878906
tags question: http://stackoverflow.com/q/25897037
tags question: http://stackoverflow.com/q/25991531
tags question: http://stackoverflow.com/q/26003874
tags question: http://stackoverflow.com/q/25909104
tags question: http://stackoverflow.com/q/25930766
tags question: http://stackoverflow.com/q/25895498
tags question: http://stackoverflow.com/q/25995054
tags question: http://stackoverflow.com/q/25906207
tags question: http://stackoverflow.com/q/25992709
type: Tag
tags question: http://stackoverflow.com/q/25901842
tags question: http://stackoverflow.com/q/25906061
tags question: http://stackoverflow.com/q/25922336
tags question: http://stackoverflow.com/q/25943556
tags question: http://stackoverflow.com/q/25922360
tags question: http://stackoverflow.com/q/25959139
tags question: http://stackoverflow.com/q/25936239
tags question: http://stackoverflow.com/q/25957543

http://stackoverflow.com/comment/40518068
score: 1
comment on: http://stackoverflow.com/q/25889630
type: Comment
type: QuestionComment
has text: Will there always be a `_` in front of the last number?

http://stackoverflow.com/a/25972761
score: 0
has body: There is nothing to print in your list. You need to change for (String x : l1) // l1 don't have a single element // at this moment and for (String y : l2) // same as l1 To for (String x : boy) and for (String x : girl) Again l2.add(y); l1.addAll(l2); l2 = null; // inside for lopp l2 become null So you will get NPE from here. Corrected code public static void main(String[] args) { String[] boy = {"John", "Russel", "Ryan"}; List&lt;String&gt; l1 = new LinkedList&lt;&gt;(); for (String x : boy) { l1.add(x); } String[] girl = {"Sara", "Leena", "Emilia"}; List&lt;String&gt; l2 = new LinkedList&lt;&gt;(); for (String y : girl) { l2.add(y); l1.addAll(l2); printMe(l1); } l2 = null; } public static void printMe(List&lt;String&gt; l1) { for (String p : l1) { System.out.printf("%s ", p); } System.out.println(); }
type: Answer
answers question: http://stackoverflow.com/q/25972707

http://stackoverflow.com/q/25997841
has comment: http://stackoverflow.com/comment/40714263
has answer: http://stackoverflow.com/a/36564139
answer count: 2
has answer: http://stackoverflow.com/a/25999463
tagged with: exception
type: UnansweredQuestion
tagged with: oracle-database
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40714894
score: 0
tagged with: java
type: Question
has body: This is the error my program is giving. java.sql.SQLException: ORA-00001: unique constraint (SYSTEM.SYS_C006997) violated I tried the following code still the error message in JOptionPane is not "User Exists" ..How can i do that? And also do i need to execute commit statement from my program to save the tables created in oracle db ? try { Statement stmt = con.createStatement(); stmt.executeUpdate("insert into users values('"+st1+"','"+st2+"')"); JOptionPane.showMessageDialog(null,"User Added","Message",JOptionPane.INFORMATION_MESSAGE); setVisible(false); src.addusr.main(null); } catch(SQLIntegrityConstraintViolationException e) { JOptionPane.showMessageDialog(null,"User Already Exists","Message",JOptionPane.ERROR_MESSAGE); } catch(SQLException e2) { JOptionPane.showMessageDialog(null,e2.getMessage(),"Message",JOptionPane.ERROR_MESSAGE); e2.printStackTrace(); } try { Statement stmt1 = con.createStatement(); stmt1.executeUpdate("commit"); } catch(SQLException e6) { e6.printStackTrace(); } }
has title: Handling unique constraint (SYSTEM.SYS_C006997) violated

http://stackoverflow.com/a/26011892
answers question: http://stackoverflow.com/q/26011591
score: 0
type: Answer
has body: If you want to flatten a 2d array then you can iterate over it and add it to an ArrayList. Then you can use toArray() to get an array from the ArrayList. Other option is to multiply the number of rows and columns in your 2d array to find the number of elements and then iterate over the 2d array to fill data in 1d array.

http://stackoverflow.com/a/25996570
has comment: http://stackoverflow.com/comment/40711306
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25995754
answers question: http://stackoverflow.com/q/25995754
score: 0
type: Answer
has body: Ok, I found the problem. The problem was the formatting of absolute path to the file. It should be: el.sendKeys("c:\\Users\\Jacob\\workspace\\seleniumTest\\test.jpg");

http://stackoverflow.com/comment/40771502
comment on: http://stackoverflow.com/a/26029336
has text: I did exactly what you posted above and now i get this error: CoffeeShop.java:47: error: variable price might not have been initialized double total = quantity * price; ^
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40625223
type: QuestionComment
has text: Fair point, I don't have much of an attempt, but I'll edit anyway
type: Comment
comment on: http://stackoverflow.com/q/25949055
score: 0

http://stackoverflow.com/comment/40683318
score: 0
type: Comment
type: QuestionComment
has text: probably means that the results of getActivity() is returning null
comment on: http://stackoverflow.com/q/25981080

http://stackoverflow.com/q/25984140
has body: I'm just confused over why there is a compilation error and how should I fix it. Also, in the last if statement when user fails to enter a valid integer, I'm supposed to repeat the menu again. How should I do that? Thanks in advance. public class MainMenu { public static void main(String[] args) { System.out.println("My First Java program can do many things!"); System.out.println("1.Estimate population\n2.Generate random integer\n3. Print ASCII table\n4. Approximate pi by iteration"); System.out.println("What would you like to do? (1-4)"); System.out.print("Your choice: "); int input = 0; Scanner keyboard = new Scanner(System.in); switch (keyboard.nextInt()) { case 1: System.out.println("You chose to estimate population."); break; case 2: System.out.println("You chose to generate random integer."); break; case 3: System.out.println("You chose to print ASCII table."); break; case 4: System.out.println("You chose to approximate pi by iteration."); break; } if(input&gt;4 || input&lt;1) { System.out.println("Sorry, I don't know what to do. Please try again."); keyboard.next(); if(!keyboard.hasNextInt()) { System.out.println("Sorry, only integers allowed for this menu. Good-bye!"); System.exit(0); } keyboard.next(); input = keyboard.nextInt(); keyboard.nextLine(); }
has comment: http://stackoverflow.com/comment/40689477
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/40689407
type: UnansweredQuestion
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40689709
has comment: http://stackoverflow.com/comment/40689513
tagged with: java
has comment: http://stackoverflow.com/comment/40689367
score: -1
has comment: http://stackoverflow.com/comment/40689515
upvote count: 0
answer count: 1
has title: Display menu compilation error
favorite count: 0
has answer: http://stackoverflow.com/a/25984990
has comment: http://stackoverflow.com/comment/40689420
tagged with: menu

http://stackoverflow.com/comment/40599440
has text: @JonSkeet AKA you've not _implemented_ your problem.
comment on: http://stackoverflow.com/q/25934134
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25906549
tagged with: nio
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40549232
score: 1
has title: SelectionKey.isAcceptable() Returns "true" When No Incoming Connections
favorite count: 0
has answer: http://stackoverflow.com/a/25906955
tagged with: sockets
upvote count: 1
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25906955
type: Question
has body: I'm writing a chat server in Java using Java NIO. The server accepts a connection without issue, but any time that select() returns > 0 after the first client, the server socket is always in the selected key-set even if there are no pending connections. Even if select() returns 1, the selected key-set will have 2 elements and include the server socket. This causes accept() to return null. Any help would be greatly appreciated. The main loop: public void start() throws IOException { Set&lt;SelectionKey&gt; keys; Iterator&lt;SelectionKey&gt; keyIterator; this.keepGoing = true; while (keepGoing) { int readyChannels = this.selector.select(); if (readyChannels == 0) { continue; } keys = this.selector.selectedKeys(); keyIterator = keys.iterator(); while (keyIterator.hasNext()) { SelectionKey currentKey = keyIterator.next(); if (currentKey.isAcceptable()) { addClient(currentKey); } if (currentKey.isReadable()) { readSock(currentKey); } if (currentKey.isWritable()) { // write data to the buffer and remove OP_WRITE } } } } The server initialisation code: public Server(int port) { this.listenPort = port; try { this.selector = Selector.open(); this.listenChannel = ServerSocketChannel.open(); this.listenChannel.socket().bind(new InetSocketAddress(this.listenPort), BACKLOG); this.listenChannel.configureBlocking(false); this.listenChannel.register(this.selector, SelectionKey.OP_ACCEPT); } catch (IOException e) { System.out.println("Server could not initialise: " + e.getMessage()); } this.users = new HashMap&lt;&gt;(); } The addClient method: private void addClient(SelectionKey key) throws IOException { ServerSocketChannel acceptSocket = (ServerSocketChannel) key.channel(); SocketChannel newClient = acceptSocket.accept(); SelectionKey clientKey; // Set the new client to non-blocking mode and add to the selector newClient.configureBlocking(false); clientKey = newClient.register(this.selector, SelectionKey.OP_READ); // Add a new key-user pair to the user list this.users.put(clientKe…

http://stackoverflow.com/a/25878799
has body: you're reusing the args array from the main() method, if you didn't pass any command line arguments in, it will be length zero. you REALLY want to use a seperate array, or a list if you dont know how many lines you will read in.
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25878755

http://stackoverflow.com/q/25930191
has comment: http://stackoverflow.com/comment/40594329
has answer: http://stackoverflow.com/a/25941616
has comment: http://stackoverflow.com/comment/40594528
score: 17
has answer: http://stackoverflow.com/a/73048895
has answer: http://stackoverflow.com/a/67189154
tagged with: spring
downvote count: 1
tagged with: spring-boot
has answer: http://stackoverflow.com/a/25931386
tagged with: java
has title: Connect MySQL to Spring application
has answer: http://stackoverflow.com/a/40539565
tagged with: mysql
type: UnansweredQuestion
upvote count: 18
has answer: http://stackoverflow.com/a/31364432
has answer: http://stackoverflow.com/a/76614992
has comment: http://stackoverflow.com/comment/40592993
has answer: http://stackoverflow.com/a/63900245
has answer: http://stackoverflow.com/a/40036050
answer count: 12
has answer: http://stackoverflow.com/a/60512762
favorite count: 0
has answer: http://stackoverflow.com/a/74613204
has answer: http://stackoverflow.com/a/77254787
has body: I want to use MySQL database rather than using runtime database like hsqldb. I have cloned this repository and it is using hsqldb as its database. As I want to learn how to use relational database with rest based spring application. So I have made following changes to pom.xml: changed pom.xml: <?xml version="1.0" encoding="UTF-8" standalone="no"?> 4.0.0 org.springsource.restbucks restbucks war 1.0.0.BUILD-SNAPSHOT Spring RESTBucks org.springframework.boot spring-boot-starter-parent 1.1.5.RELEASE <spring-data-releasetrain.version>Evans-RC1</spring-data-releasetrain.version> <tomcat.version>8.0.9</tomcat.version> org.springframework.boot spring-boot-starter-data-rest org.springframework.boot spring-boot-starter-data-jpa org.hibernate hibernate-entitymanager org.springframework.boot spring-boot-starter-test org.jadira.usertype usertype.extended 3.2.0.GA com.fasterxml.jackson.datatype jackson-datatype-jsr310 org.hibernate hibernate-entitymanager <!-- Database > org.hsqldb hsqldb runtime mysql mysql-connector-java org.springframework spring-tx-events 1.0.0.BUILD-SNAPSHOT org.projectlombok lombok 1.14.4 provided com.jayway.jsonpath json-path org.apache.maven.plugins maven-compiler-plugin 1.8 1.8 org.springframework.boot spring-boot-maven-plugin spring-libs-snapshot http://repo.spring.io/libs-snapshot true spring-libs-snapshot http://repo.spring.io/libs-snapshot true and in application.properties (spring-restbucks/src/main/resources/application.properties), I have made following changes: # JPA spring.jpa.show-sql=true server.port=8080 spring.datasource.url=jdbc:mysql://localhost/restBucks spring.datasource.driverClassName=com.mysql.jdbc.Driver spring.datasource.username=root spring.datasource.password= but I am facing about 15 errors like: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orderInitializer' defined in file [/home/jimish/projects/spring_projects/spring/spring-restbucks/target/classes/org/springsource/restbucks/order/Orde…
type: Question

http://stackoverflow.com/comment/40762683
has text: Rename the function `TakeDamage()` to `TakeDamageFrom()` and the paramater `name` to `attacker` and you will yourself figure it out.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26024350

http://stackoverflow.com/a/25909490
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/40554908
accepted answer of: http://stackoverflow.com/q/25909039
has comment: http://stackoverflow.com/comment/40554677
answers question: http://stackoverflow.com/q/25909039
upvote count: 4
has body: You probably want to press and release the keys to simulate a keystroke, i.e. your current code will hold down Q, W, E, R, T and Y until a release is triggered. Also, you may want to hold them down for a small amount of time, because that caused some problems for me when I did something like this. Code: package MyProject; import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; public class KeyStroke { private static Robot robot; public static void main(String[] args) throws AWTException { robot = new Robot(); robot.delay(3000); keystroke(KeyEvent.VK_Q); keystroke(KeyEvent.VK_W); keystroke(KeyEvent.VK_E); keystroke(KeyEvent.VK_R); keystroke(KeyEvent.VK_T); keystroke(KeyEvent.VK_Y); } private static void keystroke(int key) { robot.keyPress(key); robot.delay(100); // hold for a tenth of a second, adjustable robot.keyRelease(key); } }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40688550
type: Comment
type: QuestionComment
has text: You should use google Guava's Multimap - if you can http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Multimap.html
score: 1
comment on: http://stackoverflow.com/q/25983775

http://stackoverflow.com/comment/40512085
score: 0
type: Comment
type: QuestionComment
has text: @SagarPilkhwal no, I mean in which method would I get hold of the `Menu` reference, I don't have in present.
comment on: http://stackoverflow.com/q/25885694

http://stackoverflow.com/comment/40676195
type: Comment
has text: Thanks for the prompt reply. swt-awt tag was probably wrong. I took it off. The 'CheckboxGroup' in that link is misleading. It is actually a 'Group' with a checkbox. So when you check it, all its contents are selected. Let's say there are two groups of Strings, -Group A --A1 --A2 -Group B --B1 --B2 If I implement this using tree, it allows selecting A1/A2 and B1/B2 individually. I need some swt component which would allow selecting Group A, Group B but not A1/A2 and B1/B2 individually.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25976932

http://stackoverflow.com/a/25926724
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25926671
has body: Create a Manufacturer interface, and have your enums implement that interface. public interface Manufacturer {} public enum CarManufacturer implements Manufacturer { VOLKSWAGEN, CHEVROLET, DODGE, ... } public enum PlaneManufacturer implements Manufacturer { LOCKHEED, AIRBUS, BOEING, ... } Then in your Vehicle class, you can: public class Vehicle { int size; int weight; Manufacturer manufacturer; Manufacturer getManufacturer () { return manufacturer; }; }
answers question: http://stackoverflow.com/q/25926671
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/a/25912472
type: Answer
accepted answer of: http://stackoverflow.com/q/25911623
has comment: http://stackoverflow.com/comment/96158058
downvote count: 4
has comment: http://stackoverflow.com/comment/86517824
has comment: http://stackoverflow.com/comment/40563206
has comment: http://stackoverflow.com/comment/129693097
has comment: http://stackoverflow.com/comment/105976311
has comment: http://stackoverflow.com/comment/68969828
has body: The fact is that your maven plugin try to connect to an https remote repository (e.g https://repo.maven.apache.org/maven2/) This is a new SSL connectivity for Maven Central was made available in august, 2014 ! So please, can you verify that your settings.xml has the correct configuration. securecentral securecentral central http://repo1.maven.org/maven2 true central http://repo1.maven.org/maven2 true You can alternatively use the simple http maven repository like this central Maven Plugin Repository http://repo1.maven.org/maven2 default false never Please let me know if my solution works ;) J.
has comment: http://stackoverflow.com/comment/45979599
has comment: http://stackoverflow.com/comment/60295346
has comment: http://stackoverflow.com/comment/72534674
has comment: http://stackoverflow.com/comment/40561917
has comment: http://stackoverflow.com/comment/96158475
score: 199
upvote count: 203
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/70061867
answers question: http://stackoverflow.com/q/25911623
has comment: http://stackoverflow.com/comment/44701743
has comment: http://stackoverflow.com/comment/40560325

http://stackoverflow.com/comment/40593272
score: 0
type: Comment
type: QuestionComment
has text: AFAIK you can't hide the buttons
comment on: http://stackoverflow.com/q/25930426

http://stackoverflow.com/q/25888607
has answer: http://stackoverflow.com/a/25888909
tagged with: jdbc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25888909
tagged with: java
type: Question
has body: I am creating a polling program in java using TimerTask for to send email and other notifications automatically. Now this program every second check the database for any new data available. Now i am creating connection like below Connector class its holds database details and return a connection. public class Connector implements Serializable { private static final long serialVersionUID = 1L; private ResourceBundle prop = ResourceBundle.getBundle("dbdetails"); public Connection getConnection() throws Exception { Connection con; Class.forName((String) prop.getString("DB_DRIVER")); con = DriverManager.getConnection((String) prop.getString("DB_URL"), (String) prop.getString("DB_USER"), (String) prop.getString("DB_PASS")); return con; } } My polling class public class EmailPoller extends TimerTask { private static Logger logger = Logger.getLogger(EmailPoller.class); private Connector connector = new Connector(); @Override public void run() { Connection con = null; PreparedStatement ps = null, ps1 = null; ResultSet rs = null; try { con = connector.getConnection(); ps = con.prepareStatement("select to_addr,subject,content,id from email_notification where status='A'"); ps1 = con .prepareStatement("update email_notification set status='I' where id=?"); rs = ps.executeQuery(); while (rs.next()) { Boolean b = Mailer.sendMail(rs.getString(1), rs.getString(2), rs.getString(3)); if (b) { ps1.setInt(1, rs.getInt(4)); ps1.executeUpdate(); } } } catch (Exception ex) { logger.info("Email Poller Error : " + ex); } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } if (ps1 != null) { ps1.close(); } if (con != null) { con.close(); } } catch (Exception ex) { logger.info("Email Poller Error : " + ex); } } } } after send a email i am updating a flag. Mailer is sending mail perfectly. Whether this is a correct approach to check the database for data or any other best way is there to connect to the database?
score: 0
answer count: 2
has title: What is the best way to take database connection for pollling programs in java
has answer: http://stackoverflow.com/a/25889624
accepted answer: http://stackoverflow.com/a/25889624
linked to: http://stackoverflow.com/q/520585

http://stackoverflow.com/comment/40700596
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25988538
has text: I need to connect to MQ without having the client installed. Don't ask me why. My bosses asked me to do it. I did. Now they want features.

http://stackoverflow.com/q/26016768
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26016929
has answer: http://stackoverflow.com/a/26016929
has body: I have to increment the inner loop based on the outer loop, but my logic is failing. int size = currencyList.size(); for (int i=0, j=1; i&lt;size; i++) { CurrencyVO currencyVO = currencyList.get(i); obj1[i+2] = currencyVO.getStrDerivedRefDT(); // CurrencySetupVO cureccyCodeDes = currencyExchList.get(k); //if (i==0) obj3[0]=currencyVO.getStrCurrencyCode(); //if (i==1) obj3[1]= currencyVO.getStrCurrencyDesc(); //if (k&lt;size) { obj3[i+2]=currencyVO.getStrExchRate(); //} data.put(j,obj3); data.put(0,obj1); if (i==31) {//***Here for every i=31,62,93 etc J has to increment*** j++; } } How can I implement this?
type: Question
answer count: 2
tagged with: for-loop
downvote count: 0
has answer: http://stackoverflow.com/a/26016795
favorite count: 0
has title: Increment logic not working properly
has comment: http://stackoverflow.com/comment/40747846
upvote count: 1
accepted answer: http://stackoverflow.com/a/26016795
type: AnsweredQuestion

http://stackoverflow.com/a/25906437
answers question: http://stackoverflow.com/q/25905982
score: 0
has body: This is a clumsy solution but it will work. You can create a new boolean variable in your class and this variable represents if a column was set or not. Like: class MyClass{ boolean isColumnAdded public MyClass(){ isColumnAdded = false; } private void radioButtonActionPerformed(java.awt.event.ActionEvent evt){ if(!isColumnAdded){ //add column isColumnAdded = true; } } }
has comment: http://stackoverflow.com/comment/40549263
type: Answer
has comment: http://stackoverflow.com/comment/40549149

http://stackoverflow.com/a/25987674
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40696064
accepted answer of: http://stackoverflow.com/q/25987623
type: Answer
downvote count: 0
score: 1
has body: I think the most readable way would be to first split on | and then apply a regex that only allows one match: ^[0-9]+\\.[tcm]#[^#]*#[wsn]$ If you want to find matches that are separated by | and/or the start/end of the string, you can do that with positive lookahead assertions instead of ^ and $ anchors: (?&lt;=^|\\|)[0-9]+\\.[tcm]#[^#]*#[wsn](?=$|\\|)
has comment: http://stackoverflow.com/comment/40695980
has comment: http://stackoverflow.com/comment/40695778
answers question: http://stackoverflow.com/q/25987623
upvote count: 1

http://stackoverflow.com/a/26032841
answers question: http://stackoverflow.com/q/26032710
accepted answer of: http://stackoverflow.com/q/26032710
type: AcceptedAnswer
downvote count: 0
has body: Download following zip file proxy_vole.zip Extract the zip file to get proxy_vole.jar
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/40762853
type: Comment
comment on: http://stackoverflow.com/q/26023677
type: QuestionComment
has text: Specifiv part im stuck with, is how to as user choose a text file from the phone and then parse in on.
score: 0

http://stackoverflow.com/q/25907931
accepted answer: http://stackoverflow.com/a/25908080
has comment: http://stackoverflow.com/comment/40551751
type: Question
tagged with: spring
answer count: 1
has comment: http://stackoverflow.com/comment/40551915
has comment: http://stackoverflow.com/comment/40551779
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25908080
has comment: http://stackoverflow.com/comment/40552781
has body: I'm using spring-batch and the JpaPagingItemReader&lt;T&gt; to read a DB to @Entity. The entity is correctly specified as type argument T. Problem: The result set that is returned is not of type T, but an array of objects: Object[]. Each object in that array itself is an Object[] array having the following content: [firstname, lastname, date]. So, the database columns are somehow written as String array, and the entities are returned obviously as String[] array. The reason for this is my query: SELECT firstname, lastname, min(date) FROM mytable GROUP BY firstname, lastname; So the reader maps to a string array. How can I have a mapping to my @Entity, maybe only filled with the fields requested in the select? My reader definition: JpaPagingItemReader&lt;MyEntity&gt; reader = new JpaPagingItemReader&lt;&gt;(); reader.setEntityManagerFactory(emf); reader.setQueryString(QUERY); @Entity public class MyEntity { private String firstname, lastname; private Date date; public MyEntity(String firstname, String lastname, Date date) { this.firstname = firstname; this.lastname = lastname; this.date = date; } }
tagged with: jpa
downvote count: 0
linked to: http://stackoverflow.com/q/2355728
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/40552471
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40552306
has comment: http://stackoverflow.com/comment/40552431
favorite count: 0
has title: JpaPagingItemReader not creating entity objects

http://stackoverflow.com/a/25961815
has body: Where does cognom come from? [Edit: OK, I found it. It's Catalan for surname. And now the typo coming from departamento is also clear. :-] What do you get if you insert System.out.println( Arrays.toString( surname )) before the problem line? I assume it's something like [S, M, I, T, H, [], [], [], [], []] (in Eclipse's Console view). Where [] stands for a square, i.e. a non-printable character. What do you get if you insert System.out.println( (int) surname[5] )? I assume it's 0. And I assume this 0 value is causing the problem. What do you get if you use a surname that's exactly 10 characters long? Hint 1: There's a typo in Departament. Hint 2: Give System.out.printf(...) a chance in favour of println(...). Hint 3: The if in your solution can be shortened to the more elegant: cognom[i] = aux != 0 ? aux : ' ';
has comment: http://stackoverflow.com/comment/40648824
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40649294
has comment: http://stackoverflow.com/comment/40648780
answers question: http://stackoverflow.com/q/25961008
downvote count: 0
has comment: http://stackoverflow.com/comment/40648707

http://stackoverflow.com/a/26178699
has comment: http://stackoverflow.com/comment/41219358
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/45428528
has body: Based on your comment, I don't think that its wise to validate the request path info to the struts action mapping. What I will suggest is to map your Filter to the same <url-mapping> your Struts ActionServlet is mapped to. Example:, should your ActionServlet is mapped on to *.do (suffix mapping), your filter should be mapped to the same. My filter com.myApp.myFilter My filter *.do <!-- The same to my Struts ActionServlet class That way, it will execute prior/after your struts ActionServlet call.
downvote count: 0
answers question: http://stackoverflow.com/q/25912574
type: Answer
has comment: http://stackoverflow.com/comment/41215915

http://stackoverflow.com/a/51819671
answers question: http://stackoverflow.com/q/25912572
score: 12
has body: NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{UfB9geJCR--spyD7ewmoXQ}{192.168.1.245}{192.168.1.245:9300}]] In my case it was the difference in versions. If you check the logs in elasticsearch cluster you will see. Elasticsearch logs [node1] exception caught on transport layer [NettyTcpChannel{localAddress=/192.168.1.245:9300, remoteAddress=/172.16.1.47:65130}], closing connection java.lang.IllegalStateException: Received message from unsupported version: [5.0.0] minimal compatible version is: [5.6.0] I was using elasticsearch client and transport version 5.1.1. And my elasticsearch cluster version was in 6. So I changes my library version to 5.4.3.
upvote count: 12
type: Answer
downvote count: 0

http://stackoverflow.com/q/25958293
has comment: http://stackoverflow.com/comment/40645306
answer count: 0
tagged with: java
tagged with: hibernate
has body: I have table which holds id and 2 foreign keys. I need to add new record. Until persist method everything goes as expected - productPart is valid entity. After persist is executed - no new records appear in MySQL table. DAO @Repository public class ProductPartDao{ @Override @Transactional public void addProductPart (ProductPart productPart) { sessionFactory.openSession().persist(productPart); // doesn't work } Service @Service public class ProductPartService{ @Autowired ProductPartDao productPartDao; @Override @Transactional public void addProductPart(ProductPart productPart) { productPartDao.addProductPart(productPart); } I cannot use sessionFactory.getCurrentSession() because it throws error: HibernateException: Could not obtain transaction-synchronized Session for current thread. What's the reason? How to solve it? UPDATE in applicationContext: ... &lt;tx:annotation-driven/&gt; ... &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager" p:sessionFactory-ref="sessionFactory"&gt; &lt;/bean&gt; ... UPDATE2 Input is 2 id which used to retrieve product and part objects. Then this objects set as fields to ProductPart object and persisted. All retrieval methods for product and part is marked as @Transactional. Why Spring and Hibernate are having trouble with it? UPDATE3: When code changed to sessionFactory.getCurrentSession() there is exception: org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134) at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:988) at ee.t.mysql.model.ProductPartDAOImpl.addProductPart(ProductPartDAOImpl.java:19) The session object just before Exception: It can persist object when it's called from main with loaded ConfigurableApplicationContext. Spring web application with controllers fails. SOLVED Solved by replaci…
tagged with: mysql
type: Question
linked to: http://stackoverflow.com/q/25933532
score: 0
has comment: http://stackoverflow.com/comment/40641484
has title: Cannot persist Entity using Hibernate
has comment: http://stackoverflow.com/comment/40647052
type: UnansweredQuestion

http://stackoverflow.com/comment/40732238
score: 0
has text: fibonnacci, printing diamond *, converting 193 to string character, add or even number. more on http://projecteuler.net/problems
type: Comment
comment on: http://stackoverflow.com/q/26007393
type: QuestionComment

http://stackoverflow.com/comment/40713602
score: 8
has text: Perhaps a regex tutorial would be a good first step? Or some experimentation on any of the online regex evaluators? Some are even graphical and help break things down.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25997876

http://stackoverflow.com/comment/40631002
type: Comment
has text: The main down side with this is that it doesn't necessarily give a solution to the question, which asks for an algorithm that finds the maximum number of treated patients. This might, or might not, find the maximum.
comment on: http://stackoverflow.com/a/25951814
type: AnswerComment
score: 0

http://stackoverflow.com/a/25962120
has body: yes you need JDBC driver to connect to mysql DB on your servlet side, but if you're using MySQL, why you need SQL server for?? you can take a look at this blog post on how to send request from your android app to servlet.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25961528
answers question: http://stackoverflow.com/q/25961528

http://stackoverflow.com/q/25898117
favorite count: 0
tagged with: scjp
has comment: http://stackoverflow.com/comment/40534023
score: -4
has answer: http://stackoverflow.com/a/25898935
type: AnsweredQuestion
tagged with: java
has body: I need help understanding this problem The correct answer is 'C' A class games.cards.Poker is correctly defined in the jar file Poker.jar. A user wants to execute the main method of Poker on a UNIX system using the command: java games.cards.Poker What allows the user to do this? A. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java B. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/*.jar C. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/Poker.jar D. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java E. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/*.jar F. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/Poker. jar
type: Question
upvote count: 0
accepted answer: http://stackoverflow.com/a/25898935
downvote count: 4
has comment: http://stackoverflow.com/comment/40534034
has title: A class games.cards.Poker is correctly defined in the jar file Poker.jar. A user wants to execute the main method of Poker on a UNIX system
has comment: http://stackoverflow.com/comment/40534049
answer count: 1

http://stackoverflow.com/q/25930498
favorite count: 0
tagged with: jsonschema2pojo
type: UnansweredQuestion
upvote count: 1
tagged with: jsonschema
has title: Custom @JsonProperty Annotations
answer count: 0
has comment: http://stackoverflow.com/comment/40595804
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Consider the json schema: { "type":"object", "$schema":"http://json-schema.org/draft-04/schema", "required":false, "properties":{ "inventory":{ "type":"object", "required":false, "properties":{ "count":{ "type":"number", "required":false } } } } } When using jsonschema2pojo, this generates a corresponding java object. Extracted from this is the following declaration for count (full class below): @JsonProperty("count") private Double count; package com.test.json; import java.util.HashMap; import java.util.Map; import javax.annotation.Generated; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({ "count" }) public class Inventory{ /** * */ @JsonProperty("count") private Double count; @JsonIgnore private Map&lt;String, Object&gt; additionalProperties = new HashMap&lt;String, Object&gt;(); /** * * @return * The count */ @JsonProperty("count") public Double getCount() { return count; } /** * * @param count * The count */ @JsonProperty("count") public void setCount(Double count) { this.arpu = count; } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } @Override public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } @Override public boolean equals(Object other) { return EqualsBuilder.reflectionEquals(this, other); } @JsonAnyGetter public Map&lt;String, Object&gt; getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, …
type: Question
tagged with: jackson
downvote count: 0

http://stackoverflow.com/q/25970861
answer count: 1
favorite count: 0
tagged with: parse-platform
accepted answer: http://stackoverflow.com/a/25971308
has body: I have a News objects that extends ParseObject class. I'd like it to be cached locally so that I can fetch it from local store later. Here is my callback that includes call to .pinAllInBackground(..) method: FindCallback&lt;News&gt; onNewsReceived = new FindCallback&lt;News&gt;() { @Override public void done(List&lt;News&gt; arg0, ParseException arg1) { if (arg1 == null) { newsList = new ArrayList&lt;News&gt;(arg0); ParseObject.pinAllInBackground(newsList); initializeList(); } else { Log.d("TAG1", String.valueOf(arg1.getMessage())); } } }; When i run this I get the following exception: 09-22 11:31:25.637: E/AndroidRuntime(27380): FATAL EXCEPTION: main 09-22 11:31:25.637: E/AndroidRuntime(27380): Process: pl.holdapp.osw, PID: 27380 09-22 11:31:25.637: E/AndroidRuntime(27380): java.lang.NullPointerException 09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.ParsePin.getParsePin(ParsePin.java:19) 09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.ParsePin.pinAllObjectsAsync(ParsePin.java:44) 09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.ParseObject.pinAllAsync(ParseObject.java:3320) 09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.ParseObject.pinAllInBackground(ParseObject.java:3417) 09-22 11:31:25.637: E/AndroidRuntime(27380): at pl.holdapp.osw.fragments.NewsFragment$2.done(NewsFragment.java:68) 09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.FindCallback.internalDone(FindCallback.java:45) 09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.FindCallback.internalDone(FindCallback.java:31) 09-22 11:31:25.637: E/AndroidRuntime(27380): at com.parse.Parse$6$1.run(Parse.java:917) 09-22 11:31:25.637: E/AndroidRuntime(27380): at android.os.Handler.handleCallback(Handler.java:733) 09-22 11:31:25.637: E/AndroidRuntime(27380): at android.os.Handler.dispatchMessage(Handler.java:95) 09-22 11:31:25.637: E/AndroidRuntime(27380): at android.os.Looper.loop(Looper.java:157) 09-22 11:31:25.637: E/AndroidRuntime(27380): at android.app.Ac…
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25971308
tagged with: caching
type: Question
has title: ParseObject.pinAllInBackground() results with NullPointerException
upvote count: 1
tagged with: android

http://stackoverflow.com/comment/40616363
type: QuestionComment
has text: @Chief Two Pencils The main difference I see in other implementations is the use of left right and middle indexes, it may just be idempotent to the way that I send the unsorted.size()/2 into the arguments of mergeSort()
comment on: http://stackoverflow.com/q/25943144
score: 0
type: Comment

http://stackoverflow.com/q/25905272
type: Question
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25905320
tagged with: java
has title: what all will happen at the machine level when I run a java program file using the "java file_name" command?
has body: I would like to know what happens internally at the machine level when I try to run a java compiled file using the command "java class_name" If you know how the classes loaded into JVM will start executing with the help of Program Counter (PC) or any other pointers to the memory please explain it. Like, what loadClass() will do and its internal calls to findClass() and other methods. In that detail I am expecting the answer to be.

gradle
tags question: http://stackoverflow.com/q/26024030
tags question: http://stackoverflow.com/q/25907325
tags question: http://stackoverflow.com/q/25902132
tags question: http://stackoverflow.com/q/25976590
tags question: http://stackoverflow.com/q/25886920
tags question: http://stackoverflow.com/q/25959853
tags question: http://stackoverflow.com/q/25970246
tags question: http://stackoverflow.com/q/26014947
tags question: http://stackoverflow.com/q/26011620
type: Tag
tags question: http://stackoverflow.com/q/25915717
tags question: http://stackoverflow.com/q/25989407
tags question: http://stackoverflow.com/q/25892831
tags question: http://stackoverflow.com/q/25923792
tags question: http://stackoverflow.com/q/25912190
tag name: gradle
tags question: http://stackoverflow.com/q/26013273
tags question: http://stackoverflow.com/q/25958047
tags question: http://stackoverflow.com/q/25878498
tags question: http://stackoverflow.com/q/25924108
tags question: http://stackoverflow.com/q/25908012
tags question: http://stackoverflow.com/q/26005857
tags question: http://stackoverflow.com/q/25985701
tags question: http://stackoverflow.com/q/25876798
tags question: http://stackoverflow.com/q/25998407
tags question: http://stackoverflow.com/q/26028171
tags question: http://stackoverflow.com/q/25964880
tags question: http://stackoverflow.com/q/26000235
tags question: http://stackoverflow.com/q/25939577
tags question: http://stackoverflow.com/q/26004305

http://stackoverflow.com/q/25936517
tagged with: java
has title: How do I get a thumbnail of a certain size from an image file using Box Java SDK?
type: Question
has body: I can currently retrieve a thumbnail of an image file just fine with the following code: BoxImageRequestObject obj = null; thumbnail = client.getFilesManager().getThumbnail( entryId, fileExtention, obj ); However, the thumbnail obtained is too small. So, I need to be able to request a certain size. I have tried using pagePreviewRequestObject method that allows for setting the dimensions. But it doesn't work. BoxImageRequestObject obj = BoxImageRequestObject.pagePreviewRequestObject(page, minWidth, maxWidth, minHeight, maxHeight); thumbnail = client.getFilesManager().getThumbnail( entryId, fileExtention, obj ); Please tell me how to request a thumbnail by size using the Box Java SDK. Thanks!
has answer: http://stackoverflow.com/a/27917892
accepted answer: http://stackoverflow.com/a/25983633
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27917892
tagged with: boxapiv2
tagged with: box-api
has answer: http://stackoverflow.com/a/25983633
type: AnsweredQuestion

http://stackoverflow.com/comment/40746363
comment on: http://stackoverflow.com/q/25991841
score: 0
type: Comment
type: QuestionComment
has text: @m0skit0 I don't understand you request. Clease clarify it in details.

http://stackoverflow.com/q/25991094
favorite count: 0
has comment: http://stackoverflow.com/comment/40701543
type: Question
has comment: http://stackoverflow.com/comment/40701932
has title: Controls FX TraversalEngine Error
upvote count: 2
has comment: http://stackoverflow.com/comment/40703655
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/40701497
has answer: http://stackoverflow.com/a/25992711
answer count: 1
has body: I installed JDK8u20 and tried to run my program with the ControlsFX library in it. This should work fine, but if I call a method from controlsFX, I get the following exception Method private void showError(final String msg) { Platform.runLater(new Runnable() { @Override public void run() { Dialogs.create().title("Achtung").message(msg).showError(); } }); } Exception java.lang.NoSuchMethodError: com.sun.javafx.scene.traversal.TraversalEngine.&lt;init&gt;(Ljavafx/scene/Parent;Z)V at org.controlsfx.control.ButtonBar$2.&lt;init&gt;(ButtonBar.java:412) at org.controlsfx.control.ButtonBar.&lt;init&gt;(ButtonBar.java:412) at org.controlsfx.control.ButtonBar.&lt;init&gt;(ButtonBar.java:355) at org.controlsfx.dialog.Dialog.createButtonPanel(Dialog.java:1034) at org.controlsfx.dialog.Dialog.createCenterPanel(Dialog.java:1029) at org.controlsfx.dialog.Dialog.buildDialogContent(Dialog.java:950) at org.controlsfx.dialog.Dialog.show(Dialog.java:320) at org.controlsfx.dialog.Dialogs.showSimpleContentDialog(Dialogs.java:1106) at org.controlsfx.dialog.Dialogs.showError(Dialogs.java:555) at ch.berufsbildungscenter.notiztool.gui.control.LoginController$3.run(LoginController.java:93) at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Source) at com.sun.javafx.application.PlatformImpl$$Lambda$48/1171794308.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown Source) at com.sun.javafx.application.PlatformImpl$$Lambda$47/1875594551.run(Unknown Source) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source) at com.sun.glass.ui.win.WinApplication$$Lambda$38/994750745.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
has comment: http://stackoverflow.com/comment/40703624
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/25992711
downvote count: 0
tagged with: controlsfx
has comment: http://stackoverflow.com/comment/40701864

http://stackoverflow.com/q/25978233
has answer: http://stackoverflow.com/a/25978531
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/40487623
downvote count: 0
has comment: http://stackoverflow.com/comment/111787588
answer count: 2
tagged with: sql
favorite count: 0
has title: Getting wrong time for timestamp field with hibernate select
has body: Getting wrong time for timestamp field with Hibernate select. We are using Hibernate framework and Postgres database. We have a table which stores 'created_time' in column of data type TIMESTAMP WITH TIME ZONE. +------------------------------------------+ + created_time + +------------------------------------------+ + 2014-09-22 04:30:00.756 + + -----------------------------------------+ Assume we have a data '2014-09-22 04:30:00.756' in 'created_time'. I used the following hibernate query query= "SELECT column1,column2,createdTime FROM TableName"; … … List&lt;Object[]&gt; dataList=selectQuery.list(); for(Object data[] : dataList) { System.out.println("Date and time -&gt; "+data[2].toString()); //Time coming wrong here } When I go throught the dataList I find that the date is coming correctly, but the time is something else like '11:45:00.345'. The same query if I used in pgAdminIII means it is coming correctly. But with hibernate it is coming wrongly. I have even tried SQL query. Still I face the wrong time problem. I am not getting a solution when i searched the net.
tagged with: postgresql
type: UnansweredQuestion

http://stackoverflow.com/q/26022614
tagged with: linux
has body: Problems with Tomcat Installation os OS X Mavericks I cannot start the server, because it does not start: /opt/apache-tomcat-8.0.12/bin/catalina.sh: line 399: /opt/apache-tomcat-8.0.12/logs/catalina.out: No such file or directory SEICCN-3:Downloads stefanieness$ /opt/apache-tomcat-8*/bin/startup.sh Using CATALINA_BASE: /opt/apache-tomcat-8.0.12 Using CATALINA_HOME: /opt/apache-tomcat-8.0.12 Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.12/temp Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home Using CLASSPATH: /opt/apache-tomcat-8.0.12/bin/bootstrap.jar:/opt/apache-tomcat-8.0.12/bin/tomcat-juli.jar touch: /opt/apache-tomcat-8.0.12/logs/catalina.out: No such file or directory /opt/apache-tomcat-8.0.12/bin/catalina.sh: line 399: /opt/apache-tomcat-8.0.12/logs/catalina.out: No such file or directory SEICCN-3:Downloads stefanieness$ $CATALINA_HOME/bin/startup.sh -bash: /bin/startup.sh: No such file or directory Apache Tomcat Installation: tutorialforlinux.com/2014/01/10/how-to-install-apache-tomcat-8-on-mac-10-9-mavericks-os-x-easy-visual-guide/ SEICCN-3:assignment1 stefanieness$ sudo mkdir /opt Password: mkdir: /opt: File exists SEICCN-3:assignment1 stefanieness$ sudo mv /Users/stefanieness/Downloads/apache-tomcat-8* /opt/ SEICCN-3:assignment1 stefanieness$ /opt/apache-tomcat-8*/bin/startup.sh Using CATALINA_BASE: /opt/apache-tomcat-8.0.12 Using CATALINA_HOME: /opt/apache-tomcat-8.0.12 Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.12/temp Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home Using CLASSPATH: /opt/apache-tomcat-8.0.12/bin/bootstrap.jar:/opt/apache-tomcat-8.0.12/bin/tomcat-juli.jar touch: /opt/apache-tomcat-8.0.12/logs/catalina.out: No such file or directory /opt/apache-tomcat-8.0.12/bin/catalina.sh: line 399: /opt/apache-tomcat-8.0.12/logs/catalina.out: No such file or directory tutorialforlinux.com/2014/01/09/how-to-install-oracle-jdk-7-on-mac-10-9-mavericks-easy-guide/ Followed the tutorial. SEICC…
has answer: http://stackoverflow.com/a/26023639
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40759713
has comment: http://stackoverflow.com/comment/40760637
score: 2
tagged with: java
type: Question
has title: Problems with Tomcat Installation os OS X Mavericks
tagged with: apache
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40759229
tagged with: bash
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40759592
favorite count: 0

http://stackoverflow.com/a/25878209
has body: This is a Java language feature called boxing that allows a primitive type to work with a reference-type parameter, variable, or collection. The compiler will generate proper code to obtain1 a java.lang.Integer in your case. The disassembly makes this clear: public static void main(java.lang.String[]); Code: 0: ldc2_w #2 // double 232.0d 3: dstore_1 4: dload_1 5: invokestatic #4 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double; 8: invokestatic #5 // Method showObj:(Ljava/lang/Object;)V 11: return At instruction 5, the compiler generates a call to Double.valueOf(double) which is used to actually obtain the necessary object. 1 The word obtain is used in lieu of construct as the object may be cached. Due to immutability, this is not a problem.
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25878180
answers question: http://stackoverflow.com/q/25878180

http://stackoverflow.com/comment/40518123
score: 2
has text: then why don't you use set
type: QuestionComment
comment on: http://stackoverflow.com/q/25889698
type: Comment

excel
tags question: http://stackoverflow.com/q/26001643
tags question: http://stackoverflow.com/q/25951044
tag name: excel
tags question: http://stackoverflow.com/q/25883941
tags question: http://stackoverflow.com/q/25885100
tags question: http://stackoverflow.com/q/25984330
tags question: http://stackoverflow.com/q/26018080
tags question: http://stackoverflow.com/q/26025413
tags question: http://stackoverflow.com/q/25936369
tags question: http://stackoverflow.com/q/25944605
tags question: http://stackoverflow.com/q/25926740
tags question: http://stackoverflow.com/q/25961500
type: Tag
tags question: http://stackoverflow.com/q/25913974
tags question: http://stackoverflow.com/q/25912394
tags question: http://stackoverflow.com/q/26020075
tags question: http://stackoverflow.com/q/25908798
tags question: http://stackoverflow.com/q/25880954

http://stackoverflow.com/comment/40756510
comment on: http://stackoverflow.com/q/26021073
score: 0
type: QuestionComment
type: Comment
has text: I am looking for a recursive method to go through the matrix in the specified way and determine highest sum. Dijkstra is rather complicated. I have to modify my method somehow.

http://stackoverflow.com/q/25901842
score: 0
tagged with: thread-sleep
answer count: 1
accepted answer: http://stackoverflow.com/a/25901989
type: AnsweredQuestion
tagged with: swing
has title: Run Frame and loop at same time?
tagged with: jfilechooser
type: Question
has answer: http://stackoverflow.com/a/25901989
tagged with: java
has body: Im making a simple little program that spams a Text file. But im stuck at a problem. I need to run a while(true) loop and a frame at the same time. I need close the frame too. But i have tried threading and stuff but i cant figure it out for nothing, and im at the point where i need help. This is what ive got MAIN public static void main(String[] args) throws IOException { Frame frame = new Frame(); } public static void Spam(){ try{ while(true){ String userName = names[ran.nextInt(names.length)]+ran.nextInt(360); String rawMessage = messages[ran.nextInt(names.length)]+ran.nextInt(360); String message=userName+": "+rawMessage; CustomWriter writer = new CustomWriter(); CustomWriter.Write(message); System.out.println(message); Thread.sleep(waitTime); } }catch(Exception err){} } } FRAME public class Frame { String file; Frame() { final JFrame frame = new JFrame("SuperSpammer"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300,100); Container contentPane = frame.getContentPane(); contentPane.setLayout(new FlowLayout()); //Now lets get the stuff JButton bPickFile = new JButton("FILE"); JButton bStart = new JButton("START"); final JTextField tfWaitTime = new JTextField(5); final JLabel lSpaming = new JLabel("SPAMING"); final JFileChooser fc = new JFileChooser(); frame.add(bPickFile); frame.add(tfWaitTime); frame.add(bStart); frame.setVisible(true); //ActionListners bPickFile.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { int returnVal = fc.showOpenDialog(fc); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile().toString(); } } }); bStart.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { if(file!=null){ frame.removeAll(); frame.add(lSpaming); Main.Spam(); } } }); } } So how can i run the loop and the frame at the same time so i can close the frame? What am i doing wrong and how can i fix it?

http://stackoverflow.com/q/25900226
has answer: http://stackoverflow.com/a/25902178
has body: I was just seeing the difference between a HashMap and HashTable. Other than the obvious synchronized and unsynchronized difference, I noticed that HashTable extends the Dictionary class while HashMap implements Map. Both of them store &lt;Key, Value&gt; pair, so what's the difference. I tried Googling for it and I found few questions on SO (1, 2 and 3). I didn't find anything satisfactory other than the fact that Dictionary class is obsolete. Is there any difference between thee two classes? If no, why is the dictionary class obsolete now?
linked to: http://stackoverflow.com/q/2884068
score: 2
has title: What is the difference between the Dictionary class and the Map class in Java?
linked to: http://stackoverflow.com/q/267312
favorite count: 0
has comment: http://stackoverflow.com/comment/40542475
has comment: http://stackoverflow.com/comment/40537954
linked to: http://stackoverflow.com/q/40471
has comment: http://stackoverflow.com/comment/40537960
tagged with: dictionary
has comment: http://stackoverflow.com/comment/40537902
answer count: 4
has comment: http://stackoverflow.com/comment/40537968
has answer: http://stackoverflow.com/a/25900305
has answer: http://stackoverflow.com/a/25900365
upvote count: 3
linked to: http://stackoverflow.com/q/9769797
has answer: http://stackoverflow.com/a/25900292
downvote count: 1
possible better answer: http://stackoverflow.com/a/25900365
has comment: http://stackoverflow.com/comment/40537970
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25900305
has comment: http://stackoverflow.com/comment/40538079
type: Question

http://stackoverflow.com/q/25884711
has answer: http://stackoverflow.com/a/25890581
score: 20
accepted answer: http://stackoverflow.com/a/25890581
answer count: 2
has answer: http://stackoverflow.com/a/33385595
has comment: http://stackoverflow.com/comment/40515251
has body: I am creating POC for RESTFUL Web service using Spring 4.0. It is working fine if we pass only String or any other basic dataype. @RequestMapping(value="/upload/file", method=RequestMapping.post) public String uploadFile(@RequestParam("fileName", required=false) String fileName){ logger.info("initialization of object"); //---------------------------------------- System.out.Println("name of File : " + fileName); //---------------------------------------- } This works fine. but If I want to pass byte stream or File Object to function, How can i write this function having these parameters? and How can I write Client having provision of passing byte stream? @RequestMapping(value="/upload/file", method=RequestMapping.post) public String uploadFile(@RequestParam("file", required=false) byte [] fileName){ //--------------------- // } I tried this code but getting 415 Error. @RequestMapping(value = "/upload/file", method = RequestMethod.POST, consumes="multipart/form-data") public @ResponseBody String uploadFileContentFromBytes(@RequestBody MultipartFormDataInput input, Model model) { logger.info("Get Content. "); //------------ } Client Code - Using apache HttpClient private static void executeClient() { HttpClient client = new DefaultHttpClient(); HttpPost postReqeust = new HttpPost(SERVER_URI + "/file"); try{ // Set Various Attributes MultipartEntity multipartEntity = new MultipartEntity(); multipartEntity.addPart("fileType" , new StringBody("DOCX")); FileBody fileBody = new FileBody(new File("D:\\demo.docx"), "application/octect-stream"); // prepare payload multipartEntity.addPart("attachment", fileBody); //Set to request body postReqeust.setEntity(multipartEntity); HttpResponse response = client.execute(postReqeust) ; //Verify response if any if (response != null) { System.out.println(response.getStatusLine().getStatusCode()); } } catch(Exception ex){ ex.printStackTrace(); }
has comment: http://stackoverflow.com/comment/40521218
favorite count: 0
upvote count: 20
tagged with: rest
tagged with: web-services
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/25460779
type: AnsweredQuestion
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/25286860
type: Question
has title: Spring : File Upload RESTFUL Web Service
has comment: http://stackoverflow.com/comment/40513932
has comment: http://stackoverflow.com/comment/40523472
has comment: http://stackoverflow.com/comment/40514834
has comment: http://stackoverflow.com/comment/40514778
possible better answer: http://stackoverflow.com/a/33385595

http://stackoverflow.com/q/25926244
tagged with: android
type: AnsweredQuestion
tagged with: java
score: 0
has title: How to put cursor data in array?
has answer: http://stackoverflow.com/a/25926289
type: Question
has answer: http://stackoverflow.com/a/25926669
has comment: http://stackoverflow.com/comment/40585500
possible better answer: http://stackoverflow.com/a/25926669
answer count: 2
accepted answer: http://stackoverflow.com/a/25926289
has body: I am fetching data from database and after that assigning it to arrays in this process i always get length of all arrays as 1 only. Method : public void fetchData() { database.open(); Cursor cursor = database.getAllData(); cursor.moveToFirst(); while (!(cursor.isAfterLast())) { nameArr = new String[] { cursor.getString(1) }; // i tried to put cursor data in arr from here addressArr = new String[] { cursor.getString(2) }; contactArr = new String[]{ cursor.getString(3) }; cursor.moveToNext(); } database.close(); Log.d("ArrayLength", Integer.toString(nameArr.length));//The arraylength is 1 i dont know why?? }

http://stackoverflow.com/comment/40581873
type: AnswerComment
type: Comment
has text: Well all I did was change it the parameter to ArrayList<Song> instead of ArrayList but it's still the same, do I have to change the return statement?
comment on: http://stackoverflow.com/a/25924175
score: 0

http://stackoverflow.com/a/26001236
answers question: http://stackoverflow.com/q/25998446
type: AcceptedAnswer
type: Answer
has body: Thanks for giving me the opportunity to learn and think on my own. Of course, thank you @xgeorgekx for the codes that gave me my own idea of solving my own problem using your codes as reference. I did it in this way though, I know it is not fully optimised. I welcome any suggestions! Firstly, I get rid of all the spaces in the string. then using numColumns as 15 and numRows as 20, i used 2 loops and stored the values of the string parsed to int as i needed the element of the array as the cellType so as to set the colour. String spaceFilter = map.replaceAll(" ", ""); for (int i = 0; i &lt; numColumns; i++) { for (int j = 0; j &lt; numRows; j++) { if (spaceFilter.length() != 0) { cellType[i][j] = Integer.parseInt(spaceFilter.substring(0,1)); spaceFilter = spaceFilter.substring(1); } } }
accepted answer of: http://stackoverflow.com/q/25998446
score: 0

http://stackoverflow.com/a/25910648
score: 10
answers question: http://stackoverflow.com/q/25909657
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40591324
has body: I had same problem while working with a web application using Struts 2 frame work. I searched for a while, and the solution that I found worked for me. I found somewhere that: Basic rule of HTTP: one request, one response. You can only send back one thing to a request. Either an HTML page, or a PDF document, or an image etc. Java complains if you have already obtained a writer/outputstream as you should only be getting ONE of these. In my case, the action class which downloads the file was returning back a String "sucess" to the request after the file download, and that caused the problem. I changed the return type of the method to void and issue resolved.
upvote count: 10

http://stackoverflow.com/comment/40767105
type: QuestionComment
has text: The code is more difficult, thats a summary. I just realize that the files are created in background but the progress bar I want not to stop is freezed...
comment on: http://stackoverflow.com/q/26026274
score: 0
type: Comment

http://stackoverflow.com/comment/41635786
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26201629
has text: Add it to your code here so we can see what you tried.

http://stackoverflow.com/comment/40667765
type: QuestionComment
score: 0
has text: @will, yes I forgot to put the default constructor, but I do have a default constructor in the real code. I didn't edit my question, as then some answers would have to edit as well.
comment on: http://stackoverflow.com/q/25972204
type: Comment

http://stackoverflow.com/q/25935138
has answer: http://stackoverflow.com/a/25936192
type: Question
answer count: 1
has body: I have installed an application with context /sampleApp on Tomcat7 running Linode. I also have an Apache server installed. I have done some configuration as below, through which I am able to redirect the requests from www.example.com to the root of tomcat. But I want to be able to serve /sampleApp whenever somebody requests the domain name like www.example.com. Here is the configuration I have done so far: Included and enabled a virtual host www.example.com in Apache2 &lt;VirtualHost *:80&gt; ServerName www.example.com ServerAlias example.com ProxyRequests Off ProxyPreserveHost On &lt;Proxy *&gt; Order deny,allow Allow from all &lt;/Proxy&gt; ProxyPass / http://localhost:8080/ ProxyPassReverse / http://www.example.com/ &lt;/VirtualHost&gt; And added proxy support in Tomcat7 server.xml &lt;Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" proxyName="www.example.com" proxyPort="80"/&gt; I have search SO and ServerFault and Google too but cant find something that works for me.
tagged with: apache2
score: 0
has title: Host Tomcat7 WebApp on domain behind Apache2 with mod_proxy
type: UnansweredQuestion
tagged with: tomcat7
tagged with: java

http://stackoverflow.com/comment/40683523
has text: That would be cool. I've not heard of such a plugin. You would have to then disable your configuration at runtime.
comment on: http://stackoverflow.com/q/25981158
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25881697
has answer: http://stackoverflow.com/a/25881745
has answer: http://stackoverflow.com/a/25881729
answer count: 5
has answer: http://stackoverflow.com/a/25881747
has comment: http://stackoverflow.com/comment/40504647
has comment: http://stackoverflow.com/comment/40504617
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25881729
possible better answer: http://stackoverflow.com/a/25881728
has answer: http://stackoverflow.com/a/25881969
type: Question
has answer: http://stackoverflow.com/a/25881728
score: 0
has title: Java string validation
has body: I'm finding a regular expression which adheres below rules. Allowed Characters Alphabet : a-z A-Z Numbers : 0-9 I am using [^a-zA-Z0-9] but when call regex = "[^a-zA-Z0-9]" ; String key = "message"; if (!key.matches(regex)) message = "Invalid key"; system will show Invalid key, The key should be valid. Could you please help me?
tagged with: regex

http://stackoverflow.com/q/26018653
tagged with: remember-me
score: 0
has comment: http://stackoverflow.com/comment/40757557
tagged with: spring-security
linked to: http://stackoverflow.com/q/24745528
type: UnansweredQuestion
has title: Why does not remember-me function sometimes work in Spring Security?
tagged with: spring
answer count: 0
has body: I use 'remember me' function from Spring Security. Also I use LDAP to check user authentication. Here is my security-context.xml: &lt;sec:http use-expressions="true"&gt; &lt;sec:intercept-url pattern="/login" access="permitAll()"/&gt; &lt;sec:intercept-url pattern="/_*.js" access="permitAll()"/&gt; &lt;sec:intercept-url pattern="/403" access="isAuthenticated()"/&gt; &lt;sec:form-login login-page="/login" authentication-success-handler-ref="loginController" authentication-failure-handler-ref="loginController"/&gt; &lt;sec:remember-me user-service-ref="ldapUserDetailsService" data-source-ref="dataSource"/&gt; &lt;sec:access-denied-handler error-page="/403"/&gt; &lt;sec:logout/&gt; &lt;/sec:http&gt; &lt;sec:authentication-manager&gt; &lt;sec:authentication-provider ref="customizedActiveDirectoryAuthenticationProvider"/&gt; &lt;/sec:authentication-manager&gt; &lt;bean id="userDetailsMapper" class="MyLdapUserDetailsMapper"/&gt; &lt;bean id="authoritiesPopulator" class="MyAuthoritiesPopulator"/&gt; &lt;bean id="customizedActiveDirectoryAuthenticationProvider" class="MyCustomizedActiveDirectoryAuthenticationProvider"&gt; &lt;!--some configuration here--&gt; &lt;/bean&gt; &lt;bean id="ldapUserDetailsService" class="org.springframework.security.ldap.userdetails.LdapUserDetailsService"&gt; &lt;!--some configuration here--&gt; &lt;/bean&gt; And my login.js contains: xtype: 'checkbox', fieldLabel: '&amp;nbsp;', boxLabel: 'Remember me', labelSeparator: '', name: '_spring_security_remember_me', checked: false I found that RememberMeAuthenticationFilter is used if it helps. In the most cases remember-me function works fine. But sometimes after I close browser, it doesn't remember me and I see login page, although I pressed 'remember me' before. What is wrong here? Or may be problem is not with Spring Security? I read this, but I use Spring Security 3.1.x that does not contain WebSecurityConfigurerAdapter. So I don't know how I can use this article.
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40784172

http://stackoverflow.com/comment/40749128
type: AnswerComment
has text: He said 'space', not 'whitespace'. `trim()` operates on whitespace. Subtle difference that may be important to him.
type: Comment
comment on: http://stackoverflow.com/a/26017395
score: 1

http://stackoverflow.com/comment/40743705
comment on: http://stackoverflow.com/q/26013386
type: Comment
type: QuestionComment
has text: Oh...sorry. I figured it out.
score: 0

http://stackoverflow.com/q/26017457
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40749719
type: Question
has answer: http://stackoverflow.com/a/26018129
accepted answer: http://stackoverflow.com/a/26018129
has title: Why java swing gui is drawn bad?
has comment: http://stackoverflow.com/comment/40750367
tagged with: user-interface
has body: Something strange with my java interface. It's drawn very bad. What could be the problem?
score: 4
has comment: http://stackoverflow.com/comment/40750222
has comment: http://stackoverflow.com/comment/40749489
has comment: http://stackoverflow.com/comment/40749281
answer count: 1
linked to: http://stackoverflow.com/q/22737535
favorite count: 0
has comment: http://stackoverflow.com/comment/40751567
tagged with: swing
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/26032316
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26032100
answers question: http://stackoverflow.com/q/26032100
has body: You can use lookahead and lookbehind in order not to include the parenthesis in the matched group: ArrayList&lt;String&gt; countryCount = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; portfolioCount = new ArrayList&lt;String&gt;(); String mainText = "USA (45)"; final Pattern p = Pattern.compile("(.*?)(?&gt;\\()(\\d+)(?=\\)).*"); final Matcher m = p.matcher(mainText); m.find(); countryCount.add(m.group(1)); //USA portfolioCount.add(m.group(2)); //45
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/25957976
upvote count: 2
score: 0
tagged with: double
downvote count: 2
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/25958010
tagged with: decimal
has answer: http://stackoverflow.com/a/25958103
type: UnansweredQuestion
has title: How to count total number of chars in float number
favorite count: 0
has comment: http://stackoverflow.com/comment/40640770
type: Question
has answer: http://stackoverflow.com/a/25958045
has body: Could you help me to write a method with the following signature: public int method(double value) that returns total number of chars in value(including the decimal point), for example: method(5.0) - 3 method(1.2345) - 6 method(2.34) - 4 The problem is that method(5) must return 1, not 3, looking at 5 as it is 5.0
has comment: http://stackoverflow.com/comment/40640886
has answer: http://stackoverflow.com/a/25958050
has answer: http://stackoverflow.com/a/25958700
has comment: http://stackoverflow.com/comment/40640736
has comment: http://stackoverflow.com/comment/40640817

http://stackoverflow.com/comment/40704046
comment on: http://stackoverflow.com/q/25992304
has text: Or you can simply append current system seconds and convert it to double
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/25898612
tagged with: android-studio
answer count: 0
score: 0
type: Question
has title: how can i pass byte array to asyncTask?
has body: Android Studio throws this error when I use byte[] ERROR: expected parameters: byte[] actual parameters: byte[][] and this error when I pass byte: "type argument cant be of primitive type" class PrintOrderTaskSTARIO extends AsyncTask&lt;byte[], Void, Void&gt; { ...... @Override protected Void doInBackground(byte[]... print) { String portName = ""; String portSettings = "9100"; StarIOPort port = null; System.out.println("2"); //TRY TO PRINT.... try { port = StarIOPort.getPort("tcp:10.1.10.18", "9100", 10000); //Start checking the completion of printing port.writePort(print, 0, print.length);
tagged with: java
has comment: http://stackoverflow.com/comment/40535540
tagged with: android-asynctask
linked to: http://stackoverflow.com/q/2367398
has comment: http://stackoverflow.com/comment/40534812
tagged with: byte
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40534821
duplicate of: http://stackoverflow.com/q/2367398

http://stackoverflow.com/comment/40632255
type: Comment
has text: it does work, but it takes very very long, so I still don't think it's O(n) unfortunately :(
type: AnswerComment
comment on: http://stackoverflow.com/a/25953149
score: 0

http://stackoverflow.com/a/26095162
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25934498
type: AcceptedAnswer
downvote count: 0
has body: Eventualy I end up with generic converter that works fine for me. @FacesConverter(value = "generalCollDTOConverter", forClass = GeneralCollDTOConverter.class) public class GeneralCollDTOConverter implements Converter { private static Map&lt;Object, String&gt; entities = new HashMap&lt;Object, String&gt;(); @Override public String getAsString(FacesContext context, UIComponent component, Object value) { synchronized (entities) { if (!entities.containsKey(value)) { String uuid = UUID.randomUUID().toString(); entities.put(value, uuid); return uuid; } else { return entities.get(value); } } } @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { for (Entry&lt;Object, String&gt; entry : entities.entrySet()) { if (entry.getValue().equals(value)) { System.out.println("getKey:" + entry.getKey()); return entry.getKey(); } } return value; } }
type: Answer
answers question: http://stackoverflow.com/q/25934498
score: 1

http://stackoverflow.com/comment/40622456
has text: Yes, that's what [WeakReference](http://docs.oracle.com/javase/7/docs/api/java/lang/ref/WeakReference.html) is for.
score: 0
comment on: http://stackoverflow.com/q/25947357
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40773320
score: 0
type: Comment
has text: @CodeRo update your question with code and xml please.
comment on: http://stackoverflow.com/a/26010285
type: AnswerComment

http://stackoverflow.com/comment/40728216
comment on: http://stackoverflow.com/a/26005536
score: 0
has text: Your code can help me get started. Please some code so I can understand better what you suggests.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40690944
score: 0
has text: @KickButtowski Simply trusting someone on reputation alone is *not* the way to go on this site. The choice of where to declare is partially a matter of opinion. While any choice obviously needs to fall within the rules specified by the [JLS](http://docs.oracle.com/javase/specs/jls/se8/html/), multiple choices *do* exist, and I do acknowledge that. However, drawing upon my experience and personal opinion, I feel that adding an initialization in the else block makes the most sense from a code-style and semantic standpoint.
type: Comment
comment on: http://stackoverflow.com/a/25984949
type: AnswerComment

http://stackoverflow.com/a/25997860
has body: Using Jackson, it is possible to use @JsonIgnoreProperties annotation, but I prefer to follow standards. Java EE 7 (JSR-342) As of Java EE 7 there isn't a standard JSON-Binding API. However you can use JAX-RS with the Java API for JSON Processing (see: JSR-353) https://blogs.oracle.com/arungupta/entry/consuming_and_producing_json_using Java EE 8 (JSR-366) A standard JSON-binding API will be developed as part of Java EE 8 (see: JSR-367). Java EE 8 will also include an updated JAX-RS specification (see: JSR-370) that will leverage JSR-367.
type: Answer
answers question: http://stackoverflow.com/q/25962753
score: 5
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25962753
type: AcceptedAnswer

http://stackoverflow.com/comment/117974954
type: AnswerComment
has text: I have my overview.html file in my src directory. When I use the -overview flag, Eclipse tells me JavaDoc: error - illegal package name: <path to file is here>?
type: Comment
comment on: http://stackoverflow.com/a/25947999
score: 0

tomcat5.5
tags question: http://stackoverflow.com/q/25931170
tag name: tomcat5.5
tags question: http://stackoverflow.com/q/25961640
type: Tag

http://stackoverflow.com/q/25980652
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25980752
has comment: http://stackoverflow.com/comment/40682816
accepted answer: http://stackoverflow.com/a/25980752
tagged with: java
has comment: http://stackoverflow.com/comment/40682436
downvote count: 0
answer count: 1
favorite count: 0
has body: public static void main(String [] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the month (1-12):"); int month = input.nextInt(); System.out.print("Enter the day (1-31):"); int day = input.nextInt(); System.out.print("Enter the year (ex. 2014):"); int year = input.nextInt(); if (month == 1) month = 13; else if (month == 2) month = 14; int Zeller = day + ((26 * (month + 1)) / 10) + year + (year / 4) + (6 * (year / 100)) + (year / 400); int dayofweek = (Zeller + 5) % 7 + 1; if (dayofweek == 1) System.out.print("Day of the week: Monday"); else if (dayofweek == 2) System.out.print("Day of the week: Tuesday"); else if (dayofweek == 3) System.out.print("Day of the week: Wednesday"); else if (dayofweek == 4) System.out.print("Day of the week: Thursday"); else if (dayofweek == 5) System.out.print("Day of the week: Friday"); else if (dayofweek == 6) System.out.print("Day of the week: Saturday"); else if (dayofweek == 7) System.out.print("Day of the week: Sunday"); } The code wont calculate the dates in Jan and Feb correctly. It is always a day or two off. For example: If I enter Jan 1, 2010 the code should output Day of the week: Friday, but instead, its saying its Day of the week: Saturday. I've checked my calculations couldn't find any error.
has title: error with zeller's congruence code
has comment: http://stackoverflow.com/comment/40682577
upvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/40682684

http://stackoverflow.com/q/25997950
type: Question
has comment: http://stackoverflow.com/comment/40714131
tagged with: c#
has comment: http://stackoverflow.com/comment/40713996
has body: I've some piece of code related to Exception Handing for both c# and java. As I've read in C# that finally block will not be executed when there's a StackOverflowException occurs since there's no room on the stack to even execute any more code and It will also not be called when there's an ExecutionEngineException occurs, which may arise from a call to Environment.FailFast(). In my below code(C#) I intentionally generate StackOverflowException : class overflow1 { public void disp() { try { Console.WriteLine("disp"); disp(); } catch(Exception e) { Console.WriteLine(e); Console.WriteLine("catch"); } finally { Console.WriteLine("finalyyy"); } } } class ExceptionHandling { static void Main() { overflow1 s = new overflow1(); s.disp(); Console.Read(); } } Output: disp disp disp . . . Process is terminated due to StackOverFlowException As I stated if StackOverflowException occurs since there's no room on the stack to even execute any more code of finally block. Even though catch block's methods also not called perhaps due to the same reason( no more space left into stack). Now I've tried this above same code in java : public class ExceptionHandlingTest { static int count1 = 0 ,count2=0; static void disp() { try{ System.out.println("disp"+(++count1)); disp(); }catch(StackOverflowError e){ System.out.println(e); System.out.println("catch"); System.exit(0); }finally{ System.out.println("handle"+(--count1)); } } public static void main(String... args) { disp(); } } Output: disp1 disp2 . . . disp2456 handle2455 handle2454 . . Exception in thread "main" java.lang.StackOverflowError . . handle2 handle1 handle0 Edit: Indeed my question is that behavior of code should be work same in both the languages because if all stack space filled then how in java JVM found more space to call finally block's methods ? Thanks.
answer count: 1
tagged with: stack-overflow
favorite count: 0
tagged with: exception
linked to: http://stackoverflow.com/q/111597
has comment: http://stackoverflow.com/comment/40714645
has comment: http://stackoverflow.com/comment/40714618
has comment: http://stackoverflow.com/comment/40713992
has comment: http://stackoverflow.com/comment/40713917
has title: Query related to Exception handling
has comment: http://stackoverflow.com/comment/40714214
has comment: http://stackoverflow.com/comment/40714397
has comment: http://stackoverflow.com/comment/40714219
has comment: http://stackoverflow.com/comment/40714429
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40714348
downvote count: 2
has answer: http://stackoverflow.com/a/25998328
has comment: http://stackoverflow.com/comment/40714189
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40714484

http://stackoverflow.com/comment/40807267
has text: Wish I could give this answer more than just a +1. I _need_ java.text.Normalizer in an application that I am working on right now, and I did not know it!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26039424

http://stackoverflow.com/comment/40699711
type: QuestionComment
type: Comment
has text: Refactor the 90% same code to a method and call it in the for loop?
comment on: http://stackoverflow.com/q/25990075
score: 3

http://stackoverflow.com/q/25951175
answer count: 3
has answer: http://stackoverflow.com/a/27298905
downvote count: 0
has body: I am trying to deploy my JAVA EE7 application. I have EntityManagerProducer as import javax.ejb.Singleton; import javax.ejb.Startup; import javax.enterprise.inject.Produces; import javax.persistence.EntityManager; import javax.persistence.PersistenceUnit; @Startup @Singleton public class PersistenceEntityManagerProducer { @PersistenceUnit(unitName = "earth") private EntityManager entityManager; @Produces @PersistenceEntityManager public EntityManager getEntityManager() { return entityManager; } } and my CrudService as import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.inject.Inject; import javax.persistence.EntityManager; @Stateless @TransactionAttribute(TransactionAttributeType.REQUIRED) public class CrudService { private EntityManager entityManager; @SuppressWarnings("UnusedDeclaration") public CrudService() { } @Inject public CrudService(@PersistenceEntityManager @Nonnull final EntityManager entityManager) { this.entityManager = entityManager; } @SuppressWarnings("UnusedDeclaration") @Nonnull public EntityManager getEntityManager() { return entityManager; } @Nonnull public <T> T create(@Nonnull final T entity) { entityManager.persist(entity); entityManager.flush(); entityManager.refresh(entity); return entity; } @Nullable public <T> T find(final long id, final Class<T> classType) { return entityManager.find(classType, id); } public <T> void delete(@Nonnull final T entity) { entityManager.remove(entity); } } My persistence.xml looks like <?xml version="1.0" encoding="UTF-8"?> org.hibernate.jpa.HibernatePersistenceProvider java:app/env/EarthDS <property name="hibernate.archive.autodetection" value="class"/> <property name="hibernate.id.new_generator_mappings" value="true"/> <property name="javax.persistence.lock.timeout" value="5000"/> I try to deploy my application using maven-cargo-plugin and pom.xml looks like <?xml version="…
favorite count: 0
score: 4
type: UnansweredQuestion
tagged with: java
tagged with: maven
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26182574
has title: __FIRST_PHASE__ is missing [jboss.naming.context.java.app.earth.env.EarthDS]"]}?
tagged with: jboss
has answer: http://stackoverflow.com/a/25964169
type: Question
upvote count: 4

http://stackoverflow.com/comment/40566287
type: QuestionComment
comment on: http://stackoverflow.com/q/25914657
score: 0
has text: I've had better luck in InteliJ when used `mvn eclipse:eclipse` to generate a maven project and then import that instead of the Eclipse project files.
type: Comment

http://stackoverflow.com/comment/40751207
comment on: http://stackoverflow.com/q/26018045
type: Comment
type: QuestionComment
score: 0
has text: I should have added, I'm actually just using JUnit as a convenient API, but the purpose is not Unit tests really

http://stackoverflow.com/a/25989950
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25989823
has body: A Map provides you with the interface of storing and retrieving objects into a map with a key attached to them. What each implementation does internally is fully up to it, including in which order the key/value pairs are stored in the internal structure. See @Seshoumaro's answer for the quote from the javadoc. HashMap hashes the key (which is an Integer in this case) and uses that hash as an array index. Since the hashCode for Integer is fairly simple to write yourself, it's not surprising that the array indices for each one are in the same order as the key itself. What all that means is: you shouldnt be surprised that the HashMap is acting this way.

http://stackoverflow.com/comment/40729068
type: Comment
comment on: http://stackoverflow.com/q/26006026
type: QuestionComment
has text: Here's how you start: public class HugeInteger. Please, this question demonstrates no knowledge of Java whatsoever, and doesn't state a specific problem. Please consult the Stack Overflow [help file](http://stackoverflow.com/help) for guidance on what you can and cannot ask about on this site.
score: 0

http://stackoverflow.com/comment/40554542
comment on: http://stackoverflow.com/a/25892426
type: AnswerComment
has text: @Avi can you tell us which the problem was (by answering your own question, or just in comment) ?
type: Comment
score: 1

http://stackoverflow.com/comment/40519518
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25889624
has text: @Ramakrishna, Please ensure you add the latest version of the implementation jar, as suggested.
type: AnswerComment

http://stackoverflow.com/a/26049301
downvote count: 0
type: Answer
has body: (Reposting original comment as an answer, since it seems to have fixed the issue). The classes12.zip JDBC driver that you're using to connect to Oracle is very old, and was intended for Java 1.2 clients. It's possible that either Spring or Commons DBCP relies on a more modern JDBC version to work, so you should use the more modern odbc6.jar or ojdbc7.jar (for Java 6 and 7, respectively, although that association is somewhat loose and they're largely interchangeable) instead.
accepted answer of: http://stackoverflow.com/q/26023970
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26023970
has comment: http://stackoverflow.com/comment/40831998
type: AcceptedAnswer

http://stackoverflow.com/q/25875928
downvote count: 4
has comment: http://stackoverflow.com/comment/40493811
has title: Java GUI based on Fields in class
tagged with: user-interface
has answer: http://stackoverflow.com/a/25876262
has comment: http://stackoverflow.com/comment/40494211
has comment: http://stackoverflow.com/comment/40494269
favorite count: 0
has comment: http://stackoverflow.com/comment/40493889
type: UnansweredQuestion
score: -4
tagged with: java
type: Question
upvote count: 0
answer count: 1
has body: I need to generate GUI in Java at runtime based on class fields. I'm working on web service so I need to dynamically generate GUI at client side. For example, if I have a class on my web service that has the fields String name, int number and ArrayList&lt;&gt; list, I need to generate a GUI that will have 2 JTextFields and one JList. Is there any API or something else that can help me to do this?

http://stackoverflow.com/comment/40633795
has text: Thanks for putting so much effort for my question, I really appreciate it. Im going to do some research on recursive descent parsing, hoping I will learn more than I already know and hopefully write a proper parser for JSON. My goal here is with my current project to do everything from scratch, and not using libraries. You may call it reinventing the wheel, but I call it learning. You learn to code by doing it. Thanks again @5gon12eder
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25953311

http://stackoverflow.com/q/25912037
tagged with: java
has comment: http://stackoverflow.com/comment/40614665
linked to: http://stackoverflow.com/q/8215781
type: Question
has comment: http://stackoverflow.com/comment/40634312
upvote count: 1
linked to: http://stackoverflow.com/q/9885241
has title: How to run SPEC with JOMP?
has comment: http://stackoverflow.com/comment/40631162
tagged with: specifications
has body: I use SPEC as a tool to measure java files running time. I'm using SPEC2008 which can be downloaded here. I installed spec2008 (java -jar SPECjvm2008_1_01_setup.jar) and ran it (java -jar SPECjvm2008.jar as written in the README file). I got a results file and a report that everything completed successfully. Now i need to examine how some changes affect SPEC's running time. I made the changes in some of SPEC'S files (the java files inside the following folders: compiler,compress,crypto,derby). Now i can't run it again using java -jar SPECjvm2008.jar because the changes i made include jomp commands (\\omp parallel for and such). [JOMP is OpenMP for JAVA] To compile files with such commands i used to do the following: First, download JOMP. Then: change .java extension to .jomp . Then type: java jomp.compiler.Jomp MyFile (now i got a .java file) compile to .class: javac -classpath YourJompDownloadPath\jomp1.0b.jar; MyFile.java java -Djomp.threads=n MyPackage.MyFile So i can't do this now because: There are too many files and it would take time changing all extensions to .jomp There are too many files and i need to run all of them as a whole (just as SPEC does), but in JOMP commands i only know how to run each file independently. If there's a workaround for #2 then i'll do #1 manually. So i'm especially looking for a solution/workaround for #2. edit: OK so i made a .BAT file only for step 1 (see method here) because it seems that SPEC has only .java files so i'll provide it with .java files only. For the 2nd step i think i need to just run SPEC (java -jar SPECjvm2008.jar). For the 3rd step, i think instead of normally running SPEC, i need to run it with the parameters in step 3 (Djomp.threads). That is: java -Djomp.threads=n -jar SPECjvm2008.jar Now there's a new problem. I get the warning: Recompile with -Xlint:unchecked for details Which was addressed here. But in that link it's run with javac and not java. javac doesn't recognize the parameter Djomp.threads (and java…
favorite count: 0
linked to: http://stackoverflow.com/q/197986
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/40564539
type: UnansweredQuestion
tagged with: openmp
has comment: http://stackoverflow.com/comment/40578190
score: 1

http://stackoverflow.com/q/25905368
has comment: http://stackoverflow.com/comment/40548846
has comment: http://stackoverflow.com/comment/40549535
has comment: http://stackoverflow.com/comment/40547928
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25907644
tagged with: java
has comment: http://stackoverflow.com/comment/40546962
has comment: http://stackoverflow.com/comment/40548725
has title: Why cant we statically load the sql Driver class in connecting to mysql through jdbc?
type: Question
answer count: 1
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/40547773
tagged with: sql
linked to: http://stackoverflow.com/q/5484227
has body: I know that in order to connect java code to mysql we have to load com.mysql.jdbc.Driver by any one of the folllowing options we have(i am not sure about all of them) :- Class.forName("com.mysql.jdbc.Driver"); OR Class.forName("com.mysql.jdbc.Driver").newInstance(); OR System.setProperty("jdbc.drivers","com.mysql.jdbc.Driver"); OR //through command prompt java -Djdbc.drivers=com.mysql.jdbc.Driver ProgramName Or DriverManager.registerDriver("com.mysql.jdbc.Driver"); My Questions :- First Question- I want to confirm that are all of the above methods legal to load the driver class. Second Question:- The second method that we have, i.e. Class.forName("com.mysql.jdbc.Driver").newInstance(); is same as doing object creation by using new keyword. For eg. new com.mysql.jdbc.Driver(); I have tried through this and it works. So, why can't we use the second approach? Is there any disadvantage of using it.? I think i have made my both questions clear , if not, please comment, i will edit it.
tagged with: jdbc
has answer: http://stackoverflow.com/a/25907644
has comment: http://stackoverflow.com/comment/40550843
has comment: http://stackoverflow.com/comment/40547824

http://stackoverflow.com/comment/40683963
has text: Basically `@Override` is suggesting the class is overriding all or part of the base classes behavior. Considering the behavior doesn't change for those classes, no need to do it. *Anytime* you have repetitious code warrants an investigation.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25981283

http://stackoverflow.com/q/25877459
answer count: 1
has title: Performing stop of activity that is not resumed
tagged with: android-activity
favorite count: 0
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
downvote count: 0
score: 1
tagged with: java
tagged with: paypal
has body: I unexpectedly ran into the following issues: Performing stop of activity that is not resumed. I am essentially working on integrating the paypal SDK into the application. In particular, I believe the error derives from the following attempt: I was trying to generate the price and the item name from the information that have been stored in Parse.com private PayPalPayment getThingToBuy(String paymentIntent) { return new PayPalPayment(new BigDecimal("mActivityPrice"), "USD", "mActivityName", paymentIntent); } where mActivityPrice, and mActivityName comes from String mActivityPrice = ParseUser.getCurrentUser().getString("ActivityPrice"); String mActivityName = ParseUser.getCurrentUser().getString("ActivityName"); Log cat message: 09-16 19:47:52.494: E/ActivityThread(1679): Performing stop of activity that is not resumed: {com.paypal.example.paypalandroidsdkexample/com.paypal.android.sdk.payments.PaymentMethodActivity} 09-16 19:47:52.494: E/ActivityThread(1679): java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.paypal.example.paypalandroidsdkexample/com.paypal.android.sdk.payments.PaymentMethodActivity} 09-16 19:47:52.494: E/ActivityThread(1679): at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3147) 09-16 19:47:52.494: E/ActivityThread(1679): at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3234) 09-16 19:47:52.494: E/ActivityThread(1679): at android.app.ActivityThread.access$1100(ActivityThread.java:135) 09-16 19:47:52.494: E/ActivityThread(1679): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1223) 09-16 19:47:52.494: E/ActivityThread(1679): at android.os.Handler.dispatchMessage(Handler.java:102) 09-16 19:47:52.494: E/ActivityThread(1679): at android.os.Looper.loop(Looper.java:136) 09-16 19:47:52.494: E/ActivityThread(1679): at android.app.ActivityThread.main(ActivityThread.java:5017) 09-16 19:47:52.494: E/ActivityThread(1679): at java.lang.reflect.Method.invokeNative(Nat…
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/25893830

http://stackoverflow.com/q/25963720
has comment: http://stackoverflow.com/comment/102927668
has answer: http://stackoverflow.com/a/25963764
has answer: http://stackoverflow.com/a/25963771
linked to: http://stackoverflow.com/q/14125038
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14697927
upvote count: 31
tagged with: java
linked to: http://stackoverflow.com/q/10609596
has answer: http://stackoverflow.com/a/25963807
tagged with: calendar
downvote count: 1
has comment: http://stackoverflow.com/comment/40654946
type: Question
answer count: 8
accepted answer: http://stackoverflow.com/a/25963764
has answer: http://stackoverflow.com/a/32331012
has answer: http://stackoverflow.com/a/32269006
has comment: http://stackoverflow.com/comment/40651621
has body: I have two dates in String format like below - String startDate = "2014/09/12 00:00"; String endDate = "2014/09/13 00:00"; I want to make sure startDate should be less than endDate. startDate should not be greater than endDate. How can I compare these two dates and return boolean accordingly?
tagged with: date
has title: How to compare two string dates in Java?
has answer: http://stackoverflow.com/a/58281016
has comment: http://stackoverflow.com/comment/101017611
has answer: http://stackoverflow.com/a/25963783
tagged with: string
possible better answer: http://stackoverflow.com/a/58281016
score: 30
favorite count: 0
has comment: http://stackoverflow.com/comment/40651644
linked to: http://stackoverflow.com/q/6334427
has answer: http://stackoverflow.com/a/25963778

file-transfer
tags question: http://stackoverflow.com/q/25896841
tag name: file-transfer
type: Tag
tags question: http://stackoverflow.com/q/25961104

http://stackoverflow.com/q/25875862
has title: Android NullPointerException when using setDataSource with a URI
tagged with: android
possible better answer: http://stackoverflow.com/a/25876199
has comment: http://stackoverflow.com/comment/40493929
accepted answer: http://stackoverflow.com/a/25876001
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/25876001
has body: Hey guys I'm making a music player for android and when I go to select a song to play the app crashes and produces the error: 09-16 13:10:08.671: I/System.out(22932): Reset worked 09-16 13:10:08.671: I/System.out(22932): com.example.taptwisttunes.Song@42d97240 09-16 13:10:08.671: I/System.out(22932): about to load song 09-16 13:10:08.671: I/System.out(22932): content://media/external/audio/media/23657 09-16 13:10:08.671: I/System.out(22932): content://media/external/audio/media/23657 09-16 13:10:08.671: D/AndroidRuntime(22932): Shutting down VM 09-16 13:10:08.671: W/dalvikvm(22932): threadid=1: thread exiting with uncaught exception (group=0x41fee700) 09-16 13:10:08.676: E/AndroidRuntime(22932): FATAL EXCEPTION: main 09-16 13:10:08.676: E/AndroidRuntime(22932): java.lang.IllegalStateException: Could not execute method of the activity Here is my playSong method does anyone have any idea what I'm doing wrong: public void playSong(){ //this method plays the song by retrieving ID and modeling it as uri //player.reset(); //resets media player System.out.println("Reset worked"); Song playSong = songs.get(sPos); // retrieves song to be played System.out.println(playSong); long currSong = playSong.getId(); System.out.println("about to load song"); Uri trackUri = ContentUris.withAppendedId(android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, currSong); System.out.println(trackUri); System.out.println(trackUri.toString()); //try block not sure if uri will work as a data source try{ player.setDataSource(this.getApplicationContext(), trackUri); } catch(Exception e){ Log.e("Music Service", "There has been an error setting the data source", e); } player.prepareAsync(); }
has answer: http://stackoverflow.com/a/25876199

http://stackoverflow.com/comment/40541155
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25892405
score: 0
has text: possible duplicate of [sample example which explain how to use filesystem resolver](http://stackoverflow.com/questions/10175000/sample-example-which-explain-how-to-use-filesystem-resolver)

http://stackoverflow.com/comment/40495044
score: 0
type: AnswerComment
type: Comment
has text: Is `List1` supposed to be the id of my list view?
comment on: http://stackoverflow.com/a/25874573

http://stackoverflow.com/a/25888116
has comment: http://stackoverflow.com/comment/97223441
has comment: http://stackoverflow.com/comment/89520348
accepted answer of: http://stackoverflow.com/q/25888023
has body: Or easier, add this to your pom's properties section: &lt;properties&gt; &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt; &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt; &lt;/properties&gt;
answers question: http://stackoverflow.com/q/25888023
has comment: http://stackoverflow.com/comment/89890611
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/102793092
upvote count: 136
type: Answer
score: 132
has comment: http://stackoverflow.com/comment/81246316
downvote count: 4

http://stackoverflow.com/comment/40559880
type: Comment
type: QuestionComment
has text: What's the exception you're getting?
score: 0
comment on: http://stackoverflow.com/q/25912550

http://stackoverflow.com/q/25961909
has title: Arraylist of an Object inside that object
has comment: http://stackoverflow.com/comment/40648634
has comment: http://stackoverflow.com/comment/40648383
type: Question
answer count: 2
has body: Suppose I use code that looks like this: public class MyObject { private int id; private ArrayList&lt;MyObject&gt; otherObjects; public MyObject(int id) { this.id = id; ArrayList&lt;MyObject&gt; otherObjects = new ArrayList&lt;MyObject&gt;(); otherObjects.add(new MyObject(id + 1)); this.otherObjects = otherObjects; } public int getId() { return id; } public void setId(int id) { this.id = id; } public ArrayList&lt;MyObject&gt; getOtherObjects() { return otherObjects; } public void setOtherObjects(ArrayList&lt;MyObject&gt; otherObjects) { this.otherObjects = otherObjects; } } What pitfalls should I be aware of? My other concern is that if I could make this class Parcellable?
has comment: http://stackoverflow.com/comment/40648180
has comment: http://stackoverflow.com/comment/40648359
has comment: http://stackoverflow.com/comment/40648721
has answer: http://stackoverflow.com/a/25962079
has comment: http://stackoverflow.com/comment/40648281
has answer: http://stackoverflow.com/a/25961947
upvote count: 1
has comment: http://stackoverflow.com/comment/40648509
has comment: http://stackoverflow.com/comment/40648532
favorite count: 0
has comment: http://stackoverflow.com/comment/40648323
has comment: http://stackoverflow.com/comment/40648235
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40648360
has comment: http://stackoverflow.com/comment/40648429
has comment: http://stackoverflow.com/comment/40648691
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/40670168
has text: That doesn't sound right. Can you post the stack trace associated with the ArrayIndexOutOfBoundsException? The whole thing isn't necessary but show enough frames to get back to the line of code in your service.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25967846

http://stackoverflow.com/a/25904162
downvote count: 0
has comment: http://stackoverflow.com/comment/40581405
has comment: http://stackoverflow.com/comment/40614553
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/25902804
answers question: http://stackoverflow.com/q/25902804
has comment: http://stackoverflow.com/comment/40585228
score: 8
has body: It looks like you have two instances of the springSecurityFilterChain defined: Once in SecurityConfig.java, and once in spring-security.xml. You only need one of those files. The filter line in web.xml tells the servlet engine (Tomcat) to load that filter, but the instance of that filter is configured in the Spring context. The problem is the Spring context can't start, because you have two configurations for the springSecurityFilterChain. Take one out, and you will be making progress. Your configuration in the XML file seems more comprehensive and fine-grained, but I would recommend moving that configuration to the Java file and eliminating the XML file. Once you remove your duplicate configuration, you may still have errors, but you should be able to find a solution to those on this site, or feel free to post a separate question! Note: It is also possible to get Spring to automatically register the filter chain for you, so you don't need to define it in web.xml. See here for how to do that: http://www.mkyong.com/spring-security/spring-security-hello-world-annotation-example/ However, I would recommend getting the current config working first, before throwing that in the mix.
has comment: http://stackoverflow.com/comment/40568494
type: AcceptedAnswer

http://stackoverflow.com/a/78621336
answers question: http://stackoverflow.com/q/25886806
score: 0
type: Answer
has body: I have been searching for a very similar situation where some, not all, requests from a Geoserver backend service was returned as 500 Internal Server Error and the Geoserver has been working flawlessly in the passed. HAProxy logged this as PH-- in its log. Geoserver had nothing in its logs. For me it turned out that my over eager use of headers for debug purpose was the culprit and after reducing/removing the majority of them the problem stopped. HAProxy documentation only states that it returns PH-- when the backend HTTP response doesn't comply to standards which is clearly wrong. It also does this when the buffer is overrun or exhausted. Maybe with the difference in HTTP status code 500 instead of 502. An alternative solution could be to add a larger value to tune.bufsize, tune.h2.header-table-size and/or tune.http.maxhdr in the global section of your config file. In my case the error disappeared when changing only tune.bufsize value like this (with all the over eager headers still in place): global tune.bufsize 65536 # default 16384 However I kept the default and removed all unnecessary headers instead. The HAProxy configuration manual states: HAProxy may emit the following status codes by itself : Code When / reason : (removed for clarity) 500 when HAProxy encounters an unrecoverable internal error, such as a memory allocation failure, which should never happen But it does, you can argue that it is when used wrong but still. I would have wanted a more elaborated documentation.

http://stackoverflow.com/q/25941795
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25959105
answer count: 1
has title: Java JPA CriteriaBuilder OR Expression does not work correctly
tagged with: jpa
type: UnansweredQuestion
has body: This is my method: CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery&lt;EmployersList&gt; criteriaQuery = builder.createQuery(EmployersList.class); Root&lt;EmployersList&gt; root = criteriaQuery.from(EmployersList.class); Expression&lt;String&gt; orgPhoneNumberExp = root.get("orgphoneNumber"); Predicate orgPhoneNumberPredicate = orgPhoneNumberExp.in(phoneNumber); Expression&lt;String&gt; accPhoneNumberExp = root.get("accphoneNumber"); Predicate accPhoneNumberPredicate = accPhoneNumberExp.in(phoneNumber); Expression&lt;String&gt; orgStatusExp = root.get("orgphoneStatus"); Predicate orgStatusExpPredicate = builder.upper(orgStatusExp).in("SUSPECT", "FRAUD", "NEGATIVE"); Expression&lt;String&gt; accPhoneStatusExp = root.get("accphoneStatus"); Predicate accPhoneStatuPredicate = builder.upper(accPhoneStatusExp).in("SUSPECT", "FRAUD", "NEGATIVE"); Expression&lt;Date&gt; orgPhoneStatusExpDateExmp = root.get("orgphoneStatusExpdate"); Expression&lt;Date&gt; accPhoneStatusExpDateExmp = root.get("accphoneStatusExpdate"); Predicate orgPhoneStatusExpDatePredicate = builder.or(builder.greaterThanOrEqualTo(orgPhoneStatusExpDateExmp, new Date()), builder.isNull(orgPhoneStatusExpDateExmp)); Predicate accPhoneStatusExpDatePredicate = builder.or(builder.greaterThanOrEqualTo(accPhoneStatusExpDateExmp, new Date()), builder.isNull(accPhoneStatusExpDateExmp)); Expression&lt;Boolean&gt; orgExp = builder.and(orgPhoneNumberPredicate, builder.and(orgStatusExpPredicate, orgPhoneStatusExpDatePredicate)).as(Boolean.class); Expression&lt;Boolean&gt; accExp = builder.and(accPhoneNumberPredicate, builder.and(accPhoneStatuPredicate, accPhoneStatusExpDatePredicate)).as(Boolean.class); criteriaQuery.where(builder.or(orgExp, accExp)); List&lt;EmployersList&gt; result = entityManager.createQuery(criteriaQuery).getResultList(); So, i need check 'org' Phones and 'acc' Phones in DB. I need check...(if orgphoneNumber IN(list of phone numbers which i will get in method parametr) and …
type: Question
tagged with: expression

http://stackoverflow.com/q/25989280
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26016984
has comment: http://stackoverflow.com/comment/40705974
has title: How to use NanoHTTPD to show log file
accepted answer: http://stackoverflow.com/a/26135879
tagged with: ajax
tagged with: nanohttpd
has comment: http://stackoverflow.com/comment/40700727
tagged with: logging
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26135879
type: Question
has body: I have written a java desktop application that accepts http requests using embedded NanoHTTPD web server https://github.com/NanoHttpd/nanohttpd, after receiving http request my desktop application makes some activity and keeps writing to log text file while executing its job, currently client opening the web page has to wait until the whole job is finished and the whole page is sent and log file is viewed, I would like the log data to be sent to client as soon as they are added to the local log file , I know this is done using ajax but I don't have time to learn it yet, simply how to make updates to some object in java reflect directly to the web page without need to send the whole page. import java.util.ArrayList; import java.util.LinkedList; import java.util.Map; import common.Logging; import common.TextFiles; import fi.iki.elonen.NanoHTTPD; import fi.iki.elonen.ServerRunner; import fi.iki.elonen.SimpleWebServer; public class TestServer extends NanoHTTPD { static boolean isDoingAJob=false; public TestServer() { super(8080); } @Override public Response serve(IHTTPSession session) { Method method = session.getMethod(); Map<String,String> params = session.getParms(); String uri = session.getUri(); System.out.println(method + " '" + uri + "' "); String msg = " Remote Test Service "; Map<String, String> parms = session.getParms(); for(String paramKey:parms.keySet()){ String job=params.get(paramKey); msg+="Status: "+(isDoingAJob?"Waited in queue.":"Immediate run."); if ("tcl".equalsIgnoreCase(paramKey)){ try { //if another request is being executed wait until finished while(isDoingAJob){ Thread.sleep(3000); } //Raise a flag while executing a test run isDoingAJob=true; SomeJobClass.doSomeWork(job.split(" ")); isDoingAJob=false; ArrayList<String> lines=TextFiles.load(Logging.getLogFile().toString()); for(String line: lines){ msg+=" "+line+" "; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else{ //echo help if parameter key is not tc…
tagged with: javascript
possible better answer: http://stackoverflow.com/a/26016984

http://stackoverflow.com/q/25960146
type: Question
tagged with: ebean
has body: I have the following four models: Compatibility: @Entity public class Compatibility extends Model { @Id public long id; @ManyToOne public Attribute attr1; @ManyToOne public Attribute attr2; public static Finder&lt;Long, Compatibility&gt; find = new Finder&lt;Long, Compatibility&gt;( Long.class, Compatibility.class); } Attribute: @Entity public class Attribute extends Model { @Id public long id; public String userId; @ManyToOne public Parameter parameter; public static Finder&lt;Long, Attribute&gt; find = new Finder&lt;Long, Attribute&gt;( Long.class, Attribute.class); } Parameter: @Entity public class Parameter extends Model { @Id public long id; @ManyToOne public Problem problem; public List&lt;Attribute&gt; attributes = new ArrayList&lt;Attribute&gt;(); public static Finder&lt;Long, Parameter&gt; find = new Finder&lt;Long, Parameter&gt;( Long.class, Parameter.class); } Problem: @Entity public class Problem extends Model { @Id public long id; @OneToMany(cascade = CascadeType.ALL) public List&lt;Parameter&gt; parameters = new ArrayList&lt;Parameter&gt;(); public static Finder&lt;Long, Problem&gt; find = new Finder&lt;Long, Problem&gt;( Long.class, Problem.class); } Using Ebean, I'm trying to filter all compatibilities depending on which problem they belong to using this Java Code: List&lt;Compatibility&gt; cs = Ebean.find(Compatibility.class) .fetch("attribute").fetch("parameter").fetch("problem").where() .eq("problem.id", problemId).findList(); Yet I'm causing this error: [RuntimeException: Error getting BeanDescriptor for path problem from models.Compatibility] My guess is that the mapping across several tables is not working. Is there any way I can get this done? A manual query perhaps?
has title: Play 2.2.2 with Ebean - Error getting Bean Descriptor when Querying OneToMany
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion
tagged with: playframework
has answer: http://stackoverflow.com/a/25969415
tagged with: postgresql

http://stackoverflow.com/a/26012180
type: Answer
answers question: http://stackoverflow.com/q/25915812
score: 0
type: AcceptedAnswer
has body: Issue solved. I finally understood that i have to set the class path relativ to destination jar file, not relative to build.xml. So i have to add ../../ in front of the class path. &lt;manifest&gt; &lt;attribute name="Main-Class" value="ant.Debug"/&gt; &lt;attribute name="Class-Path" value="../..lib/my.package.util.jar"/&gt; &lt;/manifest&gt;
accepted answer of: http://stackoverflow.com/q/25915812

http://stackoverflow.com/a/26006491
downvote count: 0
answers question: http://stackoverflow.com/q/25888953
type: Answer
score: 2
upvote count: 2
has body: You can store graphs in a relational database as nodes and edges. One table contains a list of nodes, the other table contains the list of edges. If the graph is weighted, each edge has a weight column as well. In the example below a simple graph with 4 nodes and 4 edges is defined. If the graph is directed, then each edge is directed from the node in the first column to the node in the second column. NODES_TABLE node1 node2 node3 node4 ... EDGES_TABLE node1,node2 node2,node3 node3,node4 node4,node1 ...
has comment: http://stackoverflow.com/comment/41337870

http://stackoverflow.com/q/25915298
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
tagged with: opencv
score: 1
tagged with: java
tagged with: image-processing
downvote count: 1
type: Question
has title: How to detect contours width and height in android opencv
has answer: http://stackoverflow.com/a/37940274
has body: i created contours and draw a rectangle. now need to detect my rectangle width and height how do do it? ArrayList&lt;MatOfPoint&gt; contours = new ArrayList&lt;MatOfPoint&gt;(); Imgproc.findContours(ImageMatout, contours, new Mat(), Imgproc.RETR_EXTERNAL,Imgproc.CHAIN_APPROX_NONE); Core.rectangle(ImageMatin, rect.tl(), rect.br(), new Scalar(255, 0, 0),2); //double h = ?? //double w = ??
has comment: http://stackoverflow.com/comment/40567004

http://stackoverflow.com/a/25920498
has comment: http://stackoverflow.com/comment/40575274
has comment: http://stackoverflow.com/comment/40580437
type: Answer
has body: It's detailed right here in the Java spec! http://docs.oracle.com/javase/6/docs/platform/serialization/spec/class.html#4100 Does anybody know if it's different based on different implementations/utilities? (Such as via ObjectStreamClass.lookup vs. serialver utility?)
has comment: http://stackoverflow.com/comment/40678893
has comment: http://stackoverflow.com/comment/40575345
score: 0
answers question: http://stackoverflow.com/q/25920481
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25920481

http://stackoverflow.com/a/26019539
answers question: http://stackoverflow.com/q/26019441
score: 0
type: Answer
has body: Use Wrapper classes for primitives, then you can call toString() on them. e.g.: Integer myInteger = new Integer(5); System.out.println(myInteger.toString()); would print 5

http://stackoverflow.com/comment/40564119
has text: Matt3o's approach does have the advantage of requiring only one matching pass through the original string, and only one string allocation, though. The approach in this answer requires N matching passes, where N is the number of replacement targets. When N is small (which it almost certainly is), this approach will be faster, but this is a "Schlemiel the Painter" algorithm.
comment on: http://stackoverflow.com/a/25914283
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/33665201
has body: if (word.endsWith("char oldletter")) { name = name.substring(0, name.length() - 1 "char newletter"); }
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/26009591
has comment: http://stackoverflow.com/comment/55104104
type: Answer
downvote count: 1

http://stackoverflow.com/comment/75297479
type: Comment
has text: @Alex78191 No specific reason, both work, I guess in a system that only uses ISO, it's easier to work with IsoFields, in a system that can work with locale and ISO interchangeably WeekFields is probably the more convenient choice.
comment on: http://stackoverflow.com/a/25915611
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40775646
type: Comment
comment on: http://stackoverflow.com/q/26031347
has text: Are you sure you do not getting a permission exception? Check your log cat.
type: QuestionComment
score: 0

http://stackoverflow.com/q/25994385
has body: I tried to install Aptana Studio 3 on my laptop, but after installation, it gave me the error "Could not load the JNI shared library ... " when I tried to run it. A google search told me that it needed 32-bit Java installation. Since my installation is 64-bit, I was sure it would not work. I did not try again. Just then a pop-up came that there was a new update of java available for my system, Java 8 Update 20. Previously I was on Java 8 update 11. I did the update and then a restart. After that, I tried running the Aptana Studio 3 once more, and to my surprise it was working perfectly. But then I came onto a doubt and tried to run Eclipse (mine is 64-bit) and I was shown the problem "Java was started and returned with exit code=13", which a google search told me that I was trying to run 64-bit eclipse on a 32-bit Java installation. So I did a "java -version" and it is now showing me I have a 32-bit Java installation. All these happened in 10 minutes. I mean I was using Eclipse this morning before the update. I never knew this could even happen. I regularly use Eclipse and I know I have a 64-bit Java installed, and the PATH is also set correctly. I have no idea what is going on, but I need my Eclipse to be up and running, I am in the middle of my android application project, and now I have no clue. Please help! OS : Windows 7 Ultimate Service Pack 1 64-bit I am attaching two screenshots.
has comment: http://stackoverflow.com/comment/40707145
possible better answer: http://stackoverflow.com/a/25994487
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25994487
accepted answer: http://stackoverflow.com/a/25994490
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
score: 0
tagged with: version
has answer: http://stackoverflow.com/a/25994490
has title: 64-bit java acting like 32-bit Java after installing Java 8 Update 20 - Weird

http://stackoverflow.com/q/26018684
type: Question
tagged with: jsapar
has answer: http://stackoverflow.com/a/26032011
has body: Where can I find the JSapar's updated source code (1.5.x)? Where can I find an active forum about that library? That library still active? Thanks in advance.
has title: Where can I find the JSapar updated source code and active forum?
score: -1
answer count: 1
downvote count: 1
tagged with: parsing
tagged with: text-files
favorite count: 0
tagged with: http://stackoverflow.com/tag/csv
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/26032011
tagged with: java

http://stackoverflow.com/a/52931522
upvote count: 1
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/25944644
type: Answer
has body: You have problem in secoand query means authorities-by-username query that should be only username and role not email,name etc. `&lt;bean id="bcryptEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"/&gt; &lt;security:authentication-manager&gt; &lt;security:authentication-provider&gt; &lt;security:jdbc-user-service data-source-ref="ds" users-by-username-query="select user_name,user_password,enabled,user_email from user where user_name=?" authorities-by-username-query="select user_name,user_role from user_role where user_name=?" /&gt; &lt;s &lt;security:password-encoder hash="bcrypt" ref="bcryptEncoder"/&gt; &lt;/security:authentication-provider&gt; &lt;/security:authentication-manager&gt;`

http://stackoverflow.com/a/25979282
downvote count: 0
answers question: http://stackoverflow.com/q/25978784
upvote count: 2
type: Answer
has body: You can try creating a callback method for getting the result of the newly created thread by passing the current object to the thread. Then with-in thread, after completing execution, you can set appropriate state[field] in that object &amp; again call the callback method. Provided pseudo code below. Thread_1 Thread_2 t = new Thread_2(callBackObj); //-- Start thread Thread_2 callBackObj.setState(STOPPED); //-- Similarly for other properties callBackObj.callBack(); Else, you can try setting correlation-id &amp; reply-to options, it might help to track the required message information.
score: 2

http://stackoverflow.com/comment/40512399
type: QuestionComment
score: 1
has text: @Fraz how about just ```\([,\d]*\)``` then you split on ```,``` and you're done? Or you take the whole ```(30,2884090,1410450570357,235)``` as one entry, whichever you need.
comment on: http://stackoverflow.com/q/25885696
type: Comment

actor
tags question: http://stackoverflow.com/q/25947543
type: Tag
tag name: actor

http://stackoverflow.com/a/25930501
has body: Great! Thanks for all the people that tried to help. The Solution is a bit strange! I just downgraded my JRE and JDK to 1.6 and this solved the problem! It might be something with the Java 1.7 enviroment. Anyway, Thanks for all you are like always awesome :)
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25923346
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40729088
comment on: http://stackoverflow.com/q/26006026
type: Comment
type: QuestionComment
has text: Didn't they give you a textbook for your class?
score: 1

http://stackoverflow.com/comment/40557402
comment on: http://stackoverflow.com/a/25911192
type: AnswerComment
type: Comment
score: 0
has text: Thank you for pointing that out, I was just about to test if something like 12/12/14 would work. How can I get double digits? really green in this area

http://stackoverflow.com/a/25940107
has comment: http://stackoverflow.com/comment/40612056
has comment: http://stackoverflow.com/comment/40612921
downvote count: 0
has comment: http://stackoverflow.com/comment/40612108
has body: Override equals. You can then use List.contains class Employee { private empId; private name; public boolean equals(Object o) { return (o instanceof Employee &amp;&amp; ((Employee)o).empId == empId &amp;&amp; ((Employee)o).name = name); } } List l = ...; Employee e = new Employee(...); l.add(e); l.contains(e);
has comment: http://stackoverflow.com/comment/40612150
answers question: http://stackoverflow.com/q/25940053
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/40702359
has text: Thank you very much, @Mark Rotteveel. That absolutely solved my problem!
type: Comment
comment on: http://stackoverflow.com/a/25990862
type: AnswerComment
score: 0

http://stackoverflow.com/a/25931590
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43146023
has comment: http://stackoverflow.com/comment/43137402
has comment: http://stackoverflow.com/comment/41715037
has body: It looks like you've added a KeyListener to a JTextField, which uses Key Bindings specific to each platform. Instead, use a BufferedReader to read System.in; the readLine() method should be able to detect the line ending. BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); To avoid blocking the event dispatch thread, do the I/O in the background of a SwingWorker, publish() results as they become available, and update the JTextField in your implementation of process().
downvote count: 0
has comment: http://stackoverflow.com/comment/41701006
answers question: http://stackoverflow.com/q/25927426

http://stackoverflow.com/q/25921761
has comment: http://stackoverflow.com/comment/40606108
has answer: http://stackoverflow.com/a/25922373
has comment: http://stackoverflow.com/comment/40578707
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40606240
has body: I am working in a situation where the MethodHandles.Lookup class is utilized often. In this situation, is it a wise idea to keep the value of MethodHandles.lookup() between multiple lookups? (Specifically, the only lookup method I am using is unreflect(java.lang.reflect.Method).) Would this speed anything up, or would it be irrelevant? Or, would it actually slow it down for some reason?
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40590776
tagged with: java-8
type: Question
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40582106
has title: Caching the result of MethodHandles.lookup()?
tagged with: methodhandle

http://stackoverflow.com/comment/40549831
comment on: http://stackoverflow.com/a/25906884
score: 0
type: AnswerComment
type: Comment
has text: I cannot touch db, i just can work in a software-side

http://stackoverflow.com/a/30912147
upvote count: 1
type: Answer
has body: Using JodaTime it is very Easy. import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; //from your method String inputDateString = "2014-09-11T03:27:54kanmsdklnasd"; String pattern = "yyyy-MM-dd'T'HH:mm:ssZ"; boolean isValid = isValidDateFormat(inputDateString, pattern); private boolean isValidDateFormat(String inputDateString, String format){ try { DateTimeFormatter dtf = DateTimeFormat.forPattern(format); dtf.parseDateTime(inputDateString); } catch (Exception ex) { return false; } return true; } You will get.. *Exception in thread "main" java.lang.IllegalArgumentException: Invalid format: "2014-09-11T03:27:54kanmsdklnasd" is malformed at "kanmsdklnasd"*
downvote count: 0
answers question: http://stackoverflow.com/q/25884332
score: 1

http://stackoverflow.com/q/26014079
has title: Mac OS Yosemite and java classpaths
has answer: http://stackoverflow.com/a/26633021
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41874093
tagged with: java
has comment: http://stackoverflow.com/comment/41874459
type: Question
linked to: http://stackoverflow.com/q/6588390
has body: For school we need to add a library for Java development. These are the steps that we need to follow: $ cd ~ nano ~/.profile Add: export CLASSPATH=.:~/Library/javautils/*:$CLASSPATH Save with Ctrl+o and Enter Quit nano with Ctrl+x Quit and reopen Terminal But when I try echo $CLASSPATH it doesn't return anything. On Mavericks it didn't seem to be a problem. So it's Yosemite's fault. Anybody have any I idea on how I can fix this?
score: 0
answer count: 1
tagged with: osx-yosemite
tagged with: macos
has comment: http://stackoverflow.com/comment/40745454

http://stackoverflow.com/comment/40651719
comment on: http://stackoverflow.com/q/25962531
score: 0
has text: Questions seeking debugging help ("**why isn't this code working?**") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it **in the question itself**. Questions without **a clear problem statement** are not useful to other readers. See [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40697143
comment on: http://stackoverflow.com/a/25988260
type: AnswerComment
score: 0
type: Comment
has text: I'm running HDFS cluster in my local machine.

http://stackoverflow.com/a/25968624
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25968190
answers question: http://stackoverflow.com/q/25968190
type: Answer
has body: The charsets supported by Java and their proper names are listed here: http://docs.oracle.com/javase/6/docs/technotes/guides/intl/encoding.doc.html It looks like spelling the name as "MS932" or "windows-31j" should work.
score: 1
upvote count: 1

http://stackoverflow.com/comment/40600850
type: Comment
comment on: http://stackoverflow.com/a/25915244
has text: hmm not sure. But even if it's not required, at least it's good practice to still declare it.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25925917
answer count: 1
has body: These are my environment variables: System variables: JAVA_HOME C:\Program Files\Java\jdk1.8.0_20\ Path: ...;C:\Program Files\Java\jdk1.8.0_20\bin;... I key the following in the command line: c:\wsimport>wsimport http://www.webservicex.net/geoipservice.asmx?WSDL -Xdebug I receive the following message [DEBUG] Authorization file "C:\Users\myPC.metro\auth" not found. If the WSDL access needs Basic Authentication, please provide authorization file with read access at C:\Users\myPC.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port// parsing WSDL... Where my configuration is incorrect?
tagged with: java
has comment: http://stackoverflow.com/comment/40593521
has comment: http://stackoverflow.com/comment/40584969
has title: webservices - wsimport hangs on parsing WSDL
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25944403
accepted answer: http://stackoverflow.com/a/25944403
type: AnsweredQuestion
tagged with: wsdl
tagged with: soap
favorite count: 0
type: Question
upvote count: 2
tagged with: web-services

http://stackoverflow.com/q/25914113
has comment: http://stackoverflow.com/comment/40562778
type: Question
score: 4
has comment: http://stackoverflow.com/comment/40562650
answer count: 2
has body: I've to replace a set of substrings in a String with another substrings for example "^t" with "\t" "^=" with "\u2014" "^+" with "\u2013" "^s" with "\u00A0" "^?" with "." "^#" with "\\d" "^$" with "[a-zA-Z]" So, I've tried with: String oppip = "pippo^t^# p^+alt^shefhjkhfjkdgfkagfafdjgbcnbch^"; Map&lt;String,String&gt; tokens = new HashMap&lt;String,String&gt;(); tokens.put("^t", "\t"); tokens.put("^=", "\u2014"); tokens.put("^+", "\u2013"); tokens.put("^s", "\u00A0"); tokens.put("^?", "."); tokens.put("^#", "\\d"); tokens.put("^$", "[a-zA-Z]"); String regexp = "^t|^=|^+|^s|^?|^#|^$"; StringBuffer sb = new StringBuffer(); Pattern p = Pattern.compile(regexp); Matcher m = p.matcher(oppip); while (m.find()) m.appendReplacement(sb, tokens.get(m.group())); m.appendTail(sb); System.out.println(sb.toString()); But it doesn't work. tokens.get(m.group()) throws an exception. Any idea why?
has answer: http://stackoverflow.com/a/25914283
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/25914260
type: UnansweredQuestion
tagged with: regex
upvote count: 4
has title: Replace a set of substring in a string in more efficient way?
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/25365667

http://stackoverflow.com/comment/40756597
type: Comment
comment on: http://stackoverflow.com/a/26021320
type: AnswerComment
score: 0
has text: @SomeRandomGuy Those are not objects. First, `ArrayInt3` is a type. The rest are values. They are part of the single `int[]` object. They are not independent.

http://stackoverflow.com/comment/40646228
has text: @SergiyMedvynskyy: no _apparent_ problem, as suggested [here](http://stackoverflow.com/a/7158505/230513).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25959139

http://stackoverflow.com/a/25916893
answers question: http://stackoverflow.com/q/25916566
type: Answer
accepted answer of: http://stackoverflow.com/q/25916566
has body: You can create one to one relation ship between these two entities like below. @Entity @Table(name = "book") class book{ private int id; private String isdn; private Info info; @Id @Column(name="id_book", unique=true, nullable=false) @GeneratedValue public int getId(){ return this.id; } @Column(name="isdn") public String getIsdn(){ return this.idsn; } public void setId(int id){ this.id = id; } public void setIsdn(String isdn){ this.isdn = isdn; } @OneToOne @PrimaryKeyJoinColumn public Info getInfo(){ return this.info; } public void setInfo(Info info){ this.info = info; } } @Entity @Table(name = "info") class Info{ private int id; private String title; private String author; private Book book; @Id @Column(name="id_info", unique=true, nullable=false) @GeneratedValue public int getId(){ return this.id; } @Column(name="title") public String getTitle(){ return this.title; } public void setId(int id){ this.id = id; } public void setTitle(String title){ this.title = title; } @OneToOne(mappedBy="info", cascade=CascadeType.ALL) public Book getBook(){ return this.book; } public void setBook(Book book){ this.book = book; } public void setAuthor(String author){ this.author = author; } @Column(name="author") public String getAuthor(){ return this.author ; } }
has comment: http://stackoverflow.com/comment/40568736
has comment: http://stackoverflow.com/comment/40570168
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40568531
score: 0
has comment: http://stackoverflow.com/comment/40569267

http://stackoverflow.com/q/25887806
has comment: http://stackoverflow.com/comment/40517306
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: bitmap
downvote count: 1
has comment: http://stackoverflow.com/comment/40525153
tagged with: performance
has body: In my app when i upload an image i want to reduce the data so i call this function. But this piece of code is giving me an outOfMemoryError. LOGCAT: 09-17 15:32:01.712: E/AndroidRuntime(7771): at com.technow.pereo.FileHelper.reduceImageForUpload(FileHelper.java:64) public static byte[] reduceImageForUpload(byte[] imageData) { Bitmap bitmap = ImageResizer.resizeImageMaintainAspectRatio(imageData, SHORT_SIDE_TARGET); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, outputStream); bitmap.recycle(); byte[] reducedData = outputStream.toByteArray(); try { outputStream.close(); } catch (IOException e) { // Intentionally blank } return reducedData; } What is causing this error and how do I resolve it?!
has answer: http://stackoverflow.com/a/25889846
has title: OutOfMemoryError while trying to reduce size of byte data using bitmaps
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40515654
type: Question
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/53539488
type: AnswerComment
comment on: http://stackoverflow.com/a/25903957
score: 0
type: Comment
has text: Thanks for providing this response. Jackson is serializing exactly how I want without having to go through a Mixin or CustomSerializer.

http://stackoverflow.com/q/25917474
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25152451
upvote count: 2
tagged with: java
tagged with: signing
has title: How do I change how I sign Java application after updating to OSX 10.9.5
type: Question
has body: Just updated from OSX 10.9.4 to 10.9.5, looks like I have to change how I sign Java application after updating because Im now getting this output after signing with export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate" /usr/bin/codesign --sign "Developer ID Application: P Taylor" --force --deep --verbose /Applications/SongKong.app Im getting: /Applications/SongKong.app: the main executable or Info.plist must be a regular file (no symlinks, etc.) In subcomponent: /Applications/SongKong.app/Contents/PlugIns/jdk1.8.0_20.jdk and verification with /usr/bin/codesign --verify --deep --verbose /Applications/SongKong.app gives me /Applications/SongKong.app: code object is not signed at all In architecture: x86_64 What do I have to change to fix this ?
has comment: http://stackoverflow.com/comment/40576019
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27421943
tagged with: macos
favorite count: 0
accepted answer: http://stackoverflow.com/a/27421943

http://stackoverflow.com/comment/40601794
score: 0
type: AnswerComment
has text: thanks for that but would the Text View scroll up too? and what do you mean by appending it at the beginning ?? sorry for really noob questions -_-
type: Comment
comment on: http://stackoverflow.com/a/25935504

http://stackoverflow.com/a/25950556
answers question: http://stackoverflow.com/q/25950418
has body: I've been writing Java code for 15 years, and this may be the worst possible way I've see anyone try to accomplish this. This approach was a miserable idea then, and remains one today - maybe more so. Stop. Now. Take some time and learn about options for using databases in Java (mybatis, hibernate, JPA, anything but direct jdbc in jsp). Take some more and learn about web development in Java and the options around that (struts, jsf, stripes, anything but a pile of crappy code dumped in a jsp file). After that, come back and ask again.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40627378
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25950418

http://stackoverflow.com/q/25959139
linked to: http://stackoverflow.com/q/7156949
linked to: http://stackoverflow.com/q/25736443
tagged with: java
has title: Swing: Is this safe to not use the EDT to create the GUI?
has comment: http://stackoverflow.com/comment/40643796
has comment: http://stackoverflow.com/comment/40644136
duplicate of: http://stackoverflow.com/q/7156949
linked to: http://stackoverflow.com/q/2561480
tagged with: program-entry-point
has comment: http://stackoverflow.com/comment/40646775
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15302085
linked to: http://stackoverflow.com/q/19167154
has comment: http://stackoverflow.com/comment/40646228
has comment: http://stackoverflow.com/comment/40646260
has comment: http://stackoverflow.com/comment/40647336
score: 1
favorite count: 0
tagged with: event-dispatch-thread
type: Question
has body: Reading the last paragraph at Oracle site. Why does not the initial thread simply create the GUI itself? Because almost all code that creates or interacts with Swing components must run on the event dispatch thread. So main() should not create a Swing JFrame within the initial thread, but should use SwingUtilities.invokeLater(), up to Java 7 at least. This is also explained in this Q/A). SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); While this is very logical, we must observe that this is nearly never done in tutorials. I read elsewhere that modern compilers will insert the invokeLater() call themselves without telling the programmer. Is that true, for exemple when using Eclipse? Is there some reference to confirm this behavior? Are there different cases to consider?
upvote count: 1
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/25959854

http://stackoverflow.com/a/25964771
type: Answer
accepted answer of: http://stackoverflow.com/q/25964298
answers question: http://stackoverflow.com/q/25964298
upvote count: 2
has comment: http://stackoverflow.com/comment/40655810
has body: The problem is that these classes are generated by ANTLR from Limbo.g and LimboWalker.g, but IntelliJ doesn’t automatically know how to use ANTLR to build them. There is an ANTLRWorks plugin for IntelliJ that supports ANTLR version 3, but it was last updated in 2009 and doesn’t seem to work in IntelliJ 13. There is a newer “ANTLR v4 grammar plugin” that is actively maintained, but it is only for ANTLR 4, and preon is still on ANTLR 3. But the Maven plugin for ANTLR is stable and can build it. What you need to do is: right-click preon-el in Project, then choose the Maven → Generate Sources and Update Folders menu option. This will call the Maven plugin to generate LimboWalker.class from LimboWalker.g, among other things. Then choose Build → Make Project, and the BitmapFileTest will run.
has comment: http://stackoverflow.com/comment/40656136
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40717550
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25998618
has text: Can you upgrade to Tomcat7? Since Servlet 3.0, there's a HttpServletResponse#getStatus(). Otherwise the call is hidden and you need a wrapper to access it (using a filter)

http://stackoverflow.com/comment/40564657
has text: @JoopEggen I've had issues in the past, but they may well have fixed them.
type: AnswerComment
comment on: http://stackoverflow.com/a/25913954
score: 0
type: Comment

http://stackoverflow.com/comment/40644126
has text: Please post code of `StoreFacade.login()` and mention where the line #72 that causes the `NullPointerException`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25959817

http://stackoverflow.com/a/26918172
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25922067
has body: It is possible to do this in Java 7, but you need to fork Oracle's appbundler and edit native/main.m which compiles into JavaAppLauncher: int main(int argc, char *argv[]) { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"AppleMomentumScrollSupported"]; [defaults registerDefaults:appDefaults]; // ... }
answers question: http://stackoverflow.com/q/25922067
score: 0

string
tags question: http://stackoverflow.com/q/25912963
tags question: http://stackoverflow.com/q/25999498
tags question: http://stackoverflow.com/q/25963720
tags question: http://stackoverflow.com/q/25952616
tags question: http://stackoverflow.com/q/25984586
tags question: http://stackoverflow.com/q/25911090
tags question: http://stackoverflow.com/q/26001559
tags question: http://stackoverflow.com/q/25965929
tags question: http://stackoverflow.com/q/25892323
tags question: http://stackoverflow.com/q/25934319
tags question: http://stackoverflow.com/q/25894909
tags question: http://stackoverflow.com/q/25914113
tags question: http://stackoverflow.com/q/25948799
tags question: http://stackoverflow.com/q/25947134
tags question: http://stackoverflow.com/q/25903878
tags question: http://stackoverflow.com/q/25884647
tags question: http://stackoverflow.com/q/26032562
tags question: http://stackoverflow.com/q/26025427
tags question: http://stackoverflow.com/q/25885696
tags question: http://stackoverflow.com/q/25982237
tags question: http://stackoverflow.com/q/25910593
tags question: http://stackoverflow.com/q/25945854
tags question: http://stackoverflow.com/q/25926115
tags question: http://stackoverflow.com/q/25992304
tags question: http://stackoverflow.com/q/25954233
tags question: http://stackoverflow.com/q/25896513
tags question: http://stackoverflow.com/q/25984389
tags question: http://stackoverflow.com/q/25942556
tags question: http://stackoverflow.com/q/25914151
tags question: http://stackoverflow.com/q/25984457
tags question: http://stackoverflow.com/q/25875318
tags question: http://stackoverflow.com/q/26002507
tags question: http://stackoverflow.com/q/25979664
tags question: http://stackoverflow.com/q/25927275
tags question: http://stackoverflow.com/q/26009412
tags question: http://stackoverflow.com/q/25931735
tags question: http://stackoverflow.com/q/26011354
tags question: http://stackoverflow.com/q/25956404
tags question: http://stackoverflow.com/q/25960888
tags question: http://stackoverflow.com/q/25881742
tags question: http://stackoverflow.com/q/25944371
tags question: http://stackoverflow.com/q/25879761
tags question: http://stackoverflow.com/q/25954172
tags question: http://stackoverflow.com/q/25949977
tags question: http://stackoverflow.com/q/26012285
tags question: http://stackoverflow.com/q/25939514
tags question: http://stackoverflow.com/q/25904144
tags question: http://stackoverflow.com/q/25889403
tag name: string
tags question: http://stackoverflow.com/q/25939674
tags question: http://stackoverflow.com/q/26004889
tags question: http://stackoverflow.com/q/25953533
tags question: http://stackoverflow.com/q/26005246
tags question: http://stackoverflow.com/q/25903489
tags question: http://stackoverflow.com/q/25953120
tags question: http://stackoverflow.com/q/25940360
tags question: http://stackoverflow.com/q/25911895
tags question: http://stackoverflow.com/q/25895899
tags question: http://stackoverflow.com/q/25949393
tags question: http://stackoverflow.com/q/26006827
tags question: http://stackoverflow.com/q/25949663
tags question: http://stackoverflow.com/q/26012660
tags question: http://stackoverflow.com/q/26013593
type: Tag
tags question: http://stackoverflow.com/q/25996591
tags question: http://stackoverflow.com/q/25989334
tags question: http://stackoverflow.com/q/25939121
tags question: http://stackoverflow.com/q/25949625
tags question: http://stackoverflow.com/q/25935355
tags question: http://stackoverflow.com/q/26020326
tags question: http://stackoverflow.com/q/25961581
tags question: http://stackoverflow.com/q/25976315
tags question: http://stackoverflow.com/q/25973181
tags question: http://stackoverflow.com/q/25875114
tags question: http://stackoverflow.com/q/25927047
tags question: http://stackoverflow.com/q/26017364
tags question: http://stackoverflow.com/q/26010602
tags question: http://stackoverflow.com/q/25984189
tags question: http://stackoverflow.com/q/25976055
tags question: http://stackoverflow.com/q/25927627

w3c
type: Tag
tag name: w3c
tags question: http://stackoverflow.com/q/26014744

http://stackoverflow.com/q/25968263
tagged with: java
type: UnansweredQuestion
score: 2
downvote count: 0
favorite count: 0
has body: How to set videoView inside fragment. I pushed a.mp4 file inside File Explorer. 3 Error shows 1. The method findViewById(int) is undefined for the type Videos. 2. The constructor MediaController(Videos) is undefined. 3. create method getWindowManager(). So please anyone help me how I will set VideoView inside Fragment. public class Videos extends Fragment { VideoView video_player_view; SurfaceView sur_view; MediaController media_controller; DisplayMetrics dm; public Videos() {} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.frag_videos, container, false); return rootView; } public void getInit() { video_player_view = (VideoView)findViewById(R.id.videoView1); media_controller = new MediaController(this); dm = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(dm); int height = dm.heightPixels; int width = dm.heightPixels; video_player_view.setMinimumHeight(height); video_player_view.setMinimumWidth(width); video_player_view.setMediaController(media_controller); video_player_view.setVideoPath("/mnt/sdcard/a.mp4"); video_player_view.start(); } }
type: Question
tagged with: android
answer count: 0
upvote count: 2
has title: How to set videoView inside Fragment in android
has comment: http://stackoverflow.com/comment/40660162

http://stackoverflow.com/comment/40593463
type: Comment
comment on: http://stackoverflow.com/a/25909980
score: 0
type: AnswerComment
has text: Nirajkumar, Just realized mutex lock is just blocking the code to access by different threads at a time. That means that only one thread at a time (Then there is no point to use multiple threads we can achieve same thing with single thread also.). I think it is better to lock the db row using hibernate.

http://stackoverflow.com/q/25910020
tagged with: extends
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
score: -1
has body: What is the differnece between public static &lt;T extends MyObj&gt; ArrayList&lt;T&gt; generateRandomList(int count); and public static ArrayList&lt;? extends MyObj&gt; generateRandomList(int count); Because they behave diffenerently. the first option fails to compile the following line ArrayList&lt;MyObjSuccessor&gt; myObj = Util.generateRandomList(2); The second options causes my call to compile.
has answer: http://stackoverflow.com/a/25910200
has comment: http://stackoverflow.com/comment/40555400
has comment: http://stackoverflow.com/comment/40555388
upvote count: 0
answer count: 1
tagged with: generics
favorite count: 0
has title: Java generics - returning a list of generic successor

http://stackoverflow.com/comment/40576558
type: AnswerComment
score: 0
has text: Can you detect which encoding is the original file?
comment on: http://stackoverflow.com/a/25921061
type: Comment

http://stackoverflow.com/a/25926924
has comment: http://stackoverflow.com/comment/40588937
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25926870
has comment: http://stackoverflow.com/comment/40587836
accepted answer of: http://stackoverflow.com/q/25926870
has comment: http://stackoverflow.com/comment/40588335
type: Answer
score: 3
has body: Java doesn't pass arguments by reference, they are passed by value. Read more here Let's clarify by an example. Make the key you are looking for be integer with value 21. The situation at the beginning of the function is the following: So now, when you say: foundNode = node; // this doesn't reflect outside of the method You are changing the value of foundNode locally inside the findGivenNode() method, it doesn't apply to outside this method. Basically, the local variable called foundNode references the node you want to change and then you make this local variable foundNode reference the new node by the statement above. This change is reflected only inside the function. As soon as your function is finished, local variables don't exist anymore so neither does this local version of foundNode. Visual result: The simple solution is to use a Wrapper function To keep track of the reference, you can make a simple wrapper class that will store the reference you want: private class NodeWrapper { Node foundNode; NodeWrapper() { foundNode = null; } } Then you can create a new NodeWrapper and pass that into your function instead of foundNode NodeWrapper wrapper = new NodeWrapper(); findGivenNode(root, wrapper, key, parentStack); Then inside your function instead of: foundNode = node; You say: wrapper.foundNode = node; This way you can maintain the reference throughout the recursion inside the NodeWrapper. Meaning: NodeWrapper wrapper = new NodeWrapper(); findGivenNode(root, wrapper, key, parentStack); // at this point, wrapper.foundNode will hold the reference to the node you need // or null if the node wasn't found On another note, above the method you have this function prototype: findGivenNode(root, key, foundNode, parentStack); Seems like someone is still used to C/C++ :) This is unnecessary in Java, you can read this question thread for reasoning behind that or just Google it.
upvote count: 3

http://stackoverflow.com/comment/40628705
type: QuestionComment
score: 4
has text: You are trying to instanciate `ListOfStrings` not `MyListOfStrings`
comment on: http://stackoverflow.com/q/25951327
type: Comment

http://stackoverflow.com/a/25887076
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/40518272
downvote count: 1
type: Answer
has body: Depends on what your method really does. If your program should continue working also when an exception arise (e.g. NumberFormatException when parsing an input or in general a checked exception) a lot of people will suggest you to not use exception for flow control, but IMHO in very well defined cases (like NumberFormatException) the flow CAN be controlled by try catch statements and exceptions, it's really up to you. A way to do so is to use the method returned parameter (also @Nikola answer works in this way, the point is to use the catch part of a try catch as flow control): public class MyClass { public static void main(String[] args) { if(method01()) method02(); }; }; public boolean method01(){ try{ //some business }catch(MyCheckedException e){ e.printStackTrace(); return false; } return true; } NB: You should use this approach only in well defined situations! If a file CAN be absent in a directory while opening it (checked FileNotFoundException), you COULD use this approach. If the file SHOULD be there and its not, the exception MUST stop the program.
answers question: http://stackoverflow.com/q/25886545

http://stackoverflow.com/comment/40683682
type: AnswerComment
has text: Thanks for the awnser, and how I can Produce my JpaDAO without using new ? I did a search and haven't found anything
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25964645

http://stackoverflow.com/comment/40625127
comment on: http://stackoverflow.com/a/25949010
type: Comment
score: 0
type: AnswerComment
has text: Here it is. How to fix it?

http://stackoverflow.com/a/37816748
has body: As mentioned, it is a known JVM bug. Although, if you want to do an HTTP request to such a host, you still can try to use a workaround. The main idea is to construct request basing on the IP, not on the 'wrong' hostname. But in that case you also need to add "Host" header to the request, with the correct (original) hostname. 1: Cut hostname from the URL (it's a rough example, you can use some more smart way): int n = url.indexOf("://"); if (n &gt; 0) { n += 3; } else { n = 0; } int m = url.indexOf(":", n); int k = url.indexOf("/", n); if (-1 == m) { m = k; } String hostHeader; if (k &gt; -1) { hostHeader = url.substring(n, k); } else { hostHeader = url.substring(n); } String hostname; if (m &gt; -1) { hostname = url.substring(n, m); } else { hostname = url.substring(n); } 2: Get hostname's IP: String IP = InetAddress.getByName(hostname).getHostAddress(); 3: Construct new URL basing on the IP: String newURL = url.substring(0, n) + IP + url.substring(m); 4: Now use an HTTP library for preparing request on the new URL (pseudocode): HttpRequest req = ApacheHTTP.get(newUrl); 5: And now you should add "Host" header with the correct (original) hostname: req.addHeader("Host", hostHeader); 6: Now you can do the request (pseudocode): String resp = req.getResponse().asString();
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25993225
downvote count: 0

http://stackoverflow.com/comment/40899798
type: AnswerComment
comment on: http://stackoverflow.com/a/25922951
has text: Did you apply the exact same scaling (parameters; not method! min and max may be different!) to your validation data? As you can see, SVM *can* be sensitive to normalization...
type: Comment
score: 0

http://stackoverflow.com/q/25935207
has body: I would like to build a tool to help developers/architects to detect potential slow or bad queries in their applications. Complex generated SQL queries due to wrong JPA usage are quite very common in projects I saw. And people don't really use SQL debugging feature we can have in Hibernate tool. I would like to provide static analysis of a JPA application with warnings (Sonar like rule) when generated SQL queries are a bit too complex Does anybody know how I can do that with Hibernate?
has title: Display generated SQL queries from JPA entities (without running the application)
tagged with: java
tagged with: hibernate
type: UnansweredQuestion
score: 2
tagged with: sql
tagged with: jpa
downvote count: 0
answer count: 0
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/40578998
has text: Hm.. it may have been a CF9+ issue. It was a long shot anyway. Unfortunately I do not have access to CF8 right now. For grins, try creating an instance of one of the classes just be certain ie `createObject("java", "org.slf4j.LoggerFactory")`. If it throws a class not found error, then you are right.
type: Comment
comment on: http://stackoverflow.com/q/25914987
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40609466
comment on: http://stackoverflow.com/q/25938601
score: 0
type: Comment
type: QuestionComment
has text: I took the first line of text and put it into a JSON formatter & validator and received an error then added curly braces around it and it validated. `{"45da286":["4CAAB6",43.5609,12.6837,211,34975,420,"7311","F-LIBP2","B772","EI-ISA",1411143824,"NRT","FCO","AZ785",0,0,"AZA785",0]}` using [this JSON formatter](http://jsonformatter.curiousconcept.com/)

http://stackoverflow.com/q/26023902
has answer: http://stackoverflow.com/a/26048676
tagged with: struts2
has body: I'm working with a Struts2 program that constructs an email message using an email template file and replaces certain placeholder strings in the template with user input retrieved through a form field. The JavaMail project is being used to form the email. Here's what that looks like: InputStream in = getClass().getResourceAsStream("emailTemplate.html"); Scanner scanner = new Scanner( in ); String content = ""; while( scanner.hasNextLine() ) { content += parseLine( scanner.nextLine() ); } // ... email.setHtmlContent( content ); The parseLine method looks like this: String emailReqNum = //internal code to return number from form; String emailCompDate = //internal code to return date from form; String emailComment = //internal code to return comment from form; String emailStatus = //internal code to return status from form; String emailServer = //internal code to return server from form; line = line.replaceAll( "\\[REQUEST NUMBER\\]", emailReqNum ); line = line.replaceAll( "\\[ESTIMATED COMPLETION DATE\\]", emailCompDate ); line = line.replaceAll( "\\[COMMENT\\]", emailComment ); line = line.replaceAll( "\\[STATUS\\]", emailStatus ); line = line.replaceAll( "\\[SERVER\\]", emailServer ); And this is what part of the email template looks like: Request Number: [REQUEST NUMBER] Est. Completion Date: [ESTIMATED COMPLETION DATE] Comment: [COMMENT] Status: [STATUS] The problem is that whenever a user enters a special RegEx character (\ ^ $ . | ? * + ( ) [ ] { }) in the comment field, it breaks the replaceAll methods: Exception in thread "main" java.lang.IllegalArgumentException: Illegal group reference at java.util.regex.Matcher.appendReplacement(Matcher.java:725) at java.util.regex.Matcher.replaceAll(Matcher.java:825) at java.lang.String.replaceAll(String.java:1572) I've tried replacing each of the offending special characters with an escaped version, but that didn't seem to work, and looks ugly as sin: String filtered = emailComment; filtered.replaceAll("\\","\\\\"); filte…
linked to: http://stackoverflow.com/q/1732348
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/13623220
favorite count: 0
has comment: http://stackoverflow.com/comment/40761510
has title: Java code to preserve special characters in arbitrary input
has comment: http://stackoverflow.com/comment/40761647
accepted answer: http://stackoverflow.com/a/26048676
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40763487
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40762022

http://stackoverflow.com/comment/40508642
has text: You want to perform an action between animations? or just after all of them have finished?
comment on: http://stackoverflow.com/q/25884153
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/63029936
type: Comment
has text: Why "please don't do that" to using `int`s vs `enum`s? It seems reasonable... Even the JAVA API does these (for example, `KeyEvent.VK_stuff`, JFrame's `EXIT_ON_CLOSE`, etc).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26014492

http://stackoverflow.com/comment/42602662
comment on: http://stackoverflow.com/q/25968769
score: 0
type: Comment
type: QuestionComment
has text: Do you have any update on this? I have exactly the same problem

http://stackoverflow.com/comment/40616775
comment on: http://stackoverflow.com/a/25939890
has text: @user4059399 If this post fixed your problem, then please mark it as correct with a green checkmark. This will: (1) show appreciation to the user who gave the correct answer, (2) help future users with a similar issue see that this answer fixed your problem, and (3) help other volunteers by not wasting their time reading questions that already have answers. Thanks.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/25886058
tagged with: swt
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40522996
has body: In my (pure) E4 App I want to force the User to enter something in a Text Field before he can move on. Currently, if nothing has been entered into the Text Field and the focusLost Event is triggered, I reset focus to the Text Field. Via a ModifyListener I check, if the entered String equals "" and if yes, a fake tooltip is displayed, telling the User to enter something into the Text Field. The Problem is, if I have two Parts on a PartStack and the Text Field is on my first Part, the User is still able to trigger a Part switch and work on the other Part without having to enter something into the Text Field on the first Part first. How is it possible to prohibit the User from switching between these Parts, as long as nothing is entered in the Text Field on the first Part? I don´t want to hide Part 2, the App should still look the same, the user should just not be able to do anything until something has been entered into the Text Field.
tagged with: eclipse-rcp
score: 0
has comment: http://stackoverflow.com/comment/40551500
has answer: http://stackoverflow.com/a/25972389
answer count: 1
tagged with: e4
type: UnansweredQuestion
has title: Eclipse 4 RCP Disable Part Switch
tagged with: java

aes
tags question: http://stackoverflow.com/q/25942165
type: Tag
tag name: aes
tags question: http://stackoverflow.com/q/25922682
tags question: http://stackoverflow.com/q/25995052
tags question: http://stackoverflow.com/q/25977758

http://stackoverflow.com/q/25930174
accepted answer: http://stackoverflow.com/a/26020996
downvote count: 0
answer count: 1
tagged with: jackson
has title: Generate a custom JSON Schema in JAVA using Jackson
favorite count: 0
tagged with: jackson-modules
upvote count: 2
has answer: http://stackoverflow.com/a/26020996
has body: I'm new to this and struggling for the use cases when a POJO/Bean has nested parameters in it. Requirement - Generate a JSON schema using Jackson(latest versions are OK) for a JAVA Bean/POJO class, such that it includes the structure of nested Objects properly and also want to add custom attributes to the nested pojos(in my case, want to add a fully classified classname attribute for each nested POJO parameter). Use Case - Say, I've a Person class which is as follows. And I'm using this Person as parameter to my some operation.- public class Person { private String name; private String id; private int i; private Person2 p; private List&lt;String&gt; strList; private HashMap&lt;String, String&gt; strMap; private Person3[] p3; public void setName(String name){ this.name = name; } public void setId(String id){ this.id = id; } public void setI(int i){ this.i = i; } public void setP(Person2 p){ this.p = p; } public String getName(){ return this.name; } public String getId(){ return this.id; } public int getI(){ return this.i; } public Person2 getP(){ return this.p; } public void setStrList(List&lt;String&gt; strList){ this.strList = strList; } public List&lt;String&gt; getStrList(){ return this.strList; } public void setStrMap(HashMap&lt;String, String&gt; strMap){ this.strMap = strMap; } public HashMap&lt;String, String&gt; getStrMap(){ return this.strMap; } public void setP3(Person3[] p3){ this.p3 = p3; } public Person3[] getP3(){ return this.p3; } } For e.g. currently this generates following JSON Schema, when above Person class is used as a parameter - { "type": "object", "properties": { "name": { "type": "string" }, "id": { "type": "string" }, "i": { "type": "integer" }, "p": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "id": { "type": "string" }, "i": { "type": "integer" }, "p1": { "type": "object", "properties": { "name": { "type": "string" }, "id": { "type": "string" }, "i": { "type": "integer" } } } } } }, "strLis…
tagged with: jsonschema
linked to: http://stackoverflow.com/q/25910472
has comment: http://stackoverflow.com/comment/40592505
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/q/25993531
has comment: http://stackoverflow.com/comment/40705625
type: Question
accepted answer: http://stackoverflow.com/a/25993788
has comment: http://stackoverflow.com/comment/40705669
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40705586
has title: JCreator Cannot find symbol very simple
tagged with: jcreator
has answer: http://stackoverflow.com/a/25993788
has body: This is obviously not the entire code but this is the problem im having. Its supposed to write random numbers between 0 and whatever i put in ((x))). for (int i=0; i&lt;1; i=i+1){ int tal2 = 1 + (int)(Math.random () * ((9))); System.out.print("" + tal2); } for (int i=0; i&lt;1; i=i+1){ int tal3 = 1 + (int)(Math.random () * ((1))); System.out.print("" + tal3); } if (tal3==1){ for (int i=0; i&lt;1; i=1+1){ int tal4 = 1 + (int)(Math.random () * ((2))); System.out.print("" + tal4); } } else if (tal3==0) for (int i=0; i&lt;1; i=i+1){ int tal4 = 1 + (int)(Math.random () * ((9))); System.out.print("" + tal4); error: cannot find symbol if (tal3==1){ ^ error: cannot find symbol else if (tal3==0)
type: AnsweredQuestion
tagged with: symbols

http://stackoverflow.com/a/26011873
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26011619
type: Answer
has body: You have a few problems here. 1) Change your regex e.g. to this. private static String EMAIL_REGEX_NEW_2 = "^[a-zA-Z0-9]{1,}([.-_]{1}[a-zA-Z0-9]{1,})*$"; Note: this is just a regex for the text before the @ symbol. 2) Don't call find(), call matches() import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class EmailRegex { private static String EMAIL_REGEX_NEW_2 = "^[a-zA-Z0-9]{1,}([.-_]{1}[a-zA-Z0-9]{1,})*$"; public static void main(String[] args) { System.out.println("Enter the email name to validate"); Scanner sc = new Scanner(System.in); if (!serverValidationUsingRegexPattern(sc.nextLine(), EMAIL_REGEX_NEW_2)) { System.out.println("Sorry, Email name invalid"); } else { System.out.println("Congrats, Email name valid"); } } public static boolean serverValidationUsingRegexPattern(String valueToValidate, String regexPattern) { Pattern p = Pattern.compile(regexPattern); Matcher m = p.matcher(valueToValidate); return m.matches(); } }
accepted answer of: http://stackoverflow.com/q/26011619
has comment: http://stackoverflow.com/comment/40739493
has comment: http://stackoverflow.com/comment/40739611
score: 0

http://stackoverflow.com/q/25963588
has comment: http://stackoverflow.com/comment/40651784
type: Question
has comment: http://stackoverflow.com/comment/40651517
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40651648
tagged with: eclipse
has title: Android/Java - Calling random function only works once
has comment: http://stackoverflow.com/comment/40651584
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40651914
tagged with: android
has answer: http://stackoverflow.com/a/25964106
accepted answer: http://stackoverflow.com/a/25964106
has comment: http://stackoverflow.com/comment/40651401
downvote count: 0
score: 1
has body: I got a small game in which I am using a random word which I also split into an array, this works fine at start, but when I try to fill the variable with a new word the program crash. Maybe I am doing it the wrong way and maybe im just stupid and not seeing the obvious mistake, either way I could use some help. I have allocated the problem into these lines, I am calling newGame() through a button click and the call itself works. The program is using 3 different classes. In my MainActivity class: public void newGame(){ fullWord = ""; fullWord = _c.getWord(); charArray = fullWord.split("(?!^)");} In Controller class: public String getWord(){ return _m.setWord(); } In Model class: public String setWord(){ randomWord = wordArray[new Random().nextInt(wordArray.length)]; charArray = randomWord.split("(?!^)"); return randomWord; } Logcat:09-21 20:40:24.252: W/dalvikvm(536): threadid=1: thread exiting with uncaught exception (group=0x409961f8) 09-21 20:40:24.292: E/AndroidRuntime(536): FATAL EXCEPTION: main 09-21 20:40:24.292: E/AndroidRuntime(536): java.lang.NullPointerException 09-21 20:40:24.292: E/AndroidRuntime(536): at com.example.hangmangame.MainActivity.newGame(MainActivity.java:156) 09-21 20:40:24.292: E/AndroidRuntime(536): at com.example.hangmangame.Model.setNewGame(Model.java:87) 09-21 20:40:24.292: E/AndroidRuntime(536): at com.example.hangmangame.Controller.onClick(Controller.java:39) 09-21 20:40:24.292: E/AndroidRuntime(536): at android.view.View.performClick(View.java:3480) 09-21 20:40:24.292: E/AndroidRuntime(536): at android.view.View$PerformClick.run(View.java:13983) 09-21 20:40:24.292: E/AndroidRuntime(536): at android.os.Handler.handleCallback(Handler.java:605) 09-21 20:40:24.292: E/AndroidRuntime(536): at android.os.Handler.dispatchMessage(Handler.java:92) 09-21 20:40:24.292: E/AndroidRuntime(536): at android.os.Looper.loop(Looper.java:137) 09-21 20:40:24.292: E/AndroidRuntime(536): at android.app.ActivityThread.main(ActivityThread.java:4340) 09-21 20:…
tagged with: java

http://stackoverflow.com/q/25893374
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25894818
accepted answer: http://stackoverflow.com/a/25894818
has title: Java 8: how to use lambda expressions on JoinRowSets?
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
has body: I'm developing a feature that will be used among some of my company's products so I can't have product-specific code. I have the results of 2 queries stored on 2 JoinRowSet objects (I do have to use JoinRowSet because I have to join other queries' results with these ones later). Then, I need to intersect those 2 JoinRowSets but I don't know what class they "belong" to (I don't know if the query will return People, Contacts, Departments or any other thing). I was told I should use lambda expressions to do this but I'm finding some problems. I have converted one of the JoinRowSet to a Collection (I don't know how to use lambda expressions directly on a JoinRowSet), then I'm looping over one of the JoinRowSets and, for each column of this JoinRowSet, I want to get the records on the initial Collection that have the same value on that column. But, as I don't know the class of the data, I can't do something like u.getAge() because I don't have the property name. This is my method: public static void testLambdas() throws SQLException { ... //set the needed stuff to connect to database and query data JoinRowSet jrs1 = ... //result from query 1 JoinRowSet jrs2 = ... //result from query 2 Collection&lt;Row&gt; jrs2Collection = (Collection&lt;Row&gt;) jrs2.getRowSets();//collection to use on lambda expression while (jrs1.next()) { ResultSetMetaData metadata = jrs1.getMetaData(); for (int j = 1; j &lt;= metadata.getColumnCount(); j++) { String dataType = metadata.getColumnTypeName(j); Object colValue = null; if (dataType.equals("NUMBER")) { colValue = jrs1.getBigDecimal(j); } else if (dataType.equals("VARCHAR2")) { colValue = jrs1.getString(j); } else if (dataType.equals("DATE")) { colValue = jrs1.getTimestamp(j); } System.out.println(metadata.getColumnName(j)+ " (" + dataType +"): "+ colValue); Object o = jrs2Collection.stream() .filter(u -&gt; { try { return (u.getColumnObject(j).equals(colValue)); } catch (Exception e) { e.printStackTrace(); return false; } }) .collect(Coll…
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/25905699
has title: Finding all private fields without NoClassDefFoundError
linked to: http://stackoverflow.com/q/1196192
upvote count: 1
has answer: http://stackoverflow.com/a/25905828
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25905806
has comment: http://stackoverflow.com/comment/40547539
has comment: http://stackoverflow.com/comment/40547558
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/15315368
tagged with: reflection
possible better answer: http://stackoverflow.com/a/25905828
has body: I want to dynamically create a class composition map by enumerating private fields of a given set of classes. This works well with getDeclaredFields() with an isolated set of classes. But if the class contains a field which type is a class that is not available, the call fails with NoClassDefFoundError. Is there any way to enumerate private fields so that I can avoid this behaviour, for example one by one and catching the exception and carry on with rest of the fields?
type: Question
has comment: http://stackoverflow.com/comment/40548020
has answer: http://stackoverflow.com/a/25909226
accepted answer: http://stackoverflow.com/a/25909226
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25905861

http://stackoverflow.com/q/25956222
type: Question
has answer: http://stackoverflow.com/a/25956318
answer count: 2
score: 0
tagged with: android
has body: First of all let me tell that am new in Android Application Development. I am making an Application to set wallpapers, I got lots of code that repeat again and again, but a simple difference. I used to type codes like this InputStream is1 = getResources().openRawResource(R.drawable.wall1); InputStream is2 = getResources().openRawResource(R.drawable.wall2); InputStream is3 = getResources().openRawResource(R.drawable.wall3); InputStream is4 = getResources().openRawResource(R.drawable.wall4); InputStream is5 = getResources().openRawResource(R.drawable.wall5); InputStream is6 = getResources().openRawResource(R.drawable.wall6); InputStream is7 = getResources().openRawResource(R.drawable.wall7); InputStream is8 = getResources().openRawResource(R.drawable.wall8); InputStream is9 = getResources().openRawResource(R.drawable.wall9); InputStream is10 = getResources().openRawResource(R.drawable.wall10); InputStream is11 = getResources().openRawResource(R.drawable.wall11); InputStream is12 = getResources().openRawResource(R.drawable.wall12); InputStream is13 = getResources().openRawResource(R.drawable.wall13); InputStream is14 = getResources().openRawResource(R.drawable.wall14); InputStream is15 = getResources().openRawResource(R.drawable.wall15); Its really annoyingg... So i used a loop like this for(int i=1;i&lt;=15;i++) { InputStream is+i = getResources().openRawResource(R.drawable.wall+i); } but it's not working, Tell me any solution to my problem, Hop you understand what am expecting!
type: UnansweredQuestion
tagged with: java
has title: Can i use loops to multiple works on Android?
has answer: http://stackoverflow.com/a/25956309
tagged with: loops

http://stackoverflow.com/q/25960031
tagged with: huffman-code
has answer: http://stackoverflow.com/a/25960581
has comment: http://stackoverflow.com/comment/40645638
tagged with: file
has title: Huffman compress file (Got the tree but can't compress)- Java
accepted answer: http://stackoverflow.com/a/25960581
has comment: http://stackoverflow.com/comment/40647966
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40645289
tagged with: java
tagged with: compression
linked to: http://stackoverflow.com/q/4211705
linked to: http://stackoverflow.com/q/17727310
has comment: http://stackoverflow.com/comment/40645444
has comment: http://stackoverflow.com/comment/40645590
type: Question
has comment: http://stackoverflow.com/comment/40644530
has comment: http://stackoverflow.com/comment/40645489
has comment: http://stackoverflow.com/comment/40645610
score: 0
has body: Alright so I am trying to do a file compress using the Huffman tree. We got the tree that is working just fine but we are unable to figure out how to write the binary string we get into the file. So for example our tree returns: '110', it should mean this byte: '00000110' right? And if the returns: '11111111 11111110' it should mean what? Should we just write it in in byte? So the question is how do we convert the binary string we get into bytes so we can write it on the file? Thanks alot, Ara
has comment: http://stackoverflow.com/comment/40645689
answer count: 1

http://stackoverflow.com/q/26021770
type: Question
tagged with: inner-classes
upvote count: 2
accepted answer: http://stackoverflow.com/a/26021796
has comment: http://stackoverflow.com/comment/40757411
tagged with: garbage-collection
answer count: 1
has title: Enclosing type behaviour when the enclosing instance is nullified
has body: I ran the following snippet, which outputted Hey David. public class Test { public String name; public Test(String name) { this.name = name; } public class A { public String toString() { return "Hey " + name; } } public static void main(String[] args) { Test test = new Test("David"); A a = test.new A(); test = null; System.out.println(a); } } I also tested to call System.gc() before printing a but I am not sure it actually triggers immediatly a full GC so it might not be relevant. To be honest, before running the code I had no idea of what it was supposed to happen, because the actual behaviour seems as logical to me as if a NPE had been thrown, since name is attached to an instance which is nullified. Could you explain me why we observe that and how exactly work instances of an enclosing type ?
tagged with: java
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26021796
type: AnsweredQuestion
favorite count: 0

http://stackoverflow.com/comment/40661793
type: Comment
type: QuestionComment
has text: It is an e4 rcp application
comment on: http://stackoverflow.com/q/25968519
score: 0

http://stackoverflow.com/q/25921445
tagged with: java
tagged with: jpanel
answer count: 3
downvote count: 0
has body: I have a very simple problem. I am learning Java, and was given an assignment to draw a car. I did this all in one class that extends JPanel, and did the drawing within paintComponent(). I realize this is poor object-oriented programming, and decided to try to subclass some of the parts to rectify this situation. I tried to create a class that draws wheels, but was unsuccessful. Essentially, I wanted to be able to do this: Main Class extends JPanel paintComponent{ Wheel leftWheel = new Wheel(0, 50, 100); this.add(leftWheel); } This should draw a wheel at the point (0, 50) within the JPanel, and have a diameter of 100. However, i'm unsure how i'm supposed to control the positioning in the JPanel. When I do this, the wheel in drawn at the top center of my window. This is what my wheel class looks like: public class Wheel extends JComponent { private int x, y, diameter; private boolean clockwise; Wheel(int x, int y, int size, boolean cw) { this.setPreferredSize(new Dimension(size, size)); this.x = x; this.y = y; diameter = size; clockwise = cw; repaint(); } public void paintComponent(Graphics canvas) { super.paintComponent(canvas); canvas.setColor(Color.gray); canvas.fillOval(x,y,diameter,diameter); } } The x and y should be where it appears on the parent window, however, this is not the case in the following code (located in the parent class that extends JFrame): Wheel leftWheel = new Wheel(0,0,WHEEL_DIAMETER,true); this.add(leftWheel); The wheel doesn't draw at the top left of my window, it draws in the center of my window at the top. Am I doing something incorrectly? Sorry if I don't follow some Java conventions, I don't have any experience yet. Is this how I should be handling the drawing of the wheel, or is there a more accepted practice for doing this type of drawing? For example, in my JPanel class, if I add the following code: Wheel x = new Wheel(50,60,75,true); this.add(x); I get a frame sized 75x75 in which a wheel (sized 75x75) is drawn at the point (50,60) …
has answer: http://stackoverflow.com/a/25921880
favorite count: 0
has answer: http://stackoverflow.com/a/25922618
score: 9
tagged with: paintcomponent
has answer: http://stackoverflow.com/a/25921483
has title: Draw a car wheel
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40578047
has comment: http://stackoverflow.com/comment/40577842
has comment: http://stackoverflow.com/comment/40577588
possible better answer: http://stackoverflow.com/a/25921483
tagged with: jcomponent
accepted answer: http://stackoverflow.com/a/25921880
tagged with: swing
has comment: http://stackoverflow.com/comment/40577623
type: Question
upvote count: 9

http://stackoverflow.com/comment/40747357
comment on: http://stackoverflow.com/a/26016072
has text: You are missing const on your methods and I don't understand how the empty function works.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40565237
type: Comment
type: QuestionComment
has text: Added, it seems like code 503 issue but how can I solve it (works via browser).
comment on: http://stackoverflow.com/q/25915051
score: 0

webdriver
tags question: http://stackoverflow.com/q/25973997
tags question: http://stackoverflow.com/q/25920664
tags question: http://stackoverflow.com/q/25934749
type: Tag
tags question: http://stackoverflow.com/q/25913989
tags question: http://stackoverflow.com/q/26018790
tags question: http://stackoverflow.com/q/26014807
tags question: http://stackoverflow.com/q/25988884
tags question: http://stackoverflow.com/q/25913944
tag name: webdriver

http://stackoverflow.com/comment/40781134
type: QuestionComment
type: Comment
has text: @blackSmith No, I am using same Mapreduce job in loop for each file.
score: 0
comment on: http://stackoverflow.com/q/26033999

http://stackoverflow.com/comment/40642634
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25958991
has text: Thanks for your answer but it's not working. I'm using Spring-MVC and my web-app is on a Tomcat Server in my localhost
score: 0

http://stackoverflow.com/comment/40490188
comment on: http://stackoverflow.com/q/25873593
type: Comment
type: QuestionComment
has text: Is recompiling the code to fix the check not an option?
score: 0

http://stackoverflow.com/q/25945504
tagged with: design-patterns
upvote count: 6
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40635756
has body: I have an Observer Design pattern that uses a Thread to send my own Events. Sometimes the classes that are called are Android Activities and other times they are regular classes. The code in the Thread is NOT an Activity. I was getting this error: Can't create handler inside thread that has not called Looper.prepare() To avoid that run-time error I had to add Looper.prepare() inside the Thread. I am aware of this post: Can&#39;t create handler inside thread that has not called Looper.prepare() it contains the best information for this kind of problem, but still I don't know how to integrate the answer by mjosh into my Thread. Problem The call from the Thread to the Activity never happens. In isolation this code works, but not when Activities are waiting for the call. This class will send Events to other classes. This one runs with a Thread. public class EventBus { // Non essential code here. ... // Thread code. private class MyThread implements Runnable { @Override public void run() { while(true) { synchronized(list) { for(Observer o : list) // Execution transfers to Activity here. o.handleEvent(event); } } } } } Inside an Activity. public class FirstActivity extends Activity implements Observer { public void handleEvent() { // Never gets here. } } So how do I solve this problem? My whole app will have many Activities and many regular classes. To Solve my Problem I need a way to keep my Thread alive and making calls to Activities. This might be a mixture of adding some code to the Thread so that it can successfully send my calls to the Activities.
has comment: http://stackoverflow.com/comment/40635742
has comment: http://stackoverflow.com/comment/40635784
type: Question
linked to: http://stackoverflow.com/q/3875184
has comment: http://stackoverflow.com/comment/40635723
has comment: http://stackoverflow.com/comment/40635809
score: 4
has answer: http://stackoverflow.com/a/25966450
has title: How to call Activities from a non-Activity Thread?
has comment: http://stackoverflow.com/comment/40635600
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/40657207
tagged with: android-activity
favorite count: 0
linked to: http://stackoverflow.com/q/21048510
has comment: http://stackoverflow.com/comment/40619991
downvote count: 2
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/25966450

http://stackoverflow.com/comment/40789327
has text: you can find the answer here: http://stackoverflow.com/a/15656428/1778343
comment on: http://stackoverflow.com/q/26032859
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25950557
tagged with: directory
tagged with: controls
has body: I started with SWT programming and I am trying to reprogram this example, where CTabItem's are created within a CTabFolder. But since I am a very noob in GUI programming, some things are very unclear to me. What is the purpose of setData() and setControl() for a CTabItem? In which cases or for which situations I use these methods? I have read the API documentation for setData, which says: Sets the application defined widget data associated with the receiver to be the argument. The widget data is a single, unnamed field that is stored with every widget. But I don't understand this and also the documentation for setControl. Can anyone please explain me the purpose of these methods?
linked to: http://stackoverflow.com/q/11735485
accepted answer: http://stackoverflow.com/a/25950665
linked to: http://stackoverflow.com/q/2922681
linked to: http://stackoverflow.com/q/11599606
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40950192
tagged with: java
tagged with: swt
type: Question
has comment: http://stackoverflow.com/comment/40949712
has answer: http://stackoverflow.com/a/25950665
tagged with: ctabitem
score: 0
has title: SWT CTabItem meaning of setData and setControl
answer count: 1

http://stackoverflow.com/q/26006563
has comment: http://stackoverflow.com/comment/40729982
accepted answer: http://stackoverflow.com/a/26006616
type: AnsweredQuestion
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26006601
downvote count: 1
possible better answer: http://stackoverflow.com/a/26006599
has answer: http://stackoverflow.com/a/26006616
has answer: http://stackoverflow.com/a/26006599
has body: My program does not count 0 as an even number And I don't want to use for statement just while loop thank you import java.util.*; public class DigitAnalyst { public static void main(String[] args) { int zero=0; int lastdigit; Scanner inputNumber= new Scanner(System.in); System.out.println("enter any number: "); int number = inputNumber.nextInt(); while(number &gt; 0) { int zeros=0; int odds=0; int evens=0; while(number &gt; 0) { number=number/10; lastdigit=number%10; if (lastdigit==zero) zeros++; if (lastdigit % 2 == zero) evens++; if (lastdigit % 2 != zero) odds++; } System.out.println(odds +" odd digits"); System.out.println(evens +" even digits"); System.out.println(zeros +" zero digits"); } } }
score: 0
tagged with: java
has title: how can I count the number of odd, evens, and zeros in a multiple digit number in Java
answer count: 3
upvote count: 1

http://stackoverflow.com/comment/40707336
type: AnswerComment
score: 0
type: Comment
has text: Its pretty simple. What you need to do is provide expression within @Pointcut itself as mentioned in answer.
comment on: http://stackoverflow.com/a/25992338

http://stackoverflow.com/q/26024886
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27048486
type: Question
has title: Java Mail Initial Access check failure
tagged with: jakarta-mail
answer count: 1
tagged with: email
downvote count: 0
accepted answer: http://stackoverflow.com/a/27048486
favorite count: 0
has body: I am working with Java Mail API, i am getting this strange error: "Initial Access check failure" My configuration looks fine, URL, user, pwd, etc. Just cannot figure out why this message comes up. 550 5.7.1 Initial access check failure DEBUG SMTP: got response code 550, with response: 550 5.7.1 Initial access check failure RSET 250 2.5.0 Ok. DEBUG SMTP: MessagingException while sending, THROW: com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.1 Initial access check failure ; nested exception is: com.sun.mail.smtp.SMTPSenderFailedException: 550 5.7.1 Initial access check failure at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2133) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1630) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1132) at javax.mail.Transport.send0(Transport.java:254) at javax.mail.Transport.send(Transport.java:124) at com.mrd.utilities.SendMailMessage.sendNewsMobileDeviceAlert(SendMailMessage.java:277) at DBManager.sendLowVolumeEmailAlert(DBManager.java:241) at DBManager.executeQuery(DBManager.java:168) at DBManager.getConnection(DBManager.java:109) at MainClass.main(MainClass.java:37) Caused by: com.sun.mail.smtp.SMTPSenderFailedException: 550 5.7.1 Initial access check failure at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1637) ... 8 more QUIT 221 2.3.0 Bye received. Goodbye.
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/25912185
tagged with: java-stream
has answer: http://stackoverflow.com/a/25912296
tagged with: java-8
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25912296
score: 10
has answer: http://stackoverflow.com/a/25914130
upvote count: 10
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25914130
downvote count: 0
favorite count: 0
has title: Java 8 Stream.findAny() vs finding a random element in the stream
has body: In my Spring application, I have a Couchbase repository for a document type of QuoteOfTheDay. The document is very basic, just has an id field of type UUID, value field of type String and created date field of type Date. In my service class, I have a method that returns a random quote of the day. Initially I tried simply doing the following, which returned an argument of type Optional&lt;QuoteOfTheDay&gt;, but it would seem that findAny() would pretty much always return the same element in the stream. There's only about 10 elements at the moment. public Optional&lt;QuoteOfTheDay&gt; random() { return StreamSupport.stream(repository.findAll().spliterator(), false).findAny(); } Since I wanted something more random, I implemented the following which just returns a QuoteOfTheDay. public QuoteOfTheDay random() { int count = Long.valueOf(repository.count()).intValue(); if(count &gt; 0) { Random r = new Random(); List&lt;QuoteOfTheDay&gt; quotes = StreamSupport.stream(repository.findAll().spliterator(), false) .collect(toList()); return quotes.get(r.nextInt(count)); } else { throw new IllegalStateException("No quotes found."); } } I'm just curious how the findAny() method of Stream actually works since it doesn't seem to be random. Thanks.

http://stackoverflow.com/q/25903489
has comment: http://stackoverflow.com/comment/40544417
tagged with: regex
has body: I have a small problem, but it's hard for me to solve it. I have built a String that is a collection of some object's attributes, constructed and delimited by ||. But whenever I have some null attribute, it keeps on printing null, I want to replace null with empty string. For example, for the input ADS||abc||null||null I want it to become ADS||abc|||| I tried these two, but they didn't work: string.replace(null,"") string.replace("null","") Can someone please help?
has answer: http://stackoverflow.com/a/25903563
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40543942
tagged with: java
has answer: http://stackoverflow.com/a/25903603
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/25903564
score: 3
has comment: http://stackoverflow.com/comment/40543902
has comment: http://stackoverflow.com/comment/40544868
has answer: http://stackoverflow.com/a/25903564
has comment: http://stackoverflow.com/comment/40544751
accepted answer: http://stackoverflow.com/a/25903563
has answer: http://stackoverflow.com/a/25908974
tagged with: replace
upvote count: 4
has title: Replacing null String to empty String
has comment: http://stackoverflow.com/comment/40543910
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/40571731
comment on: http://stackoverflow.com/q/25908921
has text: please provide an [MCVE](http://stackoverflow.com/help/mcve) so we can tell you where your problem is. Good Luck
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26001110
has comment: http://stackoverflow.com/comment/40721368
has comment: http://stackoverflow.com/comment/40721324
answers question: http://stackoverflow.com/q/26001021
downvote count: 0
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3
has body: To avoid instantiating, you can write: Class&lt;MyObj&lt;T&gt;&gt; clazz = (Class) MyObj.class; Due to erasure, there exists a single Class instance for MyObj, regardless of whatever type parameters it might have, so although this is ugly, it is safe.
accepted answer of: http://stackoverflow.com/q/26001021
has comment: http://stackoverflow.com/comment/40720702

http://stackoverflow.com/a/25885548
score: 4
has body: Sorry... I don't know why that is happening... I had similar problem today. But to fix your problem, you can go to yourproject/.settings/org.eclipse.wst.common.project.facet.core.xml and change there manually. refresh your project and it should be good to go. :) You will be looking for something like &lt;installed facet="java" version="1.7"/&gt;
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25885323
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25885323

http://stackoverflow.com/q/25920330
type: Question
tagged with: overloading
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40575340
answer count: 6
linked to: http://stackoverflow.com/q/2000137
linked to: http://stackoverflow.com/q/10623913
downvote count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/40575063
possible better answer: http://stackoverflow.com/a/42309711
upvote count: 5
has answer: http://stackoverflow.com/a/42309711
has body: I want to get this thing straight: does overloading apply to methods in sub/super classes, or only to methods of one class can be overloaded? public class Super{ private void method(){ } } class Sub extends Super{ private void method(){ } private void method(int x){ } } Are both methods of Sub legally overloaded? Is the method of Super overloaded as well?
accepted answer: http://stackoverflow.com/a/25920598
has answer: http://stackoverflow.com/a/25920856
has comment: http://stackoverflow.com/comment/40574930
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25920454
has answer: http://stackoverflow.com/a/49702429
has title: Overloading a private method in Java
has answer: http://stackoverflow.com/a/54696426
has answer: http://stackoverflow.com/a/25920598
has comment: http://stackoverflow.com/comment/40575086
has comment: http://stackoverflow.com/comment/40575217

http://stackoverflow.com/q/25875187
tagged with: web-services
has title: How to request from a SOAP webservice, convert the SOAP response to XML and compare it to another SOAP response, in JAVA
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/13614508
accepted answer: http://stackoverflow.com/a/25875682
type: Question
tagged with: automation
linked to: http://stackoverflow.com/q/25939065
linked to: http://stackoverflow.com/q/15940234
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25875682
tagged with: http://stackoverflow.com/tag/xml
has body: i am completely new in doing this 3 steps, so can you please help me step by step. (I understand Java language, did couple of scripts here and there but never touched SOAP stuff). I need to do this: 1) Request from two SOAP services and store the responses in two objects. 2) Transform the response in XML(maybe, maybe not, depends if the output is in the form &lt; tag>&lt; /tag> then no transformation required, but if it is &lt; n32:tag>&lt; n32:tag> then i will want to get rid of "n32". 3) Compare those two responses and see where is the difference at node/tag and maybe inside tag level (maybe using XMLUnit) 4) Report the differences, in console.(not as an error in JUnit). Thanks!
tagged with: soap

real-time
tags question: http://stackoverflow.com/q/25903776
type: Tag
tag name: real-time
tags question: http://stackoverflow.com/q/25895974

http://stackoverflow.com/comment/40612633
score: 0
type: Comment
type: QuestionComment
has text: @shinjw The full code is present on author's github profile. https://github.com/agoncal/agoncal-book-javaee7/tree/master/chapter02/chapter02-putting-together/src/main
comment on: http://stackoverflow.com/q/25940412

http://stackoverflow.com/q/25901393
has body: I'm having some trouble understanding Java's inheritance. I understand that something like this is possible, but what is the purpose of it? Animal pig0 = new Pig(); What is happening here? If someone wanted to create a new Pig object in this example, why not just do this? Pig pig0 = new Pig(); Or if they wanted an Animal object, why not just do this? Animal pig0 = new Pig(); What is the purpose of allowing this kind of thing, and what is really going on? Note that these examples assume that Pig is a subclass of Animal. Thanks.
possible better answer: http://stackoverflow.com/a/25901567
has answer: http://stackoverflow.com/a/25901478
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40540089
has answer: http://stackoverflow.com/a/25901579
type: AnsweredQuestion
tagged with: object
accepted answer: http://stackoverflow.com/a/25901478
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25901567
has title: In Java, why is the parent class sometimes on the left when creating a new object?
tagged with: inheritance
tagged with: class
answer count: 3

http://stackoverflow.com/comment/40693031
type: QuestionComment
comment on: http://stackoverflow.com/q/25985956
has text: I can't see why it would give you an error (and it's `null` not `NULL`). Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
score: 0
type: Comment

http://stackoverflow.com/comment/40498169
comment on: http://stackoverflow.com/q/25878065
type: Comment
type: QuestionComment
has text: if you need to access cars outside of the main method, declare them as static and at the class level, your current cars array only exists inside the main method, and then its gone.
score: 1

http://stackoverflow.com/q/25874322
downvote count: 0
tagged with: amazon-web-services
favorite count: 0
has answer: http://stackoverflow.com/a/51654518
score: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31497549
tagged with: java
has body: I am unable to properly add attributes. I'm using AWS 1.7 When I add them, they show in the message body, not the attributes. I can see this when I login to the AWS console. I add the message attributes with this code: Message awsMessage = new Message(); Map&lt;String, MessageAttributeValue&gt; messageAttributes = new HashMap&lt;String, MessageAttributeValue&gt;(); messageAttributes.put("email", new MessageAttributeValue() .withDataType("String") .withStringValue(email)); messageAttributes.put("data", new MessageAttributeValue() .withDataType("String") .withStringValue(newFileName)); messageAttributes.put("template", new MessageAttributeValue() .withDataType("String") .withStringValue(filename)); awsMessage.setMessageAttributes(messageAttributes); I tried using this to pull out the attributes: List&lt;Message&gt; messages = SQSUtilityClass.getMessagesFromQueue(QUEUE_URL); int size = messages.size(); Map&lt;String, String&gt; attributes = new HashMap&lt;String, String&gt;(); System.out.println("Size: "+size); for(int x =0;x&lt;size;x++){ Message message = messages.get(x); //System.out.println(message.getBody()); attributes = message.getAttributes(); for(String key: attributes.keySet()){ System.out.println(key + " - "+ attributes.get(key)); } } Still, my attributes are in the message body when I view via AWS console.
has title: Amazon SQS Message Attributes
type: Question
upvote count: 2
tagged with: amazon-sqs
tagged with: message-queue
answer count: 2

http://stackoverflow.com/a/25889137
type: Answer
accepted answer of: http://stackoverflow.com/q/25888817
has comment: http://stackoverflow.com/comment/40528955
answers question: http://stackoverflow.com/q/25888817
has comment: http://stackoverflow.com/comment/70832226
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40526172
has comment: http://stackoverflow.com/comment/40526391
has body: I had a similar issue when I tried to write to some characteristic I can't remember though if i got the same error code or not. (And it worked on some devices while it didn't on others). What turned out to be the problem is the property of the characteristics and the writeType. Because characteristics can have values set: write without response OR write with response In reference to this property you have to set the writeType before writing the actual data to the characteristic. You can set the type once you get the Characteristic but before writing to it. BluetoothGattCharacteristic tChar = syncService.getCharacteristic(SYNC_HEIGHT_INPUT_CHAR); if (tChar == null) throw new AssertionError("characteristic null when sync time!"); // use one of them in regards of the Characteristic's property tChar.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE); //tChar.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT); tChar.setValue(/*another int*/, BluetoothGattCharacteristic.FORMAT_SINT32, 0); gatt.writeCharacteristic(tChar);
downvote count: 0
has comment: http://stackoverflow.com/comment/40526343
score: 8
upvote count: 8

http://stackoverflow.com/comment/89890611
type: AnswerComment
comment on: http://stackoverflow.com/a/25888116
has text: Works fine, but don't forget to re-import the pom.xml file, right click -->Maven-->Reimport
type: Comment
score: 14

http://stackoverflow.com/a/25959697
has body: Whenever you need need to avoid duplicates, think Set List&lt;String&gt; lst = Arrays.asList("Foo", "Foo", "Bar", "Baz"); for(String s : new HashSet&lt;&gt;(lst)) { System.out.println(s); }
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25959662

http://stackoverflow.com/comment/40570183
has text: Day of week and first day of week are not the same thing.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25917641
score: 1

http://stackoverflow.com/q/25918169
favorite count: 0
has comment: http://stackoverflow.com/comment/40572356
has comment: http://stackoverflow.com/comment/40571738
has comment: http://stackoverflow.com/comment/40570813
has answer: http://stackoverflow.com/a/25918855
accepted answer: http://stackoverflow.com/a/25918855
has comment: http://stackoverflow.com/comment/40571111
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25918402
has comment: http://stackoverflow.com/comment/40572183
has comment: http://stackoverflow.com/comment/40571440
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25918402
tagged with: java
has comment: http://stackoverflow.com/comment/40571035
type: Question
upvote count: 2
answer count: 2
has title: Move a element in an array around in other arrays
has comment: http://stackoverflow.com/comment/40571191
tagged with: arrays
has body: I am making a program that keeps track of races. I would like to be able to move one race a certain number of spots away from where it used to be and then have all the things in between move down. I have an array of "Rounds", and each "Round" has an array of "Races". Round[] rounds = {new Round(), new Round(), new Round()}; Each Round has an array of Races. Race[] races = {new Race(), new Race(), new Race()}; I could also represent like this: 0.0, 0.1, 0.2; 1.0, 1.1, 1.2; 2.0, 2.1, 2.2 I want to take the 0.2 object and move it forward 3 spots in between 1.2 and 2.0. Keep in mind that doing this will move the object in between arrays and therefore, have to move everything in between the three arrays. So it will look like this after moving: 0.0, 0.1, 1.0; 1.1, 1.2, 0.2; 2.0, 2.1, 2.2 Again, this is moving the object between arrays and not in the same one.

http://stackoverflow.com/comment/42232552
has text: thanks, i used this permission. please read my question one more time. my app work correctly but not in all Android devices... :(
comment on: http://stackoverflow.com/a/26832893
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25977102
has body: Does a call to signal(), await(), or signalAll() always need to be in between lock() and unlock()? Example: import java.util.Scanner; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.Condition; class A{ int num=0; boolean onoff=false; private final ReentrantLock key=new ReentrantLock(); private final Condition setCondi=key.newCondition(); void input(int i){ key.lock(); try{ if(onoff==true) setCondi.await(); num=i; onoff=true; setCondi.signal(); } catch(InterruptedException e){ e.printStackTrace(); } finally{ key.unlock(); } num=i; onoff=true; setCondi.signal();
answer count: 1
favorite count: 0
score: -1
has title: should signal() method always be in between lock() and unlock()?
upvote count: 2
type: UnansweredQuestion
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25980270
tagged with: methods
type: Question
tagged with: signals

http://stackoverflow.com/comment/40496594
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25877286
type: Comment
has text: BigDecimal is the way to go...

http://stackoverflow.com/comment/40498435
score: 0
has text: Use a BufferedReader and readLine
comment on: http://stackoverflow.com/q/25878217
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25935211
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25934791
downvote count: 0
has body: Why does it fail, at run-time, when the bean I've set up doesn't require a no argument constructor? The bean you have set up does require a no-arg constructor. I am no Spring expert (get stuck in them all the time as a matter of fact) but what you are asking Spring to do it: Create a Customer Object using no-arg constructor Create a Person Object using no-arg constructor Set properties in the person object using setters Set person property in the customer object to the person object created above, again using setters freakman's answer shows how to create the Person object using constructor argument, I imagine you can similarly create customer object as well. Then you should not need the no-arg ctors.

http://stackoverflow.com/a/25988155
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25988086
has body: Your code is iterating over the track list twice. One of the for loops needs to go. Either: int sum = 0; for (int i = 0; i &lt; tracksN.size(); i++) { Track track = tracksN.get(i); sum += track.getDur(); } Or int sum = 0; for (Track track : tracksN) { sum += track.getDur(); } Between these two approaches, the second approach is better as it will work correctly (with good performance) with all List&lt;> types, not just with ArrayList&lt;>. It's also simpler.
answers question: http://stackoverflow.com/q/25988086
score: 1

http://stackoverflow.com/comment/59793682
score: 0
type: Comment
comment on: http://stackoverflow.com/a/36019834
has text: I think I figured out the problem. InetAddress address = InetAddress.getByName(host); System.out.println(address.getHostAddress()); .. For host = "localhost" I get 127.0.0.1, but for "t-mb-vik" I get the external ip. I checked my /etc/hosts file and it looks good. In fact I wrote a C program and that returns 127.0.0.1. This boils down to jvm not able to read the updated /etc/hosts file or is caching something.
type: AnswerComment

http://stackoverflow.com/q/26013563
tagged with: multithreading
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26014194
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26013970
type: Question
has title: Multi Thread java downloader downloading corrupted file?
tagged with: download-manager
accepted answer: http://stackoverflow.com/a/26014194
possible better answer: http://stackoverflow.com/a/26013970
has body: I am attempting to make a multiThread downloader in java. It works but the file that I download is always missing some bytes. I have searched and found many example of multiThreaded web crawlers but nothing simple, so can anyone tell me if my method could work? I don't know if the problem is with ordering the bytes. I have tried BlockingQueue but it did not work URL url = new URL(mURL); final HttpURLConnection conn; conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(10000); conn.connect(); final BufferedInputStream in = new BufferedInputStream(conn.getInputStream()); final File f = new File("tr.exe"); if (f.exists()) { f.delete(); } // open the output file and seek to the start location Thread t1 = new Thread() { public void run() { try { RandomAccessFile raf = new RandomAccessFile(f, "rw"); raf.seek(0); int numRead; int mStartByte = 0; byte data[] = new byte[conn.getContentLength() / 2]; while (((numRead = in.read(data, 0, 1024)) != -1) &amp;&amp; (mStartByte &lt; conn.getContentLength() / 2)) { // write to buffer raf.write(data, 0, numRead); // increase the startByte for resume later mStartByte += numRead; // increase the downloaded size } raf.close(); } catch (FileNotFoundException ex) { Logger.getLogger(MyDownloader.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(MyDownloader.class.getName()).log(Level.SEVERE, null, ex); } } }; Thread t2 = new Thread() { public void run() { try { RandomAccessFile raf = new RandomAccessFile(f, "rw"); raf.seek(conn.getContentLengthLong() / 2); int numRead; int mStartByte = conn.getContentLength() / 2; byte data[] = new byte[conn.getContentLength() / 2]; while (((numRead = in.read(data, 0, 1024)) != -1) &amp;&amp; (mStartByte &lt; conn.getContentLength())) { // write to buffer raf.write(data, 0, numRead); // increase the startByte for resume later mStartByte += numRead; // increase the downloaded size } raf.close(); } catch (FileNotFoundException ex) { Logger.getLogger(…
score: 0

http://stackoverflow.com/comment/40704324
comment on: http://stackoverflow.com/q/25991841
score: 0
type: Comment
type: QuestionComment
has text: @BJHargrave `apache-felix` tag?

http://stackoverflow.com/comment/40582511
type: Comment
has text: Thanks, but I copied the while loop for user input y/n from our teacher, because she did not teach it at that time. Other than that, thank you for helping me! I appreciate it.
comment on: http://stackoverflow.com/a/25882013
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40674210
has text: Try to give the **full path** to the jars. I believe that there is a difference between what you think is your root folder and what Java thinks about it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25975893

http://stackoverflow.com/q/26032198
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40873298
score: 0
tagged with: jquery
tagged with: kendo-ui
has body: Can anybody tell me how to save data by kendo ui and java servlet. That means i have design html fields like Student ID, Student name and want to save it using kendo ui framework and java servlet and return json formatted data after execute my insert query from java servlet.Please consider i am very new to java. Here is my html User: Password: Save And here is my .js to call my .java SaveCommonInformation: function () { var objBranchInfo = 0; var serviceUrl = "/api/LoginController"; jQuery.ajax({ url: serviceUrl, // data: jsonParam, type: "POST", processData: true, contentType: "application/json", dataType: "json", success: onSuccess, error: onFailed }); function onSuccess(jsonData) { if (jsonData == "Success") { alert("Success"); } else if (jsonData == "Common Already Exist") { alert(); } else { alert("Exist"); } } function onFailed(error) { alert("Error"); } } and this is my .java @WebServlet("/LoginController") public class LoginController extends HttpServlet { private static final long serialVersionUID = 1L; public LoginController() { super(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } } but i can't understand how actually connect to database and insert to database something and also return "Success" or "Common Already Exist" in json formate
has comment: http://stackoverflow.com/comment/40777012
has comment: http://stackoverflow.com/comment/40776428
answer count: 0
type: UnansweredQuestion
tagged with: mysql
has title: Save data by kendo ui and java servlet

http://stackoverflow.com/comment/40529810
has text: Does it work to ssh to the same hostname and port using the command line?
comment on: http://stackoverflow.com/q/25893196
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40516191
comment on: http://stackoverflow.com/q/25888007
type: Comment
type: QuestionComment
has text: @mystic_knight That means that arraylist has no data at all. Please debug and check why you are not getting data.
score: 1

http://stackoverflow.com/a/25980126
score: 0
has body: Move it out of your src folder and into the project root, as that is the default currend direcotry of any launch.
type: Answer
has comment: http://stackoverflow.com/comment/40682298
answers question: http://stackoverflow.com/q/25980009

http://stackoverflow.com/q/25992944
answer count: 1
has title: Jackson - Ignore properties whose data type does not match
tagged with: jackson
has comment: http://stackoverflow.com/comment/40704587
type: UnansweredQuestion
has body: I have many JSON files, which i am parsing using Jackson. So a part of my JSON looks like "data": { "k": "ewt", "e": "dwpc", "d": 2, "ex": 0, "t": 3439 } "data": { "k": "mmm1", "e": [{ "x": 548, "y": 330, "t": 35733 }, { "x": 541, "y": 342, "t": 36354 }], "min": 0, "max": 0, "avg": 0 } Here, if iyou notice, in the first "data" block type of "e" is string and in the second the type is Array. My concern is only with the second type of "e" that is array, so I made my POJO beans as follows - Class data.java ... @JsonProperty("e") private List&lt;MouseDataArray&gt; e = new ArrayList&lt;MouseDataArray&gt;(); some more properties .. and getters and setters .. And Class MouseDataArray.java @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "x", "y", "t" }) public class MouseDataArray { @JsonProperty("x") private Long x; @JsonProperty("y") private Long y; @JsonProperty("t") private Long t; .. getters and setters } Now the thing is I am only concerned with the property "e" of type Array, and not interested in the String type property "e". So When it parses, it throuws exception Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token Which is expected, but I want it to just skip the property e of type string rather than trying to map it to the Array type. Thanks.
has answer: http://stackoverflow.com/a/26026428
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40704692
type: Question
score: 0

http://stackoverflow.com/comment/40687840
type: AnswerComment
comment on: http://stackoverflow.com/a/25975822
type: Comment
has text: `jObj = new JSONObject(json);` as your parser return?
score: 0

timer
tag name: timer
type: Tag
tags question: http://stackoverflow.com/q/26005336
tags question: http://stackoverflow.com/q/25959104
tags question: http://stackoverflow.com/q/25901194
tags question: http://stackoverflow.com/q/25945087
tags question: http://stackoverflow.com/q/25946557
tags question: http://stackoverflow.com/q/25941261

http://stackoverflow.com/comment/40576596
type: Comment
has text: you method makes complete sense as to WHY it would work... but I continue to get an error: **javax.servlet.ServletException: Attempt to coerce a value of type "java.lang.Long" to type "java.util.Date"**
comment on: http://stackoverflow.com/a/25920978
type: AnswerComment
score: 0

http://stackoverflow.com/q/26032634
tagged with: jsp
has comment: http://stackoverflow.com/comment/40777207
tagged with: image
tagged with: servlets
has answer: http://stackoverflow.com/a/26038204
accepted answer: http://stackoverflow.com/a/26038204
score: 0
has comment: http://stackoverflow.com/comment/40777547
has comment: http://stackoverflow.com/comment/40777293
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/40787595
has title: How to display a default image when image source is a servlet?
has comment: http://stackoverflow.com/comment/40786414
has comment: http://stackoverflow.com/comment/40777465
type: AnsweredQuestion
tagged with: java
has body: In my JSP/ Servlet setup, for displaying user profile images I am directing the img tag to get the image from servlet by specifying servlet URL in src tag and then returning image in response from servlet. Sevlet does below things upon receiving an image request, It gets the image from database in BLOB format Prepares image from the byte[] and returns the image in response object with appropriate headers. My problem is since Signup page doesn't has image upload option so new users don't have their image in database i.e. so the BLOB is NULL. How can I display a default image for all such users ? EDIT Based on comments received I just wanted to note that. I am aware of the solutions where we set the default value either in database (while creating the user) or return the default image array when there is NULL in database. I am already using the later case. By this question I just wanted to discuss about any other possible solutions.
type: Question

http://stackoverflow.com/q/26033269
tagged with: linux
has answer: http://stackoverflow.com/a/26033444
has comment: http://stackoverflow.com/comment/40788989
favorite count: 0
has comment: http://stackoverflow.com/comment/40778676
has answer: http://stackoverflow.com/a/26033433
type: UnansweredQuestion
has title: How many threads/process can i run on my 64bit machine
downvote count: 1
score: 2
has body: I want to know : is my system can run 50000 no. of parallel threads/process or not? For this i changed my 'ulimit max process' and '/proc/sys/kernel/pid_max' to 50000. But still i'm not able to cross ~33000 no. of process/threads. To count no. of process/threads on my system i am using : ps -eL|wc -l And I wrote a java program to create those no. of threads. but in last i'm getting this exception: Java HotSpot(TM) 64-Bit Server VM warning: Attempt to protect stack guard pages failed. Java HotSpot(TM) 64-Bit Server VM warning: Attempt to protect stack guard pages failed. Java HotSpot(TM) 64-Bit Server VM warning: Attempt to protect stack guard pages failed. Java HotSpot(TM) 64-Bit Server VM warning: Attempt to deallocate stack guard pages failed. Total thread created #**32515** Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:640) at HowManyThreads.main(HowManyThreads.java:12) Java HotSpot(TM) 64-Bit Server VM warning: Attempt to deallocate stack guard pages failed. Java HotSpot(TM) 64-Bit Server VM warning: Attempt to allocate stack guard pages failed. ^CJava HotSpot(TM) 64-Bit Server VM warning: Exception java.lang.OutOfMemoryError occurred dispatching signal SIGINT to handler- the VM may need to be forcibly terminated Please help me to create 50000 no. of process/thread. ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 2066250 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 150000 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 40000 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited cat /proc/sys/kernel/pid_max 50000 Java program package create.threads; …
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/344203
upvote count: 3

http://stackoverflow.com/a/26031765
score: 0
type: Answer
has body: First, the correct way is to use roles. In you AuthenticationProvider, you give a GrantedAuthority ROLE_ADMIN to admin users, by slightly modifying it : List<GrantedAuthority> grantedAuths = new ArrayList<GrantedAuthority>(); // only if user is recognized as admin grantedAuths.add(new SimpleGrantedAuthority("ROLE_ADMIN") auth = new UsernamePasswordAuthenticationToken(name, password); Then you will be able to use .antMatchers("/admin/**").access("hasRole('ROLE_ADMIN')") to restrict access to /admin/** to admin users, and you can put in a JSP page <sec:authorize access="hasRole('ROLE_ADMIN')"> This content will only be visible to users who have the "ROLE_ADMIN" authority in their list of GrantedAuthority s. </sec:authorize> as proposed by 909 Niklas Anyway, I almost never had to implement an AuthenticationProvider. I generally use a DaoAuthenticationProvider and a relevant UserDetailsService (InMemoryUserDetailsManager for tests and JdbcUserDetailsManager when the users are stored in a true database).
answers question: http://stackoverflow.com/q/26026521

http://stackoverflow.com/comment/40777657
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26002579
has text: It catches mails that aren't added to the delivery process, but has no conception of mails being sent or not, at least as my understanding goes.
score: 0

http://stackoverflow.com/a/25877176
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25876962
has body: if can you change the code, do it like this: public static void repeat() { while (otherFunc()) ; } public static boolean otherFunc() { if (something){ return true; } //more stuff... return false; }
upvote count: 1

http://stackoverflow.com/comment/40524671
type: Comment
has text: does org.apache.activemq.transport.TransportListener helps in this in any way? (I am using failover uri (master-slave))
comment on: http://stackoverflow.com/a/25892955
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40666899
has text: You need at least one default constructor or a factory method or something like that. A constructor with the class itself is quite useful if you want to make a clone, as guido said.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25972204

http://stackoverflow.com/comment/40606369
has text: Tomorrow I will try, today I haven't time anymore :/ I'll reply to you here :) Thank you so much !! @Fllo
score: 0
comment on: http://stackoverflow.com/q/25936349
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40659459
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25967918
type: QuestionComment
has text: A class is missing. The error message seems pretty clear to me.

http://stackoverflow.com/comment/40745494
type: AnswerComment
type: Comment
has text: OMG, finally, it worked when I also removed the parameter level annotation, I was so focused on the method level annotations that I didn't consider that one! Thank you so much mate, you really did more than I expected, you rock!
comment on: http://stackoverflow.com/a/25990689
score: 0

opencv
tags question: http://stackoverflow.com/q/25890322
type: Tag
tags question: http://stackoverflow.com/q/25954765
tags question: http://stackoverflow.com/q/25879534
tag name: opencv
tags question: http://stackoverflow.com/q/25912928
tags question: http://stackoverflow.com/q/26016116
tags question: http://stackoverflow.com/q/25915298
tags question: http://stackoverflow.com/q/25932676
tags question: http://stackoverflow.com/q/25902179
tags question: http://stackoverflow.com/q/25943837
tags question: http://stackoverflow.com/q/25894945
tags question: http://stackoverflow.com/q/25979940
tags question: http://stackoverflow.com/q/25939105

http://stackoverflow.com/q/26022359
favorite count: 0
has comment: http://stackoverflow.com/comment/40758564
has comment: http://stackoverflow.com/comment/40758516
has body: I'm reading a byte[] from a device and trying to interpret it as an integer array in Java with the help of the ByteBuffer class but I'm getting an index out of bounds error. Look here: byteBuffer.put(bytes); // put the array of bytes into the byteBuffer System.out.println("the value I want is " + byteBuffer.getInt(16*4)); // gives me the number I want, but I'd rather deal with an integer array like this: System.out.println("the value I want is " + byteBuffer.asIntBuffer().get(16)); // index out of bounds? Why??
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: Java ByteBuffer class
has answer: http://stackoverflow.com/a/26022516
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40758599
tagged with: bytebuffer
accepted answer: http://stackoverflow.com/a/26022516

http://stackoverflow.com/q/26021989
has title: Java - Full Screen JFrame is not shown on Print Screen/Screen recordings?
accepted answer: http://stackoverflow.com/a/26025357
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: frame
has body: I was wondering what might be the cause of the problem? So basically.. When I run my program the JFrame pops up, but if I try to record it using Print Screen or Skype Screenshare or anything like that the JFrame is not shown? It is fullscreen JFrame. package com.game; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Toolkit; import javax.swing.JFrame; public class Frame extends JFrame { final String title = ""; static GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0]; public Frame(){ setTitle(title); setSize(Toolkit.getDefaultToolkit().getScreenSize()); Screen.Width = getWidth(); Screen.Height = getHeight(); setResizable(false); setUndecorated(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); device.setFullScreenWindow(this); Screen screen = new Screen(this); //Screen is a JPanel. add(screen); setVisible(true); } public static void main(String[] args) { Frame frame = new Frame(); } } All the help is greatly Appreciated. :) Thank you.
has answer: http://stackoverflow.com/a/26025357
tagged with: jframe
tagged with: screen
tagged with: fullscreen
type: AnsweredQuestion

http://stackoverflow.com/comment/40618710
type: AnswerComment
has text: I am using eclipse to debug my java program usually and it is pretty good tools. :-)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25944592

http://stackoverflow.com/q/26003580
has body: I have to draw a perimeter of a rectangle using specifications entered by the user- it's supposed to look like this ********** * * * * * * ********** by mines has all the center full- how do I get the center to be white space? this is my code so far SOURCE CODE package lab5; import java.util.Scanner; public class Lab5 { public static void main(String[] args) { Scanner inputReader = new Scanner(System.in); int i, j, width, height; String x; System.out.print("Enter a character: "); x = inputReader.nextLine(); System.out.print("Enter a height: "); height = inputReader.nextInt(); System.out.print("Enter a width: "); width = inputReader.nextInt(); for(i = 1; i &lt;=height; i++) { for(j = 1; j &lt;= width; j++) { System.out.print(x); } System.out.println(); } } }
has answer: http://stackoverflow.com/a/26003683
answer count: 5
score: -2
type: AnsweredQuestion
tagged with: netbeans
has answer: http://stackoverflow.com/a/26003616
accepted answer: http://stackoverflow.com/a/26003738
downvote count: 2
has comment: http://stackoverflow.com/comment/40764090
has comment: http://stackoverflow.com/comment/40724425
possible better answer: http://stackoverflow.com/a/26003616
type: Question
has title: Drawing the perimeter of a rectangle with white space in the middle
tagged with: java
has comment: http://stackoverflow.com/comment/40724662
has answer: http://stackoverflow.com/a/26003673
upvote count: 0
has answer: http://stackoverflow.com/a/26003738
has answer: http://stackoverflow.com/a/26003868
favorite count: 0

http://stackoverflow.com/a/26831395
type: Answer
has body: I think it may be failing because you had this parameter in the call to the GPIOPinConfig constructor: GPIOPinConfig.DIR_OUTPUT_ONLY Maybe try GPIOPinConfig.DIR_BOTH_INIT_OUTPUT instead. Look here for the different values and their meanings: https://docs.oracle.com/javame/8.0/api/dio/api/index.html
answers question: http://stackoverflow.com/q/25890034
score: 0

http://stackoverflow.com/q/25933171
has comment: http://stackoverflow.com/comment/40597693
has comment: http://stackoverflow.com/comment/40597558
has answer: http://stackoverflow.com/a/25933487
type: Question
has comment: http://stackoverflow.com/comment/40597556
tagged with: java
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40597656
has answer: http://stackoverflow.com/a/25933334
has body: So I have a problem where if I type this link on the browser and hit enter, an activation happens. I just want to do the same through Java. I don't need any kind of response from the URL. It should just do the same as entering the URL on a browser. Currently my code doesn't throw an error, but I don't think its working because the activation is not happening. My code: public static void enableMachine(String dns){ try { String req= "http://"+dns+"/username?username=sputtasw"; URL url = new URL(req); URLConnection connection = url.openConnection(); connection.connect(); /*BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); String strTemp = ""; while (null != (strTemp = br.readLine())) { System.out.println(strTemp); }*/ } catch (Exception ex) { ex.printStackTrace(); } } What's the problem?
has comment: http://stackoverflow.com/comment/40597733
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40597756
has comment: http://stackoverflow.com/comment/40597786
has title: Simulate URL entering on java
has comment: http://stackoverflow.com/comment/40597771

http://stackoverflow.com/q/25913290
favorite count: 0
type: UnansweredQuestion
upvote count: 3
tagged with: java
type: Question
score: 3
tagged with: pmd
tagged with: intellij-idea
has body: I have upgraded to Java 8 and when I try to run the task sonarRunner in order to get the reports I get the following message. Execution failed for task ':sonarRunner'. org.sonar.api.utils.XmlParserException: org.sonar.api.utils.SonarException: Unsupported Java version for PMD: 1.8 Is Java 8 supported in PMD? If yes how can I solve this problem? Many thanks
tagged with: sonarqube
has title: Java 8 for Sonar, PMD, Findbugs and Checkstyle in IntelliJ
has answer: http://stackoverflow.com/a/25916359
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/40631271
type: Comment
type: AnswerComment
has text: umm... I think I ask a very stupid problem...
comment on: http://stackoverflow.com/a/25952786
score: 0

http://stackoverflow.com/comment/40749048
comment on: http://stackoverflow.com/a/26016964
type: AnswerComment
has text: Then maybe use `setBackground()` on the `ImageView` with the background you want and on the canvas only drawn on it without the background
type: Comment
score: 1

http://stackoverflow.com/q/25965479
tagged with: java
has answer: http://stackoverflow.com/a/25970568
has title: Why shouldn't we use both jspViewResolver and TilesViewResolver together?
type: Question
tagged with: apache-tiles
score: 0
tagged with: tiles
answer count: 1
has comment: http://stackoverflow.com/comment/40660987
has comment: http://stackoverflow.com/comment/40664014
has body: I created Spring MVC with Tiles project. My controller returns a string "hello" which is a logical file name and I have jsp called as hello.jsp. In tiles.xml I should have a definition named hello which extends a definition template. My basic definition is mapped to layout.jsp. When I add the jspViewResolver, it takes me to hello.jsp, but if I comment it out it takes me to layout.jsp which is rendered based on the definition of hello in tiles.xml. So, why we shouldn't have both jspViewResolver and tilesViewResolver together?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40658339
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/q/25926286
tagged with: spring-hateoas
has title: Generating consistent resource links in Spring
has answer: http://stackoverflow.com/a/31189292
has answer: http://stackoverflow.com/a/25932739
tagged with: hateoas
has answer: http://stackoverflow.com/a/25926582
score: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
answer count: 4
tagged with: spring-mvc
has body: When producing links using this line of code: indexResource.add(linkTo(IndexController.class).withSelfRel()); This JSON is produced: { "links" : [ { "rel" : "self", "href" : "http://localhost:8080" } ] } However, resource links produced by Spring Data Rest produce this JSON: { "_links" : { "self" : { "href" : "http://localhost:8080/persons{?page,size,sort}", "templated" : true } } } Particularly, I would like to imitate the one produced by Spring Data Rest. How do I go about this? I am using Spring Boot with the following configuration: @Configuration @Import(RepositoryRestMvcConfiguration.class) @EnableAutoConfiguration @EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class) @EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) @ComponentScan public class Application { ... } Retaining or removing @EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) doesn't seem to change anything. I also have the following gradle dependencies: compile "org.springframework.boot:spring-boot-starter-data-rest" compile "org.springframework.boot:spring-boot-starter-data-jpa" compile "org.springframework.boot:spring-boot-starter-actuator" compile "org.springframework.boot:spring-boot-starter-jetty" compile "org.springframework.data:spring-data-envers:0.2.0.RELEASE" compile "org.hibernate:hibernate-envers:4.3.6.Final" runtime "mysql:mysql-connector-java:5.1.32" testCompile "junit:junit"
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/33385617
tagged with: java

http://stackoverflow.com/comment/40635661
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25954752
score: 0
has text: @HovercraftFullOfEels, ive used addColumn and removeColumn, but as you know, positions are not kept. This isnt a problem. The problem is when ive hidden a column and add data to the table, the data isnt in its correct column. It may help if it inform readers what the app is supposed to do.

http://stackoverflow.com/comment/40693346
comment on: http://stackoverflow.com/q/25984349
has text: For the record, my non-looping answer: `return (first+last)/2;`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26007752
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26007630
has body: You are comparing it wrong. When you pass an object to String.equals(Object o), one of the things it will do is to check if the parameter passed is an instance of String.class. Since you are passing null, it will always return false. You should check to see if your string is null and then if it is empty. String.class does have that method. So: if(strInput != null &amp;&amp; !strInput.isEmpty() &amp;&amp; strInput.matches("\\d{0,4}")) { // do something... } else { JOptionPane.showMessageDialog(null, "Error. Please Re-enter"); updateFast(); }

http://stackoverflow.com/a/25938136
type: Answer
has body: Some use of wildcards and casting do the magic: public enum MyEnum { CASE1("CODE1", (Class&lt;? extends MyInterface&gt;)ImplementingClass.class); private String code; private Class&lt;? extends MyInterface&gt; aClass; private MyEnum(String code, Class&lt;? extends MyInterface&gt; aClass) { this.code = code; this.aClass = aClass; } //... }
score: 0
answers question: http://stackoverflow.com/q/25937977

http://stackoverflow.com/a/25951579
answers question: http://stackoverflow.com/q/25944513
score: 1
upvote count: 1
has body: Systemcode, I'm afraid your question is mislabeled. It is not about NLP or Stanford parser at all, you need to learn how Java works. Hint: library is a jar file that you need to put somewhere and add to your project's classpath, for Java to start looking into it when searching for classes. Depending on your development environment this is either command line option ("cp" or "classpath") or project settings in your Integrated Development Environment (Eclipse, or IDEA, or whatever you are using).
downvote count: 0
type: Answer

http://stackoverflow.com/q/25890806
type: Question
tagged with: autoboxing
linked to: http://stackoverflow.com/q/1073919
possible better answer: http://stackoverflow.com/a/25890917
has body: I wrote following code and was surprised to see the output: Integer a = 211; int b = 211; int[] array = {210,211,212}; System.out.println(Arrays.asList(array).contains(a)); System.out.println(Arrays.asList(array).contains(b)); Output: false false I found this question and some other questions linked to it and learned that asList method doesn't Autobox stuffs. I checked the returned type in eclipse javadoc preview: I couldn't quite understand this return type. int[] is an object and not a primitive so its fine. I'm sure that I'm not getting List&lt;Integer&gt; (something which I expected) but I'm not sure how to use the thing which is being returned. My questions are: 1. How exactly do I expect that list methods will work when I'm expecting an List of Integer and getting a List of int[] ? 2. In case of Strings the return type is List of String and not List of String[]. What sort of implementation differences are there? 3. What good is this method for primitives if things are so uncertain?
has answer: http://stackoverflow.com/a/25890917
accepted answer: http://stackoverflow.com/a/25890998
has answer: http://stackoverflow.com/a/25890935
has title: java : Understanding Arrays.asList(T...array) method for primitive types
upvote count: 7
tagged with: list
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/25891007
has answer: http://stackoverflow.com/a/25890955
type: AnsweredQuestion
tagged with: arrays
has answer: http://stackoverflow.com/a/25890998
downvote count: 0
score: 7
favorite count: 0

http://stackoverflow.com/q/25990222
has comment: http://stackoverflow.com/comment/40699939
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40699941
tagged with: java
accepted answer: http://stackoverflow.com/a/25990610
has comment: http://stackoverflow.com/comment/40700100
possible better answer: http://stackoverflow.com/a/25990367
type: Question
has body: I need to match all the end-of-sentence symbols like !, ?, . (period), etc. in a given body of text. Can anyone help me out with the regex for doing such a thing? Example Input: This is the f!!rst sentence! Is this the second one? The third sentence is here... And the fourth one!! Output: This is the f!!rst sentence Is this the second one The third sentence is here And the fourth one
has answer: http://stackoverflow.com/a/25990610
has comment: http://stackoverflow.com/comment/40700444
answer count: 3
upvote count: 0
has title: Regex to match end-of-sentence markers
score: -6
favorite count: 0
has answer: http://stackoverflow.com/a/25990367
has answer: http://stackoverflow.com/a/25990861
tagged with: regex

http://stackoverflow.com/q/25920015
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25920270
has body: I have an activity that is displayed in portrait only and in my tablet it causes the following: android.view.WindowLeaked: Activity com.spicycurryman.getdisciplined10.app.InstalledAppActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{53210b88 V.E..... R.....ID 0,0-1520,192} that was originally added here at android.view.ViewRootImpl.&lt;init&gt;(ViewRootImpl.java:354) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) at android.app.Dialog.show(Dialog.java:281) at com.spicycurryman.getdisciplined10.app.InstalledAppActivity$LoadApplications.onPreExecute(InstalledAppActivity.java:306) at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586) at android.os.AsyncTask.execute(AsyncTask.java:534) at com.spicycurryman.getdisciplined10.app.InstalledAppActivity.onCreate(InstalledAppActivity.java:105) at android.app.Activity.performCreate(Activity.java:5104) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) 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:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method) I am using an AsyncTask to load a listview of installed apps on the phone and using a progressdialog. I have researched this problem: Progress dialog and AsyncTask error android…
linked to: http://stackoverflow.com/q/9249266
linked to: http://stackoverflow.com/q/15215988
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/19155670
has answer: http://stackoverflow.com/a/25920418
has title: android.view.WindowLeaked for tablet asynctask while trying to set portrait orientation
tagged with: progressdialog
linked to: http://stackoverflow.com/q/24545471
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40574616
tagged with: android-asynctask

http://stackoverflow.com/a/25955573
accepted answer of: http://stackoverflow.com/q/25954286
type: Answer
has body: well, ActiveJDBC will do this automatically. Here is the same code that will properly set the ID: Employee e = Employee.createIt("name", "John", "age", 43); Address d = Address.create("address", address); e.add(d); That was a short way of writing it. The longer version: Employee e = new Employee(); e.set("name", "John", "age", 43).saveIt(); Address d = new Address(); d.set("address", address); e.add(d); In either case, you can get the Id from a model after you save like this: id = e.getId() For more information, refer: http://javalite.io/one_to_many_associations
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25954286
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25886358
tagged with: java
has comment: http://stackoverflow.com/comment/40512702
answer count: 1
favorite count: 0
score: -2
has body: Say for example the file I'll be reading off of will be: 5, 6 2, 1 3, 5 7, 9 1, 0 0, 0 I first would like to store the integer 5 into variable 'a' and then integer 6 into variable 'b', and then I would like to use them in a method. I then would like to store the second line, 2 into variable 'a' and 1 into variable 'b'. So basically reuse just two, 'a' and 'b', to use them temporarily in a method and store the next line of input into those variables, and so on. In Java, how can I go about doing so with file reading?
linked to: http://stackoverflow.com/q/2788080
has comment: http://stackoverflow.com/comment/40512561
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25886417
downvote count: 3
tagged with: file
upvote count: 1
type: Question
has title: How do I read input from file and store the value line by line (in Java)?

android-volley
tags question: http://stackoverflow.com/q/25960815
tags question: http://stackoverflow.com/q/25890430
tags question: http://stackoverflow.com/q/25887511
type: Tag
tag name: android-volley
tags question: http://stackoverflow.com/q/25886663
tags question: http://stackoverflow.com/q/25981032
tags question: http://stackoverflow.com/q/26015610

http://stackoverflow.com/comment/40572738
type: AnswerComment
comment on: http://stackoverflow.com/a/25912449
score: 0
has text: when you run separate from net-beans but in your computer do you get the gui and desired output?
type: Comment

http://stackoverflow.com/a/25916999
has body: You should extend Thread or implement Runnable for that. You then execute the code in run methods, and start the Runnables by invoking their start methods. Self-contained, quick and dirty example (within a Main class): public static void main(String[] args) throws Exception { // these are spawned as new threads, // therefore there is no guarantee the first one runs before the second one // (although in this specific case it's likely the first one terminates first) new Reporter("one","Starting").start(); new Reporter("two","Starting").start(); } static class Reporter extends Thread { String category, message; Reporter(String category, String message) { this.category = category; this.message = message; } @Override public void run() { reporting(category, message); } void reporting(String category, String message) { System.out.printf("Category: %s, Message: %s%n", category, message); } }
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25916887
downvote count: 0

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/25880632
tags question: http://stackoverflow.com/q/25878045
type: Tag

http://stackoverflow.com/comment/40505895
has text: I'm sure there's a simple solution, if you'd explain what you mean by "id is available on that".
score: 0
comment on: http://stackoverflow.com/q/25882232
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25944943
answers question: http://stackoverflow.com/q/25944782
has comment: http://stackoverflow.com/comment/40619125
has body: If I understood the requirements correctly then it should be "-?\\d+,-?\\d+"
score: 0
type: Answer

http://stackoverflow.com/q/25956217
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/4124664
has comment: http://stackoverflow.com/comment/40685134
type: Question
upvote count: 2
answer count: 1
downvote count: 0
has title: Java Serializable - Does serializing/deserializing have security?
favorite count: 0
score: 2
tagged with: serialization
has body: I have a question that is based off of the Serializable class. Sadly after searching on Google, I could not find any answers that satisfy my question. Here is what I am doing: Sending a serialized object via UDP (DatagramPacket) to a server. The Packet class is an abstract class that all Packets should be inheriting. Packet is Serializable and it has a generated UUID as a static variable. Both the client and the server have this generated UUID. The server deserializes the object, checks if it inherits Packet, and then evaluates what Packet class (server-sided) it properly needs to be casted to. I want to know if serializing and casting an object is secure in a way; with this being said: If someone modified the client side packet class and added new methods and fields and so forth, would the casting of that object to the server-side object still be eligible? Hopefully this can be cleared up nicely.
has comment: http://stackoverflow.com/comment/40652603
has answer: http://stackoverflow.com/a/25956437
accepted answer: http://stackoverflow.com/a/25956437
has comment: http://stackoverflow.com/comment/40654213
has comment: http://stackoverflow.com/comment/40640588
has comment: http://stackoverflow.com/comment/40639377

http://stackoverflow.com/q/26016543
tagged with: jpa
has comment: http://stackoverflow.com/comment/40750256
score: 0
has comment: http://stackoverflow.com/comment/40777318
has body: I have an Entity having oneToone mapping with other entity. Example EntityA { @OneToOne(cascade = CascadeType.DETACH) @JoinColumn(name = "USER_ID") private EntityB user; } Now when I try to update the EntityA using em.merge(entity), in the background instead of directly firing the update query , hibernate fires some select query on EntityA object and then on EntityB object and then when flush is called , update query is fired. Basically whole existing object of EntityA inclusive of EntityB (which exist in DB) is created. and then i beleive this object is updated which is then saved. There is lot of performance issue when the relation is oneToMany .Is there something in JPA where when I want to update only EntityA , EntityB is not fetched from DB and I directly update EntityA
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: hibernate
has title: em.merge performance issue in jpa

http://stackoverflow.com/q/25903068
favorite count: 0
has comment: http://stackoverflow.com/comment/40543348
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25903142
has comment: http://stackoverflow.com/comment/40543320
has comment: http://stackoverflow.com/comment/65758231
has answer: http://stackoverflow.com/a/25903338
has comment: http://stackoverflow.com/comment/40543296
score: -5
has body: the code I already have is below. I am trying to input a double value and return a char value for grading purposes. Using java code in jedit. Keep getting error message "Error: Main method not found in class Conditionals, please define the main method as: public static void main(String[] args)" public class Conditionals { public static double letterGrade(double score){ char result; if (score &gt;= 90.0) { result = 'A'; } else if (score &gt;= 80.0) { result = 'B'; } else if (score &gt;= 70.0) { result = 'C'; } else if (score &gt;= 60.0) { result = 'D'; } else { result = 'F'; } return result; } } this is the new code : public class Conditionals {public static void main(String []args){ System.out.println(letterGrade(60.0)); } public static double letterGrade(double score){ char result; if (score &gt;= 90.0) { result = 'A'; } else if (score &gt;= 80.0) { result = 'B'; } else if (score &gt;= 70.0) { result = 'C'; } else if (score &gt;= 60.0) { result = 'D'; } else { result = 'F'; } return result; } } but when i enter 60.0 it returns 68.0 driver class: public class ConditionalTest public static main(String[] args) as far as I got
tagged with: java
has comment: http://stackoverflow.com/comment/40543425
has comment: http://stackoverflow.com/comment/40543183
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40543092
upvote count: 1
has title: Error message : "Error: Main method not found in class Conditionals, please define the main method as: public static void main(String[] args)"
downvote count: 6

http://stackoverflow.com/comment/40746745
has text: Thanks I was really confused with the post http://stackoverflow.com/questions/2609301/password-protected-excel-file, regarding copying..
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26013905
type: AnswerComment

http://stackoverflow.com/comment/40755121
comment on: http://stackoverflow.com/a/26020467
has text: I'd use a `StringBuilder` for `newtest` otherwise you'd get lots of intermediate string objects for large inputs, which hurts memory and performance.
score: 0
type: AnswerComment
type: Comment

netbeans
tags question: http://stackoverflow.com/q/25991520
tags question: http://stackoverflow.com/q/25984822
tags question: http://stackoverflow.com/q/25906061
tags question: http://stackoverflow.com/q/25970246
tags question: http://stackoverflow.com/q/25892777
tags question: http://stackoverflow.com/q/25962814
tags question: http://stackoverflow.com/q/25931853
tags question: http://stackoverflow.com/q/26004517
tags question: http://stackoverflow.com/q/25984457
tags question: http://stackoverflow.com/q/25940975
tags question: http://stackoverflow.com/q/25935866
tags question: http://stackoverflow.com/q/25974315
tags question: http://stackoverflow.com/q/26000017
tags question: http://stackoverflow.com/q/25912854
tags question: http://stackoverflow.com/q/25950393
tags question: http://stackoverflow.com/q/25907742
tags question: http://stackoverflow.com/q/25962547
tags question: http://stackoverflow.com/q/25985933
tags question: http://stackoverflow.com/q/25959069
tags question: http://stackoverflow.com/q/25970170
tags question: http://stackoverflow.com/q/25973224
tags question: http://stackoverflow.com/q/25980299
tags question: http://stackoverflow.com/q/25916215
tags question: http://stackoverflow.com/q/25923103
tags question: http://stackoverflow.com/q/25912582
tags question: http://stackoverflow.com/q/25923429
tags question: http://stackoverflow.com/q/25988962
tags question: http://stackoverflow.com/q/25994380
tags question: http://stackoverflow.com/q/25994261
tags question: http://stackoverflow.com/q/25960474
tags question: http://stackoverflow.com/q/25923726
tags question: http://stackoverflow.com/q/25964497
type: Tag
tags question: http://stackoverflow.com/q/26021525
tags question: http://stackoverflow.com/q/25909060
tags question: http://stackoverflow.com/q/25880963
tags question: http://stackoverflow.com/q/25951758
tags question: http://stackoverflow.com/q/25887038
tags question: http://stackoverflow.com/q/25985047
tags question: http://stackoverflow.com/q/25994321
tags question: http://stackoverflow.com/q/25957964
tags question: http://stackoverflow.com/q/25891244
tags question: http://stackoverflow.com/q/25928508
tags question: http://stackoverflow.com/q/25931665
tags question: http://stackoverflow.com/q/25898254
tags question: http://stackoverflow.com/q/25986094
tags question: http://stackoverflow.com/q/25948126
tags question: http://stackoverflow.com/q/25879659
tags question: http://stackoverflow.com/q/26003580
tags question: http://stackoverflow.com/q/25888233
tags question: http://stackoverflow.com/q/26020642
tags question: http://stackoverflow.com/q/26018332
tags question: http://stackoverflow.com/q/25985327
tags question: http://stackoverflow.com/q/25962789
tags question: http://stackoverflow.com/q/25938874
tags question: http://stackoverflow.com/q/25955771
tags question: http://stackoverflow.com/q/25935995
tags question: http://stackoverflow.com/q/26017375
tags question: http://stackoverflow.com/q/25972994
tags question: http://stackoverflow.com/q/25901430
tag name: netbeans
tags question: http://stackoverflow.com/q/25919554
tags question: http://stackoverflow.com/q/26004493
tags question: http://stackoverflow.com/q/25908905
tags question: http://stackoverflow.com/q/25912361
tags question: http://stackoverflow.com/q/25919417
tags question: http://stackoverflow.com/q/26033360

http://stackoverflow.com/q/26010506
has title: Extending DefaultTableCellRenderer, no new object creation in getTableCellRendererComponent?
type: AnsweredQuestion
tagged with: java
tagged with: tablecellrenderer
has body: I've some difficulties to understand cell renderer. I want to use StretchIcon in a JTable, so that cells of a column display a resized logo. StretchIcon extends ImageIcon. Custom renderer: public class IconCellRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel label = new JLabel(); label.setIcon( (Icon) ( new StretchIcon((Image) value) ) ); return label; } } This code works as desired, I've no problem with the table. From this tutorial, I learnt that I should avoid creating new objects in getTableCellRendererComponent for performance reason. I don't understand: How many times will IconCellRenderer be instantiated. I assume only once, when the JTable is created (assuming I have only one column in the table). How many times will getTableCellRendererComponent be called. I assume once for each cell in the column, so that it can return a new instance of JLabel with an embedded instance ofStretchIcon for each cell. If this is true, then it makes sense to create the new instances of JLabel and StretchIcon in the method. How will the resized icon be repainted when needed (cell being hidden and then shown again, or cell resized)? I assume getTableCellRendererComponent is not involved at all in this operation, and this is done entirely using the paint method of JLabel and the paint method redefined in StretchIcon. Is my understanding somehow incorrect? Is it legitimate to create a new instance of StretchIcon in the method? What can I do to optimize this cell renderer, e.g. can I make the label object static? Edit: based on comments and answer provided, I ended up with this cell renderer: public class StretchIconRenderer extends DefaultTableCellRenderer { private static StretchIcon stretched; @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)…
type: Question
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/40760271
answer count: 1
has comment: http://stackoverflow.com/comment/40760536
has answer: http://stackoverflow.com/a/26010664
accepted answer: http://stackoverflow.com/a/26010664
has comment: http://stackoverflow.com/comment/40746326
has comment: http://stackoverflow.com/comment/40736918
tagged with: swing

http://stackoverflow.com/q/26012916
type: Question
has answer: http://stackoverflow.com/a/26013128
has answer: http://stackoverflow.com/a/26013115
answer count: 3
has comment: http://stackoverflow.com/comment/40741164
favorite count: 0
has comment: http://stackoverflow.com/comment/40741123
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26013123
has title: Arrays.asList() in java returned refrence list to souce Array?
tagged with: java
score: 0
upvote count: 1
has body: After executing below code, I feel Arrays.asList returned reference to source array thats y after printing it showing the final content from source array. String[] circus2 = { "Monkey", "Elephant" }; List&lt;String&gt; zoo2 = Arrays.asList(circus2); circus2[1] = "bear"; System.out.println("zoo2 size: " + zoo2.size()); System.out.println("zoo2 : " + zoo2); ==== zoo2 size:2 zoo2 : [Monkey, bear] Please advice me, if i m wrong. Java Document says it returned "Returns a fixed-size list backed by the specified array.".
downvote count: 1

http://stackoverflow.com/a/37188539
downvote count: 5
has comment: http://stackoverflow.com/comment/61956143
type: Answer
has body: It can be done. The code needs to be slightly altered. public static void main(String[]arguments) { int x=1, age=55; switch(x) { case 1: if((age&gt;=60)&amp;&amp;(age&lt;200)) System.out.println("Senior Citizen"); case 2: if((age&gt;=18)&amp;&amp;(age&lt;60)) System.out.println("Adult"); case 3: if((age&gt;=12)&amp;&amp;(age&lt;18)) System.out.println("Teenager"); break; default : System.out.println("Child"); break; } }
score: -5
answers question: http://stackoverflow.com/q/25940748
has comment: http://stackoverflow.com/comment/71712661
has comment: http://stackoverflow.com/comment/61939340
upvote count: 0
has comment: http://stackoverflow.com/comment/61910829

http://stackoverflow.com/comment/40494380
type: Comment
type: QuestionComment
has text: Did you try to set `conn.setDoInput(true);`
comment on: http://stackoverflow.com/q/25876177
score: 0

http://stackoverflow.com/comment/40563745
score: 0
type: AnswerComment
has text: You don't have to create another data source. You can create only one and configure the entity manager factory to use it too. Check my updated answer.
comment on: http://stackoverflow.com/a/25905669
type: Comment

http://stackoverflow.com/q/25902481
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/25902559
has answer: http://stackoverflow.com/a/25902506
has body: What is the difference between the two? Is the first one actually been converted to second ? int [] ar = {1,2,3,4}; and int [] ar = new int[]{1,2,3,4};
type: AnsweredQuestion
favorite count: 0
possible better answer: http://stackoverflow.com/a/25902502
has comment: http://stackoverflow.com/comment/40542167
has answer: http://stackoverflow.com/a/25902502
type: Question
has title: Does compiler add new int[] when initializing an int array in Java?
has comment: http://stackoverflow.com/comment/40542094
has comment: http://stackoverflow.com/comment/40542079
score: -2
has answer: http://stackoverflow.com/a/25902559
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/40542100
has comment: http://stackoverflow.com/comment/40542040

http://stackoverflow.com/a/25962329
downvote count: 0
has body: Use a single object. Random number generators are designed to have long periods -- using the same seeded instance, you get a good sequence of random digits out. If you're constantly creating and destroying them, you're only getting however much randomness there is in the seeding process, which may even be none. Imagine what happens if your RNG is seeded from the system clock, and you're doing it thousands of times per second, for instance.
score: 3
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/25962328

http://stackoverflow.com/comment/40594528
score: 1
has text: I suggest a read of the documentation instead of only hacking around. However setting the `spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect` should do the trick. You also might want to add the full stack trace to your post.
type: Comment
comment on: http://stackoverflow.com/q/25930191
type: QuestionComment

amazon-s3
tags question: http://stackoverflow.com/q/25962679
type: Tag
tags question: http://stackoverflow.com/q/25948386
tags question: http://stackoverflow.com/q/26008650
tags question: http://stackoverflow.com/q/26005304
tags question: http://stackoverflow.com/q/26025444
tag name: amazon-s3
tags question: http://stackoverflow.com/q/25931543

http://stackoverflow.com/a/38034761
score: 3
answers question: http://stackoverflow.com/q/25903137
upvote count: 4
has body: An alternative that always exists for learning purpose is to build your custom collector through Collector.of() though toMap() JDK collector here is succinct (+1 here) . Map&lt;String,Integer&gt; newMap = givenMap. entrySet(). stream().collect(Collector.of ( ()-&gt; new HashMap&lt;String,Integer&gt;(), (mutableMap,entryItem)-&gt; mutableMap.put(entryItem.getKey(),Integer.parseInt(entryItem.getValue())), (map1,map2)-&gt;{ map1.putAll(map2); return map1;} ));
type: Answer
has comment: http://stackoverflow.com/comment/69481499
downvote count: 1

http://stackoverflow.com/a/26003885
accepted answer of: http://stackoverflow.com/q/26003801
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26003801
type: Answer
has body: It's actually in just one place that you get the exception : reminderListTextView.setText(text);, the 2 lines are the trace to tell you that you get the error at reminderListTextView.setText(text); when inflate("test"); is called. Try reminder.findViewById(...);, you need to use the view in which you inflated the layout to be able to retrieve elements from it.
score: 1
upvote count: 1

http://stackoverflow.com/comment/40595500
type: QuestionComment
type: Comment
has text: Does it actually find the correct path? Are you running this on the UI thread?
comment on: http://stackoverflow.com/q/25930340
score: 0

http://stackoverflow.com/comment/40526107
type: Comment
has text: @Phane For a compound index on ([Date],[Code]) if you want the find to simply ignore [Code] you could use `cursor.findClosestRowByEntry(search_date, null);`. In your case you want to ultimately get past the specified date so you could use something like `cursor.findClosestRowByEntry(search_date, "zzzzz");` to reduce the number of "search_date.equals" rows you need to skip after the find completes.
type: AnswerComment
comment on: http://stackoverflow.com/a/25889066
score: 0

http://stackoverflow.com/a/46360032
answers question: http://stackoverflow.com/q/25917132
type: Answer
has body: For some browsers it happens that once mouse hover action is performed, but the menu list disappear quickly before Selenium identify the next sub menu item. In that case it is better to use perform() action on the main menu to hold the menu list till the time Selenium identify the sub menu item and click on it. Here WebElement xWL = driver.findElement(By.xpath("x path text")); Actions xAct = new Actions(driver); Instead of this: xAct.moveToElement(xWL).build().perform(); Below code will resolve the "element not visible" issue xAct.moveToElement(xWL); xAct.click(); xAct.perform();
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/q/25982594
has body: I would like to add some sort of unit testing to an IDE known as "IBS Integrator". how the IDE works: I write "java-ish" code in .itr files. when I press the run button these files are compiled into .class and .java files. I have no idea what happens next. Does anyone have advise on how I could make unit testing work in a setup like this? I was hopping for a framework like phpunit or rspec. I know they are for different langagues but a similar tool for java would be nice. I'm not sure what (if anything) can interact with .class/.java files. I would prefer something open-source if possible.
downvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25983525
tagged with: unit-testing
type: Question
tagged with: java
upvote count: 0
has title: unit testing for proprietary ide
answer count: 1
score: -6
favorite count: 0
has answer: http://stackoverflow.com/a/25983525

http://stackoverflow.com/a/67382048
has body: java.time The legacy date-time API (java.util date-time types and their formatting API, SimpleDateFormat) is outdated and error-prone. It is recommended to stop using it completely and switch to java.time, the modern date-time API*. Also, check the following notice at the Home Page of Joda-Time Joda-Time is the de facto standard date and time library for Java prior to Java SE 8. Users are now asked to migrate to java.time (JSR-310). Demo using modern date-time API: import java.time.LocalDateTime; import java.time.format.DateTimeParseException; import java.util.stream.Stream; public class Main { public static void main(String args[]) { Stream.of( "2014-09-11T03:27:54", "2014-09-11T03:27:54kanmsdklnasd", "2014-09-11T03:27:54234243" ).forEach(s -> { try { System.out.println(LocalDateTime.parse(s)); }catch(DateTimeParseException e) { System.out.printf("The date-time string, \"%s\" is not valid.%n", s); } });; } } Output: 2014-09-11T03:27:54 The date-time string, "2014-09-11T03:27:54kanmsdklnasd" is not valid. The date-time string, "2014-09-11T03:27:54234243" is not valid. Learn more about the the modern date-time API* from Trail: Date Time. * For any reason, if you have to stick to Java 6 or Java 7, you can use ThreeTen-Backport which backports most of the java.time functionality to Java 6 & 7. If you are working for an Android project and your Android API level is still not compliant with Java-8, check Java 8+ APIs available through desugaring and How to use ThreeTenABP in Android Project.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25884332
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/26004305
has body: This is a basic gradle question but I could not find an answer: If I have multiple independent projects that share the same root directory, how should I use different build.gradle file for them? for example the directory structure is like this: src/main/java/package1/base1/project1package/ src/main/java/package1/base1/project2package/ It looks like the build.gradle file should be placed at root, but how to differ two projects which are totally independent and not related to each other? When I use gradle build command, how can I specify one project to be built? Thanks.
answer count: 2
has comment: http://stackoverflow.com/comment/40735062
has answer: http://stackoverflow.com/a/26004900
has comment: http://stackoverflow.com/comment/40753758
score: 0
has title: Basic gradle Q for multiple projects
has answer: http://stackoverflow.com/a/26004776
type: UnansweredQuestion
type: Question
tagged with: multiple-projects
tagged with: java
has comment: http://stackoverflow.com/comment/40753814
tagged with: gradle

http://stackoverflow.com/a/25940924
has body: Yes you can test these method if you are using these method in other methods as a side effects. As for example- public class test{ public int i=0; public void incrementIngeterValue() { //doing something and i++; } public boolean incremented() { //some logic to check what is current i value int x = incrementIngeterValue(); if(x==i) return false; // value not incremented else return true // in this case you can make sure this value is incremented by 1. } So you can test incremented method for checking i value is incremented by 1 or not, with this method you are internally test your incrementIngeterValue() without parameter and return value. In your case you a1 is effected in both methods. somewhere you are using this a1.
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25940720
type: Answer

http://stackoverflow.com/q/25898988
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40559360
tagged with: spring
has comment: http://stackoverflow.com/comment/40538649
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40537401
answer count: 0
tagged with: java
tagged with: eclipse
has body: hi i'm working with a spring mvc project using jpa data and i am having this problem, when ytry to do this assign results = query.getResultList(); in gives me a syntax error in the upper line in this case the upper line is Query query = em.createQuery("SELECT c FROM Country c"); it doesnt matter where i put the assign line it always gives me a error in the direct upper line where i put this line results = query.getResultList(); even if i put it down a simple line like this int number = 2; it gives and error this is the error that eclipse spring-tools-suite gives me Syntax error on token ";", , expected this is the class where i am trying to do the createQuery import javax.persistence.EntityManager; import javax.persistence.Query; @Service public class ServicePerson { @Autowired private RepositoryPerson personRepo; EntityManager em = null; List&lt;Object[]&gt; results = null; Query query = em.createQuery("SELECT c FROM Country c"); &lt;--// ERROR AT THIS LINE results = query.getResultList(); When i try to create my query it gives me a syntax error in the upper line in this case in the upper line this is the error "Syntax error on token ";", , expected"
type: Question
has comment: http://stackoverflow.com/comment/40537320
has comment: http://stackoverflow.com/comment/40566357
linked to: http://stackoverflow.com/q/367626
score: 0
tagged with: jpa
has comment: http://stackoverflow.com/comment/40535908
has title: createQuery Syntax error on token ";", , expected

http://stackoverflow.com/a/25875682
type: Answer
has comment: http://stackoverflow.com/comment/40573783
downvote count: 1
has comment: http://stackoverflow.com/comment/40573607
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40639831
has comment: http://stackoverflow.com/comment/40570419
has body: Since you have the webservice endpoint, I sugest you to create webservice clients for each service. You can do it with wsimport, that already comes with JDK: wsimport.bat -d "D:\WS" -keep -verbose endpoint_ws.wsdl pause After this command, you will have java objects to access the webservice. Put these objects in your project and access the webservice. Here a reference on how to do: JAXWS Now that you have objects of the responses, you could code and compare each property. If there's a need to transform these objects into xml again for comparison (I say again because the SOAP message is already xml), you could use xstream (http://x-stream.github.io/tutorial.html). EDITED If you don't need to deal with the java client objects, you could follow this post: How to do a SOAP Web Service call from Java class? In the second part of the post, is shown how to interact directly with the request/response messages: import javax.xml.soap.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class SOAPClientSAAJ { /** * Starting point for the SAAJ - SOAP Client Testing */ public static void main(String args[]) { try { // Create SOAP Connection SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance(); SOAPConnection soapConnection = soapConnectionFactory.createConnection(); // Send SOAP Message to SOAP Server String url = "http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx"; SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url); // Process the SOAP Response printSOAPResponse(soapResponse); soapConnection.close(); } catch (Exception e) { System.err.println("Error occurred while sending SOAP Request to Server"); e.printStackTrace(); } } private static SOAPMessage createSOAPRequest() throws Exception { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = "http://ws.cdyne.com/"; // S…
score: 1
answers question: http://stackoverflow.com/q/25875187
has comment: http://stackoverflow.com/comment/40573337
has comment: http://stackoverflow.com/comment/40598686
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25875187

http://stackoverflow.com/a/25948911
has comment: http://stackoverflow.com/comment/40625133
score: 0
has comment: http://stackoverflow.com/comment/40625783
has body: It won't be possible logically. Think of scenario where portability from one operator to another is viable keeping the same number
type: Answer
answers question: http://stackoverflow.com/q/25948781

http://stackoverflow.com/q/25956629
accepted answer: http://stackoverflow.com/a/25956714
type: Question
score: 0
has body: I need to construct a regular expression such that it should not allow / at the start or end, and there should not be more than one / in sequence. Valid Expression is: AB/CD Valid Expression :AB Invalid Expression: //AB//CD// Invalid Expression: /////// Invalid Expression: AB//////// The / character is just a separator between two words. Its length should not be more than one between words.
answer count: 3
has title: Regex that allows only single separators between words
has comment: http://stackoverflow.com/comment/40638538
has answer: http://stackoverflow.com/a/25956714
tagged with: regex
possible better answer: http://stackoverflow.com/a/25956686
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25956686
has answer: http://stackoverflow.com/a/25956711
tagged with: java

http://stackoverflow.com/comment/40757778
comment on: http://stackoverflow.com/q/26021966
has text: I suggest you to use intelij,it has an amazing swing support
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40586924
has text: The problem with this idea is you would need to know what sort algorithm was been used. Because you don't know where you are in the sort or how the values are been been moved about, I don't think that this is achievable with this approach...
comment on: http://stackoverflow.com/q/25927050
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/25963250
answers question: http://stackoverflow.com/q/25963062
has body: First of all you need to have images in your drawable folder for all different items(in list view) Change the single_list_item.xml to single_list_item_view.xml &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="match_parent" android:layout_height="match_parent"&gt; &lt;ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; change your SingleListItem.java package com.androidhive.androidlistview; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; public class SingleListItem extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.single_list_item_view); ImageView productimage = (ImageView) findViewById(R.id.image); Intent i = getIntent(); // getting attached intent data String product = i.getStringExtra("product"); // displaying selected product name switch(product){ case "item1": productimage.setImageDrawable(R.drawable.image1); break; case "item2": productimage.setImageDrawable(R.drawable.image2); break; case "item3": productimage.setImageDrawable(R.drawable.image3); break; . . . . . //upto all 10 images } } }
accepted answer of: http://stackoverflow.com/q/25963062
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40651733
has comment: http://stackoverflow.com/comment/40651002
type: Answer

http://stackoverflow.com/comment/41278623
score: 1
has text: @ConspicuousCompiler I've rechecked it, you are right. It indeed does suggest a solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/26302276
type: Comment

http://stackoverflow.com/comment/40694541
type: QuestionComment
has text: I was testing only for one item.I dont think that is the issue here.
score: 0
comment on: http://stackoverflow.com/q/25986995
type: Comment

jce
tags question: http://stackoverflow.com/q/25894131
tags question: http://stackoverflow.com/q/25942165
tags question: http://stackoverflow.com/q/25959948
type: Tag
tag name: jce

http://stackoverflow.com/a/40281200
score: 0
type: Answer
has body: I am on the same topic as you are. I recommend GraphViz. Its complex but very powerful and the outcome is very good. I also used Zest, Jung and graphX. The results of all those did not impress me very much. The resulting layout depends on the size of your graph. If you have a complex graph GraphViz would lead to the best results.
answers question: http://stackoverflow.com/q/25917195

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/25908899
tags question: http://stackoverflow.com/q/26031496
tags question: http://stackoverflow.com/q/25931549
tag name: android-actionbar
tags question: http://stackoverflow.com/q/25894485
tags question: http://stackoverflow.com/q/25962311

http://stackoverflow.com/a/25923473
type: Answer
has comment: http://stackoverflow.com/comment/40580804
has body: Can you use this? value=value*-1; //simply multiply by -1. You can also set a condition to check if the value is negative with an if statement such as. if(value&lt;0) value=value*-1; //simply multiply by -1.
answers question: http://stackoverflow.com/q/25923429
score: 0

http://stackoverflow.com/comment/40590524
comment on: http://stackoverflow.com/q/25928896
score: 2
type: Comment
type: QuestionComment
has text: @Raedwald: Of what? Why not mark it as such?

http://stackoverflow.com/comment/40644515
has text: @mrres1 It does not matter if I print the first or the last duplicate, as long as it does not prints several times
comment on: http://stackoverflow.com/q/25959662
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40651089
type: Comment
type: QuestionComment
score: 2
has text: The Java memory model makes no specification of what happens here. It's entirely up to the implementation. Generally, in garbage-collected languages like Java, the answer to memory allocation-related questions is "don't care" unless you're microoptimizing.
comment on: http://stackoverflow.com/q/25963222

http://stackoverflow.com/comment/40563177
type: QuestionComment
has text: Ok. Seems to me a convenient implementation in the java time api
comment on: http://stackoverflow.com/q/25912455
score: 0
type: Comment

http://stackoverflow.com/comment/40714585
type: AnswerComment
type: Comment
has text: @sircodesalot Where do all the zeros at the end come from in your edit? Looks like whatever you used to generate the hex dump modified the input (assuming they are from the same file). Did you by chance load it as *text* and then switched to hex display?
score: 0
comment on: http://stackoverflow.com/a/25998080

http://stackoverflow.com/comment/40626531
score: 0
comment on: http://stackoverflow.com/q/25949978
has text: the line that says `System.out.println(newPoly.poly.next.term.degree); // Gives me a NullPointerException` He left a comment for it
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/81942170
comment on: http://stackoverflow.com/q/26016467
has text: Firstly the ans is Yes, but why would you fall into such scenarios, you can implement comparable at class level and if u need to sort the values again on some other base, do use comparator explicitly passing the list.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40619663
has text: Is a tautology true? This question doesn't lead anywhere. There is no truth left to be discovered. I think you may have misunderstood what they were asking. A question that would take you somewhere is: A extends B, B is a A, Can it be possible that A is a B?
comment on: http://stackoverflow.com/q/25945288
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26114862
has body: try using .isShown() solo.getCurrentActivity().getResources().getDrawable(R.drawable.action_drw).isShown(); this assert i used to check if my image is displayed: assertEquals(true, solo.getCurrentActivity().findViewById(R.id.getting_started_image_1).isShown()); hope it helps Here i check for imageView Boolean isVisible = (Boolean) solo.getCurrentActivity().findViewById(R.id.imageView1).isShown(); assertTrue(isVisible); Here is to check for drawable (image) Boolean isVisible2 = (Boolean) solo.getCurrentActivity().getResources().getDrawable(R.drawable.image).isVisible(); assertTrue(isVisible2); imageView from the xml i used: &lt;ImageView android:id="@+id/imageView1" android:layout_width="186dp" android:layout_height="90dp" android:src="@drawable/image" /&gt;
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/46336017
type: Answer
has comment: http://stackoverflow.com/comment/41004738
upvote count: 2
answers question: http://stackoverflow.com/q/26020839
has comment: http://stackoverflow.com/comment/41335603

http://stackoverflow.com/comment/40620848
has text: there's still a lot of learning left 4 me :)
type: Comment
comment on: http://stackoverflow.com/a/25946150
score: 0
type: AnswerComment

http://stackoverflow.com/q/25932613
has body: I have used https://github.com/Gottox/socket.io-java-client for socket programming in android. Now i am receiving JSON response and now i want to send JSON data to this node.js server from my android application please help me out. here is my code buttonConnect.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // socket = null; try { SocketIO socket = new SocketIO( "http://104.131.225.38:8001/"); socket.connect(new IOCallback() { @Override public void onMessage(JSONObject arg0, IOAcknowledge arg1) { try { Log.i("Server saidwsssss:", "sssss" + arg0.toString(2)); } catch (JSONException e) { e.printStackTrace(); } } @Override public void onMessage(String arg0, IOAcknowledge arg1) { Log.i("Server said:", "" + arg0); } @Override public void onError(SocketIOException arg0) { Log.i("OnError", "" + arg0); } @Override public void onDisconnect() { Log.i("Connection Terminated", "Connection Terminated"); } @Override public void onConnect() { Log.i("Connection Established", "Connection Established"); } @Override public void on(String arg0, IOAcknowledge arg1, Object... arg2) { Log.i("Server Trigger Event:", "" + arg0 + "" + arg1); if (arg0.equals("nbUsers")) { Log.i("DONE", "DONE" + arg0.toString()); } Object[] arguments = arg2; Log.i("Args", "" + arguments[0].toString()); } }); socket.send("hello server"); socket.emit("event", "argument1", "argument2", 13.37); } catch (Exception e) { e.printStackTrace(); } } }); }
upvote count: 8
type: Question
tagged with: http://stackoverflow.com/tag/json
has title: Send JSON data from in socket.io from android
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25935099
type: UnansweredQuestion
tagged with: sockets
tagged with: android
tagged with: node.js
score: 8
tagged with: java

http://stackoverflow.com/comment/40656259
type: Comment
has text: Thanks , So according to you there is no other way of stopping the thread while it is executing the dirty code without altering my logic method ?
comment on: http://stackoverflow.com/a/25965070
score: 0
type: AnswerComment

http://stackoverflow.com/a/25924787
type: AcceptedAnswer
has body: Here is a bit of an translation for what you need to do, the words in bold are keywords that, when googled, will most likely return information relevant to what you are doing. A Student class that minimally stores the following data fields for a student: This basically means to create a class which has the following properties: • Name • Student id number • Number of credits Think hard about what types of data those would be? What type do you need to create to store somebody's name? Or their Id? Remember, these are all properties A constructor that initializes the name and id fields Google constructor and learn all about how they work, pay special attention when a learning source discusses how to initialize properties inside of the constructor. A method that returns the student name field Research about methods and how you can create one to return your property Student Name. Learn how you will actually use this method. Methods to set and retrieve the total number of credits Research Getters and Setters and understand how they interact with a classes properties Best of luck buddy, google is your best friend/lover in programming..
accepted answer of: http://stackoverflow.com/q/25924690
type: Answer
has comment: http://stackoverflow.com/comment/40585212
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40585954
downvote count: 0
answers question: http://stackoverflow.com/q/25924690

http://stackoverflow.com/comment/40619460
comment on: http://stackoverflow.com/q/25945222
has text: try using && and ! operators as @Mephy mentioned.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40749575
comment on: http://stackoverflow.com/q/26017545
type: Comment
type: QuestionComment
has text: @aioobe Now that you mention it. No.. I will make it a set, because I will only check if it nulls. Thanks.
score: 0

http://stackoverflow.com/comment/40736570
type: Comment
has text: you can get the indexOf `#` and then create a substring out of the mail uri String
comment on: http://stackoverflow.com/q/26010380
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40600246
type: QuestionComment
score: 2
has text: Because in this line you're creating an object of type `Submarine` and then casting it to type `Ship`. `Submarine` IS-A `Ship`
comment on: http://stackoverflow.com/q/25934663
type: Comment

http://stackoverflow.com/a/25902582
has body: Not quite sure what your goal is but this basic example might help. File[] fileArray=new File("textanalyzer/Shakespeare").listFiles(); for(File f: fileArray) // loop thru all files { if(f.getName().endsWith(".txt")) // to deal with the .txt files. { Scanner s=new Scanner(f); // to read the files } }
answers question: http://stackoverflow.com/q/25902487
has comment: http://stackoverflow.com/comment/40542401
type: Answer
has comment: http://stackoverflow.com/comment/40542331
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25902487

http://stackoverflow.com/q/25972287
has answer: http://stackoverflow.com/a/25972413
answer count: 1
has body: Hi I need help with filling ComboBox (ClassA) from ClassAddItem. After selecting "Add New Item" from the ComboBox, call the new window. When you click "Add new item" (ClassAddItem) I want to join a new item into the ComboBox - class ClassA. In a ClassA is also button "Add New Item" it works, but how do I add a new item to the CB from another class??? Item "Add new item" in a ComboBox is deliberately not in the array String[] cbItem, because in my application possibilities Loading from a file and I do not want this item is visible in the file. Also, it would be advantageous if the item "Add new item" still at the end of the ComboBox. Thank you for your response sorry for my English :) public class ClassA extends JFrame { private JPanel contentPane; public JComboBox comboBox; private String[] cbItem = {"A", "B", "C"}; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { ClassA frame = new ClassA(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public ClassA() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 291, 152); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); comboBox = new JComboBox(cbItem); comboBox.addItem("add new Item"); comboBox.setBounds(10, 11, 116, 23); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JComboBox comboBox = (JComboBox) event.getSource(); Object selected = comboBox.getSelectedItem(); if(selected.toString().equals("add new Item")) { ClassAddItem cAI = new ClassAddItem(); cAI.setVisible(true); } } }); contentPane.add(comboBox); JButton btnAddNewItem = new JButton("add new item"); btnAddNewItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { comboBox.addItem("this works"); } }); btnAddNewItem.setBounds(136, 11, 116, 23); contentPane.add(btnAddNewItem); } } Class…
tagged with: jcombobox
accepted answer: http://stackoverflow.com/a/25972413
type: AnsweredQuestion
has title: add item to JComboBox from another JDialog
tagged with: java
type: Question
tagged with: actionlistener
score: 0

http://stackoverflow.com/comment/40610285
comment on: http://stackoverflow.com/a/25938893
type: Comment
has text: Thank you for your answer. Although this answer contains the line and concept I needed (`class.forName()`), I accepted the above answer because it addresses exactly my question more concisely.
score: 0
type: AnswerComment

cachedrowset
type: Tag
tags question: http://stackoverflow.com/q/25892417
tag name: cachedrowset

http://stackoverflow.com/a/25900193
type: Answer
has comment: http://stackoverflow.com/comment/40538573
has body: Velocity is an instance of class Vector (confusing name here because most people would associate that type name with java.util.Vector), which has instance methods and instance variables that belong to every instance of Vector. Bounce looks like an instance method here. In object oriented programming you usually interact with objects (instances) through their methods. but velocity is a variable, not a class. It doesn't have a function at all... In Java, classes do have their own class methods (and class variables), these are denoted by the method modifier of static.
has comment: http://stackoverflow.com/comment/40538657
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25900130
answers question: http://stackoverflow.com/q/25900130
has comment: http://stackoverflow.com/comment/40537992
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40538637
has comment: http://stackoverflow.com/comment/40538025
has comment: http://stackoverflow.com/comment/40538556

http://stackoverflow.com/comment/40520648
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25890929
has text: Are you sure its the image...Its throwing IllegalStateException not NullPointer

command
tags question: http://stackoverflow.com/q/25931927
tags question: http://stackoverflow.com/q/25888012
tags question: http://stackoverflow.com/q/26030704
tag name: command
tags question: http://stackoverflow.com/q/25909728
tags question: http://stackoverflow.com/q/25919216
type: Tag

http://stackoverflow.com/q/25954233
type: AnsweredQuestion
tagged with: string
accepted answer: http://stackoverflow.com/a/25958462
type: Question
has comment: http://stackoverflow.com/comment/40639738
has comment: http://stackoverflow.com/comment/40640073
has comment: http://stackoverflow.com/comment/40641023
has comment: http://stackoverflow.com/comment/40640937
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40634582
has comment: http://stackoverflow.com/comment/40640620
has comment: http://stackoverflow.com/comment/40640561
has comment: http://stackoverflow.com/comment/40640264
answer count: 1
has body: I got this method to check service states: private int checkService(String SERVICE_NAME) { String[] script = {"cmd.exe", "/c", "sc", "query", SERVICE_NAME, "|", "find", "/C", "\"RUNNING\""}; int s = 0; try { Process p = Runtime.getRuntime().exec(script); p.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = reader.readLine(); String starting = "START_PENDING"; String stopping = "STOP_PENDING"; while (line != null) { if (line.toLowerCase().contains(starting.toLowerCase())) { s = 3; } if (line.toLowerCase().contains(stopping.toLowerCase())) { s = 2; } if (line.equals("0")) { s = 0; } if (!line.equals("0") ) { s = 1; } line = reader.readLine(); } } catch (IOException | InterruptedException e1) { System.out.println(e1); } return s; } I want to make this line work: if (line.toLowerCase().contains(starting.toLowerCase())) but i cannot find a string in "line" because "line" is not a string... I want to catch this: SERVICE_NAME: OracleServiceORCL TYPE : 10 WIN32_OWN_PROCESS STATE : 2 START_PENDING (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x7d0 PID : 4144 FLAGS : 3rd line START_PENDING is what im looking for, depending on the service state the actions should be different. I have tried converting the bufferedReader with apache commons.io but it just prints white spaces... How can i properly change this code so that this info becomes a string?
has title: Parsing output of command
has answer: http://stackoverflow.com/a/25958462
has comment: http://stackoverflow.com/comment/40641016
has comment: http://stackoverflow.com/comment/40640204
has comment: http://stackoverflow.com/comment/40640761
has comment: http://stackoverflow.com/comment/40640045
has comment: http://stackoverflow.com/comment/40639929

http://stackoverflow.com/q/25884213
answer count: 2
downvote count: 0
has body: Hi which plugin will you use when you need to pack a distribution jar to include all the runtime libraries (jars). These jars content will have to be unpacked into the root path of the distribution jar. Correct versions for these dependencies can be found in the project parent pom. Or if you may, please compare these two plugins.
favorite count: 0
has title: Apache maven-assembly-plugin or maven-dependency-plugin when foreign jars are needed in runtime
has answer: http://stackoverflow.com/a/25893621
has comment: http://stackoverflow.com/comment/40508874
possible better answer: http://stackoverflow.com/a/25893621
has answer: http://stackoverflow.com/a/25887248
tagged with: maven-assembly-plugin
tagged with: maven
upvote count: 7
has comment: http://stackoverflow.com/comment/40508722
type: AnsweredQuestion
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/25887248
type: Question
tagged with: maven-dependency-plugin

http://stackoverflow.com/q/25900713
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40539014
type: Question
has answer: http://stackoverflow.com/a/25900813
has answer: http://stackoverflow.com/a/30516296
has body: I am using hibernate with Oracle. Due to some bureaucratic and unchangeable issues, I am sharing a oracle schema with someone else. That means some tables are used by me, and some other tables are used by someone else. I would like to use "hibernate.hbm2ddl.auto" = "create-drop" in this case, but I am afraid ALL tables would be deleted, including the ones that do not belong to me. Am I correct? What are the options?
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25900889
has title: hibernate.hbm2ddl.auto configuration
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25900915
accepted answer: http://stackoverflow.com/a/25900889
tagged with: oracle-database
has answer: http://stackoverflow.com/a/25900915
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/25939559
has body: You must use a remote server and database. The system clock isn't the only tweak, the user can simply clear the data associated with the app. You need the unique ID of the device. At first usage of app, you register this in a remote database with a timestamp on it. You need only to check the server whenever this feature is triggered.
upvote count: 2
has comment: http://stackoverflow.com/comment/40609702
answers question: http://stackoverflow.com/q/25939497
has comment: http://stackoverflow.com/comment/40609581
has comment: http://stackoverflow.com/comment/40614424
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/25986290
tagged with: sockets
has title: java socket client to server1 to server2
has body: I am new to java socket programming. I have done an application server where, client send message("hi") to server1 and server1 pass the message(hi) to server2. Is it possible to share the same port? Since server1 and server2 is listening for message. Or any better way? Thanks
has comment: http://stackoverflow.com/comment/40696393
tagged with: java
has comment: http://stackoverflow.com/comment/40696685
type: Question
has comment: http://stackoverflow.com/comment/40696428
has comment: http://stackoverflow.com/comment/40693440
score: 0
tagged with: port
has comment: http://stackoverflow.com/comment/40693663
has comment: http://stackoverflow.com/comment/40696192
has comment: http://stackoverflow.com/comment/40693706
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40696988
tagged with: tcp

http://stackoverflow.com/comment/40541572
comment on: http://stackoverflow.com/q/25902204
type: Comment
type: QuestionComment
has text: Put in a `switch`. It will work but kinda ridiculous.
score: 1

http://stackoverflow.com/q/26019323
has comment: http://stackoverflow.com/comment/40753265
has answer: http://stackoverflow.com/a/26020509
score: 0
tagged with: nullpointerexception
has body: When I use @Autowired annotation to inject dao to service,java.lang.NullPointerException occurred.I can't fix it.Please anyone help! exception java.lang.NullPointerException at com.sargeras.login.service.LoginServiceImpl.register(LoginServiceImpl.java:14) service public class LoginServiceImpl implements LoginService{ @Autowired private LoginDao loginDao; public int register(UserVo userVo){ return loginDao.register(userVo); } } dao @Repository public class LoginDaoImpl extends JdbcDaoSupport implements LoginDao { @Override public int register(UserVo userVo) { int result = -1; return result; } springmvc.xml <context:component-scan base-package="com.sargeras" /> <mvc:annotation-driven /> applicationContext.xml controller @Controller @RequestMapping(value = "/login") public class LoginController extends BaseController{ @Autowired private LoginService service; @RequestMapping(value = "validate") public void toLogin(HttpServletResponse response) throws Exception { logger.error("hhhh"); response.getWriter().print(" this is to logging 1"); } @RequestMapping(value="register") public void register(HttpServletRequest request,HttpServletResponse response) throws Exception{ UserVo user = new UserVo(); int result = 0; String userName = (String)request.getParameter("usernamesignup"); String userPassword = (String)request.getParameter("passwordsignup_confirm"); String userEmail = (String)request.getParameter("emailsignup"); user.setUserName(userName); user.setUserPassword(userPassword); user.setUserEmail(userEmail); result = service.register(user); if(result == 1){ response.getWriter().print("Success"); } } } service is used in controller and can be injected successfully web.xml <?xml version="1.0" encoding="UTF-8"?> spring_test contextConfigLocation classpath:/config/applicationContext*.xml log4jConfigLocation classpath:log4j.xml org.springframework.web.util.Log4jConfigListener characterEncodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 characterE…
linked to: http://stackoverflow.com/q/11453530
possible better answer: http://stackoverflow.com/a/26020509
accepted answer: http://stackoverflow.com/a/26019932
type: AnsweredQuestion
tagged with: spring
tagged with: autowired
has comment: http://stackoverflow.com/comment/40752827
has comment: http://stackoverflow.com/comment/40753379
has title: Null pointer exception when using @Autowired annotation to inject bean
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40753872
tagged with: java
has comment: http://stackoverflow.com/comment/40753756
has comment: http://stackoverflow.com/comment/40754189
answer count: 3
has answer: http://stackoverflow.com/a/26019932
has comment: http://stackoverflow.com/comment/40753571
has answer: http://stackoverflow.com/a/26020671

http://stackoverflow.com/q/25999115
type: UnansweredQuestion
tagged with: encryption
tagged with: java
has comment: http://stackoverflow.com/comment/40735227
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/40715972
has comment: http://stackoverflow.com/comment/40715993
has title: How to do encryption using AES algorithm
has answer: http://stackoverflow.com/a/25999297
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/10168240
has body: I have given a .key (abc.key) file. Using the above .key file, encryption and decryption is done in Java. Here i need to implement same encryption and decryption functionality using C#.net. Please give me idea on how to crack this. I am a newbie to these cryptography stuff. Some of parameters they are setting in java are below. hope it will give little idea String keyFile="abc.key"; String keyAlgorithm= "AES"; String cipherTransformation="AES/CBC/PKCS5Padding"; String needtoEncStr = "Password1"; Any help will be greatly appreciated. UPDATED : @daveBM: I used bouncycastle but m getting different result(not same as java output). below is my complete code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Generators; using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Paddings; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities.Encoders; public class BCEngine { private readonly Encoding _encoding; private readonly IBlockCipher _blockCipher; private PaddedBufferedBlockCipher _cipher; private IBlockCipherPadding _padding; public BCEngine(IBlockCipher blockCipher, Encoding encoding) { _blockCipher = blockCipher; _encoding = encoding; } public void SetPadding(IBlockCipherPadding padding) { if (padding != null) _padding = padding; } public string Encrypt(string plain, string key) { byte[] result = BouncyCastleCrypto(true, _encoding.GetBytes(plain), key); return Convert.ToBase64String(result); } public string Decrypt(string cipher, string key) { byte[] result = BouncyCastleCrypto(false, Convert.FromBase64String(cipher), key); return _encoding.GetString(result); } /// /// /// /// /// /// /// /// private byte[] BouncyCastleCrypto(bool forEncrypt, byte[] input, string key) { try { _cipher = _padding == null ? new PaddedBufferedBlockCipher(_blockCipher) : new…
has comment: http://stackoverflow.com/comment/40717354
has comment: http://stackoverflow.com/comment/40717049

http://stackoverflow.com/q/25945873
has answer: http://stackoverflow.com/a/25945945
answer count: 3
upvote count: 1
has body: I'm working on Android development for the first time and I have a couple sample apps I've been running to make sure Eclipse is configured correctly, so I know it's not the code that's causing these issues. I keep on getting these two errors when I try to build: 1) R cannot be resolved to a variable From what I've read, this will go away once I've successfully built a version, and R.java is created. If I've misunderstood this, please let me know. 2) error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar' This one I understand to be the main issue. I've read a bunch of different answers here, this looks like a common problem, but I can't get mine to work out. I assume the issue has to do with this Please help steer me in the right direction, I've been googling this all day and tried a ton of stuff but it's just not working. Thanks for any help!
favorite count: 0
possible better answer: http://stackoverflow.com/a/25945977
tagged with: android
has title: Errors Using Eclipse for Android Development
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40620297
accepted answer: http://stackoverflow.com/a/25945945
has answer: http://stackoverflow.com/a/25945982
has answer: http://stackoverflow.com/a/25945977
tagged with: mobile
tagged with: eclipse

http://stackoverflow.com/comment/40662629
type: Comment
comment on: http://stackoverflow.com/a/25969622
score: 1
has text: Leon, but it must follow one of the above solution, apart from the other way its hard to traverse the wall record when you want notification, is there any better way to solved the problem of user3804142
type: AnswerComment

http://stackoverflow.com/comment/40768536
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26027508
has text: @markspace added the full .jnlp contents to the question.

list
type: Tag
tags question: http://stackoverflow.com/q/25948932
tags question: http://stackoverflow.com/q/25966400
tags question: http://stackoverflow.com/q/25897767
tags question: http://stackoverflow.com/q/25885750
tags question: http://stackoverflow.com/q/25988366
tags question: http://stackoverflow.com/q/26003480
tags question: http://stackoverflow.com/q/25890986
tags question: http://stackoverflow.com/q/26006057
tags question: http://stackoverflow.com/q/26025975
tag name: list
tags question: http://stackoverflow.com/q/25990014
tags question: http://stackoverflow.com/q/25903781
tags question: http://stackoverflow.com/q/25975196
tags question: http://stackoverflow.com/q/26006743
tags question: http://stackoverflow.com/q/25940999
tags question: http://stackoverflow.com/q/25905322
tags question: http://stackoverflow.com/q/26005626
tags question: http://stackoverflow.com/q/26004196
tags question: http://stackoverflow.com/q/25890806
tags question: http://stackoverflow.com/q/25922996
tags question: http://stackoverflow.com/q/25940053
tags question: http://stackoverflow.com/q/25895548
tags question: http://stackoverflow.com/q/25907465

http://stackoverflow.com/comment/40590568
type: AnswerComment
comment on: http://stackoverflow.com/a/25925254
type: Comment
has text: @TypingPanda I edited in the suggestion from mmlooloo, all UI-Stuff needs to happen in the UI-Thread, so you have to wrap it in "runOnUiThread"
score: 0

http://stackoverflow.com/q/25928449
score: 0
tagged with: java
has body: I have two classes. public class Invoice { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "invoice_id", unique = true) private int invId; @OneToMany(mappedBy = "invoiceList", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true) private List&lt;Item&gt; itemList; @Column(name = "invoice_amt", nullable = false) private Double invAmt; } And, public class Item { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "item_id", unique = true) private int itemId; @ManyToOne(optional = false, targetEntity = Invoice.class) @JoinColumn(name="invoice_id") private List&lt;Invoice&gt; invoiceList; } I am new to JPA. So my understanding may not be accurate. My understanding is that, if I save Invoice, the invoice_id of that instant should cascade down to invoice_id of all the items. However, I see Item being saved but get null in place of invoice_id of the Item. What am I missing? UPDATE!!! UPDATE!!! Ok so I changed the @ManyToOne to be a singular attribute and did objItem.setInvoice(objInvoice) and saved it. However, I still get NULL on invoice_id.
type: Question
tagged with: jpa
has answer: http://stackoverflow.com/a/25928652
answer count: 2
tagged with: eclipselink
accepted answer: http://stackoverflow.com/a/25928652
possible better answer: http://stackoverflow.com/a/25928663
has title: Confused regarding JPA
has answer: http://stackoverflow.com/a/25928663
type: AnsweredQuestion

http://stackoverflow.com/q/25904298
has comment: http://stackoverflow.com/comment/40545806
tagged with: web
possible better answer: http://stackoverflow.com/a/25904352
favorite count: 0
score: 8
has answer: http://stackoverflow.com/a/25904352
has comment: http://stackoverflow.com/comment/40545681
has comment: http://stackoverflow.com/comment/40545430
has comment: http://stackoverflow.com/comment/40545619
has comment: http://stackoverflow.com/comment/40546168
has comment: http://stackoverflow.com/comment/40546067
tagged with: spring
downvote count: 1
has comment: http://stackoverflow.com/comment/40563144
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40545989
has title: Why jsp files inside WEB-INF folder works , but placed under a folder under WEB-INF doesn't?
has answer: http://stackoverflow.com/a/25925021
has comment: http://stackoverflow.com/comment/40545937
has comment: http://stackoverflow.com/comment/40546155
tagged with: java
has comment: http://stackoverflow.com/comment/40545547
has comment: http://stackoverflow.com/comment/40546120
has comment: http://stackoverflow.com/comment/40545950
has comment: http://stackoverflow.com/comment/40545973
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/25947668
upvote count: 9
has body: When my jsp files are inside WEB-INF folder (as /WEB-INF/file.jsp) , I can access them from localhost: 8080/ProjectCtxtRoot/, but I can't access them, if they are placed in /WEB-INF/jsp/file.jsp? I changed the path in welcome-list tag in web.xml as follows /JSP/fileName.jsp I also changed the dispatcher-servlet.xml as follows Still it doesn't work. Url used for above case are localhost:8080/ContextRoot/jsp/ localhost:8080/ContextRoot/jsp/fileName.jsp localhost:8080/ContextRoot/jsp/fileName and it doesn't work for any of the above urls. But it was working when /fileName.jsp dispatcher-servlet.xml as follows Url used for above case is localhost:8080/ContextRoot/ and it works. I use tomcat v 7.0 server. I refresh my project in Eclipse IDE, then clean it, build it, build war using mvn clean install, then choose the war from tomcat manager homepage and deploy it. I do this each time. This is how the diapatcher-servlet.xml looks all through the process. I just change particular section as above said <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> <mvc:annotation-driven/> <context:component-scan base-package="com.projectName.www" /> <constructor-arg name="mongo" ref="mongo" /> <constructor-arg name="databaseName" val…
tagged with: jsp
has comment: http://stackoverflow.com/comment/40545883
accepted answer: http://stackoverflow.com/a/25925021
has comment: http://stackoverflow.com/comment/40545368
has comment: http://stackoverflow.com/comment/40545825
has comment: http://stackoverflow.com/comment/40545775

http://stackoverflow.com/comment/40736993
has text: I thought about that and didnt like how the code looks , the compiler wanted rpcservice to be final and i dont know what is that ... if that is the only solution thank u and i hope final isnt global in java
score: 0
comment on: http://stackoverflow.com/q/26004708
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40629905
type: AnswerComment
has text: 1+, plus methods such as `addAccount(Account account)`, `removeAccount(Account account)`, `Account getAccount(String accountId)`,...
type: Comment
comment on: http://stackoverflow.com/a/25952119
score: 0

http://stackoverflow.com/a/39758622
downvote count: 0
has body: Unfortunately, Unirest doesn't have a good mechanism for getting the request as sent. But you can reconstruct the request by doing this: // build a request HttpRequestWithBody request = Unirest.post(url); request.headers = myHeaders; request.body = myBody; // send the request HttpResponse&lt;String&gt; response = request.asString(); // print the request System.out.println(request.getHttpMethod() + " " + request.getUrl() + " HTTP/1.1"); Map&lt;String, List&lt;String&gt;&gt; requestHeaders = request.getHeaders(); for(String key : requestHeaders.keySet()) { List&lt;String&gt; values = requestHeaders.get(key); for(String value : values) { System.out.println(key + " : " + value); } } InputStream in = loginRequest.getBody().getEntity().getContent(); String body = IOUtils.toString(in, "UTF-8"); in.close(); System.out.println(body);
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25963565

http://stackoverflow.com/a/25889066
has comment: http://stackoverflow.com/comment/40526107
has comment: http://stackoverflow.com/comment/40522409
has comment: http://stackoverflow.com/comment/40521408
has body: You are already creating an IndexCursor so no table scan will be necessary. Just use IndexCursor#findClosestRowByEntry to do a &gt;= search and then skip over the exact matches (if any) like this: Table table = db.getTable("Members"); String dateColumnName = "DateJoined"; Column dateColumn = table.getColumn(dateColumnName); IndexCursor cursor = CursorBuilder.createCursor(table.getIndex(dateColumnName)); String searchDateAsString = "2014/03/01"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); Date search_date = sdf.parse(searchDateAsString); cursor.findClosestRowByEntry(search_date); if (cursor.isAfterLast()) { System.out.println(String.format("There are no rows with %s &gt;= %s", dateColumnName, searchDateAsString)); } else { // we want strictly greater than, so skip over the rows that are equal while (search_date.equals(cursor.getCurrentRowValue(dateColumn))) { if (!cursor.moveToNextRow()) break; } if (cursor.isAfterLast()) { System.out.println(String.format("There are no rows with %s &gt; %s", dateColumnName, searchDateAsString)); } } // now iterate over the remaining rows while (!cursor.isAfterLast()) { System.out.println(sdf.format(cursor.getCurrentRowValue(dateColumn))); cursor.moveToNextRow(); }
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25887554
answers question: http://stackoverflow.com/q/25887554
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/130102773
score: 1
type: AnswerComment
has text: You could improve the quality of your answer by giving some explanation. See the accepted answer for example.
type: Comment
comment on: http://stackoverflow.com/a/73626733

http://stackoverflow.com/comment/40809644
comment on: http://stackoverflow.com/a/26029331
type: AnswerComment
has text: #~/java_practice/innerclasses$ javac TestBed.java #~/java_practice/innerclasses$ java TestBed$Tester error: In TestBed can't find main method... public static void main(String[] args) what is your java compiler version? I don't know if this has something to do with java compiler version...
score: 0
type: Comment

http://stackoverflow.com/comment/40617961
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25944206
has text: [-128 to 127](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html). How do you store `36546594` in something like that?

http://stackoverflow.com/comment/40600563
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25933532
has text: added details as answer, please check.

http://stackoverflow.com/a/25934772
answers question: http://stackoverflow.com/q/25934663
upvote count: 1
type: Answer
has body: You should distinguish between runtime-type and compile-time type. Let's say you have the following statement: Ship s1 = new Submarine("ship 1"); The compile-time type of s1 is the type on the left-hand side of the assignment statment, e.g. the compile-time type is Ship. You can assign s1 to any type that inherits Ship. The runtime type of s1 is the right-hand side of the assignment statement, e.g. the runtime type of s1 is a concrete implementation of Ship (in your case - Submarine). More info: What is Polymorphism?
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40600620

http://stackoverflow.com/comment/40691041
comment on: http://stackoverflow.com/q/25985037
score: 0
type: Comment
type: QuestionComment
has text: Yeah I am much more familiar with Swing than AWT. What exactly is Canvas used for?

http://stackoverflow.com/q/26020561
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/26020682
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26020682
has answer: http://stackoverflow.com/a/26020649
score: 6
upvote count: 6
type: AnsweredQuestion
has body: I've got this Predicate, which filters my Task objects based in a date: Predicate&lt;Task&gt; startDateFiltering = new Predicate&lt;Task&gt;() { @Override public boolean apply(Task input) { return input.getStartDate() != null &amp;&amp; input.getStartDate().after(date); } }; There's no problem to use it as long as date variable is accessible in the context. However, I'll like to make it reusable and embed it in the Task class itself, doing something like this: public static final Predicate&lt;Task&gt; startDateFiltering = new Predicate&lt;Task&gt;() { @Override public boolean apply(Task input) { return input.getStartDate() != null &amp;&amp; input.getStartDate().after(date); } }; In order to access it as Task.startDateFiltering each time I need it. But how to pass the date argument to it?
type: Question
accepted answer: http://stackoverflow.com/a/26020649
has title: Pass an extra (second) argument to Guava Predicate
tagged with: guava

http://stackoverflow.com/a/25911256
downvote count: 0
has body: You should try a more object-oriented approach. You should create an object called NameEntity, and inside it have the properties All and Link. Iterate over your XML and create an arrayList of NameEntities. Now iterate over the arrayList and add the elements to your combobox. You can either implement toString() to make NameEntity print the All attribute, or you can use a ListCellRenderer to explicitly render the value of NameEntitiy. Read up here : http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html Now in actionPerformed(..) you will get a NameEntity instead of a String. To get the corresponding Link value, you just have to call NameEntity ne = (NameEntity)assignCombo.getSelectedItem(); ne.getLink();
type: Answer
answers question: http://stackoverflow.com/q/25910630
score: 1
upvote count: 1

http://stackoverflow.com/comment/40563868
comment on: http://stackoverflow.com/q/25914643
type: Comment
type: QuestionComment
has text: My eyes! please fix your formatting
score: 3

http://stackoverflow.com/comment/68576846
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/40660373
has text: Can I ask you to please read [How to offer personal open-source libraries?](//meta.stackexchange.com/q/229085) Thanks!
type: Comment

http://stackoverflow.com/a/25945263
has body: Use this to create a 3x3 2-D array and initialize all values to 0: public float points[][] = new float[3][3]; And this to iterate through the array and set values: for (int j=0; j&lt;3; j++) { for (int i=0; i&lt;3; i++) { points[j][i] = 42; //Or whatever } }
answers question: http://stackoverflow.com/q/25945129
score: 0
type: Answer

http://stackoverflow.com/comment/40512416
type: Comment
comment on: http://stackoverflow.com/a/25885714
has text: Thanks, but where can I download the Jackson jar? I went to download obviously but it takes me to git hub where I can only download the zip containing that read me explanation.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40647827
type: AnswerComment
has text: Shouldn't it be accepted? :-)
comment on: http://stackoverflow.com/a/25961063
type: Comment
score: 0

http://stackoverflow.com/q/25919707
type: UnansweredQuestion
has body: I have the below class with the fields name and id - public class MyObj { private String name; private String id; //getters and setters + toString implementation } In my main method, I am creating a list of MyObjand adding elements to the list. public static void main(String[] args) { List&lt;MyObj&gt; myList = new ArrayList&lt;MyObj&gt;(); MyObj myObj1 = new MyObj(); myObj1.setName("test"); myObj1.setId("123"); myList.add(myObj1); MyObj myObj2 = new MyObj(); myObj2.setName("testOne"); myObj2.setId("456"); myList.add(myObj2); } When I iterate through the list, and print the contents, I have this - MyObj [name=test, id=123] MyObj [name=testOne, id=456] I want to check if my List has a string. For example, if it contains name or id? When I use the contains method, it returns false. Clearly I am doing something wrong. How do I check if a list of objects has a string?
upvote count: 1
has answer: http://stackoverflow.com/a/25919750
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40574055
type: Question
has comment: http://stackoverflow.com/comment/40573836
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40574236
has comment: http://stackoverflow.com/comment/40574514
has answer: http://stackoverflow.com/a/25920944
favorite count: 0
has title: Check if list of objects contains a String
has comment: http://stackoverflow.com/comment/40573838

http://stackoverflow.com/comment/40685159
type: Comment
has text: and in this world, nobody can explain anything. Indeed, you deserve +1 for not showing any explanation :)
score: 1
comment on: http://stackoverflow.com/a/25982052
type: AnswerComment

http://stackoverflow.com/q/25959367
has answer: http://stackoverflow.com/a/25959424
answer count: 2
has body: I have an application in C and need to re-write it to Java. I have a problem with data types. I am not sure which data type is equal to the C ones in Java. There are those I need to find out equal datatypes in java programming language for. unsigned char unsigned short short int unsigned long
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
has title: C datatypes in Java
has comment: http://stackoverflow.com/comment/40643242
tagged with: type-conversion
accepted answer: http://stackoverflow.com/a/25959424
favorite count: 0
possible better answer: http://stackoverflow.com/a/25959425
has answer: http://stackoverflow.com/a/25959425
upvote count: 2
has comment: http://stackoverflow.com/comment/40643265
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40644352
type: Question

http://stackoverflow.com/comment/102189359
score: 0
type: Comment
has text: the best approach is to validate the input data into a service class...
comment on: http://stackoverflow.com/a/26001013
type: AnswerComment

http://stackoverflow.com/q/25974759
type: Question
score: 1
tagged with: java
has body: Authenticators in Play Framework override the Security.Authenticator class. One of the methods here is String getUsername(Context ctx). My question is - why user name, why not some general user ID? If I were to design such a class, there would be a Long getUserId(Context ctx) or String getUserId(Context ctx) for cases where GUIDs are used in the DB. Can anyone shed a light on this?
tagged with: playframework
upvote count: 1
favorite count: 0
has title: Security.Authenticator - why String user name?
downvote count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/40622667
has text: Okay, as an [example](http://stackoverflow.com/questions/13203415/how-to-add-fade-fade-out-effects-to-a-jlabel/13203744#13203744)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25946128

http://stackoverflow.com/a/25878681
score: 2
has comment: http://stackoverflow.com/comment/40499738
accepted answer of: http://stackoverflow.com/q/25878531
has body: Indeed it does use reflection to bind the method("methodName") to the handler. This is a one time deal while inflating the XML and does not affect performance in any meaningful way. The XML inflation is in itself is a rather costly parse, (Per http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.1_r2/android/view/View.java#2017) Besides this, it is exactly like the doing it in code.
answers question: http://stackoverflow.com/q/25878531
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40499515
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40499780

http://stackoverflow.com/comment/40548263
score: 1
type: QuestionComment
has text: remove semicolon from your ANT_HOME & JAVA_HOME.
type: Comment
comment on: http://stackoverflow.com/q/25906058

http://stackoverflow.com/a/25995170
upvote count: 1
score: 1
has body: It seems like you wanted an open curly brace { after the second for. The way it is now, the line Search obj=new Search(num) is not in the main method.
downvote count: 0
answers question: http://stackoverflow.com/q/25995063
type: Answer

http://stackoverflow.com/comment/40741463
type: Comment
type: QuestionComment
has text: My problem is not how to check the mails. My problem is that in my form i have a field that there isn't in my class User. In my class User there isn't a field "confirmMail", so when i submit the form i get an error, because the form fields doesn't match the class user fields. I don't know if I explained well
comment on: http://stackoverflow.com/q/26012663
score: 0

http://stackoverflow.com/q/25912854
tagged with: netbeans
downvote count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25912921
has title: Cannot connect to database Error: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
upvote count: 2
tagged with: sql
answer count: 1
favorite count: 0
tagged with: windows
has comment: http://stackoverflow.com/comment/40560561
has body: I am having errors with connecting to a MS Access Database (CDCollection.accdb) from Java. The IDE we are using is Netbeans. I have done research on possible solutions as to the error, but due to being inexperienced in the topic, I am not too sure how to solve it. The rest of my class are having the same problem and the teacher does no know how to solve the problem either. My class is now in the final chapter, Learning Unit 10: Accessing a Database from a Java program, of Funworks's exploring IT: Java Programming. Grade 11. I would post links to the three sources I have found most useful, but Stack Overflow says I need to have 10 reputation points to post more than 2 links. I have searched both Stack Overflow and the web to find the solution to this error, but those were more advanced than where I currently am. Edit: Here are the links, thanks to those who upvoted me. The solution they suggest makes sense, but does not seem to work... http://community.microfocus.com/borland/managetrack/starteam/w/knowledge_base/16933.error-java-sql-sqlexception-microsoft-odbc-driver-manager-data-source-name-not-found-and-no-default-driver-specified.aspx http://www.coderanch.com/t/440574/JDBC/databases/java-sql-SQLException-ODBC-Driver http://www.codeproject.com/Articles/35018/Access-MS-Access-Databases-from-Java From what I understand, it is due to the school computers and my laptop all being 64-bit and ODBC (Open DataBase Connectivity) being 32-bit. My teacher does not know how to solve this problem, as it is her first time encountering it. When the grade 11s of last year reached this section of the book, the school computers were still 32-bit. According to what I've read, I need to go to the OBDC Data Source Administrator and, under the System DSN tab, add "Microsoft Access Driver (*.mdb, *.accdb)". I noted that it was already there under the User DSN tab. Find the OBDC Data Source Administrator at C:\Windows\SysWOW64\odbcad32.exe or Control Panel\System and Security\Administrativ…
score: 2

http://stackoverflow.com/comment/40689147
type: Comment
comment on: http://stackoverflow.com/a/25980344
has text: @RobertHume Given the wording of your question I don't see how that's possible.
type: AnswerComment
score: 0

http://stackoverflow.com/a/25988419
type: Answer
has body: Amend your code to the following: for (int j = 0;i &lt; map.length; i++) to for (int j = 0;i &lt; map[j].length; j++)
has comment: http://stackoverflow.com/comment/40723973
score: 0
answers question: http://stackoverflow.com/q/25988246

http://stackoverflow.com/a/25941863
has comment: http://stackoverflow.com/comment/40615166
score: 4
has comment: http://stackoverflow.com/comment/40614724
has comment: http://stackoverflow.com/comment/40615232
upvote count: 4
has comment: http://stackoverflow.com/comment/40614959
has comment: http://stackoverflow.com/comment/40619034
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40615094
type: Answer
answers question: http://stackoverflow.com/q/25941260
has comment: http://stackoverflow.com/comment/40614908
has comment: http://stackoverflow.com/comment/40614671
accepted answer of: http://stackoverflow.com/q/25941260
has body: I put together a simple example that sorta shows how ive been doing async event publications as of late. Check it out, I think its pretty self explanatory: The main method: public static void main(String[] args) throws InterruptedException { Observer obs = new Observer(); EventBus.subscribe(obs, SomeEventImp.class); SomeEventImp evt = new SomeEventImp(new Object(), "This is the value"); EventBus.publishAsync(evt); Thread.sleep(Long.MAX_VALUE); } The Observer interface: public interface IObserver { public void update(AEvent event); } And Observer implementation: public class Observer implements IObserver { @Override public void update(AEvent event) { System.out.println("I got and event from " + event.getSource() + " with a value of " + event.getValue()); } } The AEvent class: public abstract class AEvent&lt;T&gt; { protected final T value; protected final Object source; public AEvent(Object source, T value) { this.value = value; this.source = source; } public Object getSource() { return source; } public T getValue() { return value; } } The event bus: public class EventBus { // our observers private static HashMap&lt;IObserver, Class&lt;?&gt;&gt; m_Observers = new HashMap&lt;IObserver, Class&lt;?&gt;&gt;(); // our incoming events private static BlockingQueue&lt;AEvent&lt;?&gt;&gt; incoming = new LinkedBlockingQueue&lt;AEvent&lt;?&gt;&gt;(); // start our internal thread static { new Thread(new DelegationThread()).start(); } // subscribe an observer public static void subscribe(IObserver obs, Class&lt;?&gt; evtClass) { synchronized (m_Observers) { m_Observers.put(obs, evtClass); } } // publish and event public static void publishAsync(AEvent&lt;?&gt; event) { incoming.add(event); } private static class DelegationThread implements Runnable { @Override public void run() { while (true) { try { AEvent&lt;?&gt; evnt = incoming.take(); synchronized (m_Observers) { for (Entry&lt;IObserver, Class&lt;?&gt;&gt; entry : m_Observers.entrySet()) { if (entry.getValue() == evnt.getCla…

http://stackoverflow.com/a/25903597
has comment: http://stackoverflow.com/comment/40554121
score: 3
has comment: http://stackoverflow.com/comment/40554812
upvote count: 3
has comment: http://stackoverflow.com/comment/40545063
downvote count: 0
answers question: http://stackoverflow.com/q/25901714
has body: Seems fine. I would make initialization threadsafe like this: enum ComplexItem implements Complex { ITEM1 { protected Complex makeInstance() { return new Complex() { public void method() { }}; } }, ITEM2 { protected Complex makeInstance() { return new Complex() { public void method() { }} }; private volatile Complex instance; private Complex getInstance() { if (instance == null) { createInstance(); } return instance; } protected abstract Complex makeInstance(); protected synchronized void createInstance() { if (instance == null) { instance = makeInstance(); } } public void method() { getInstance().method(); } } The modifier synchronized only appears on the createInstance() method, but wraps the call to makeInstance() - conveying threadsafety without putting a bottleneck on calls to getInstance() and without the programmer having to remember to add synchronized to each to makeInstance() implementation.
type: Answer

http://stackoverflow.com/a/27449031
has comment: http://stackoverflow.com/comment/43338783
answers question: http://stackoverflow.com/q/25994380
has comment: http://stackoverflow.com/comment/43349790
score: 0
has comment: http://stackoverflow.com/comment/50114199
has body: Add an application manifest to indicate that the executable should be elevated. See this MSDN blog entry. Add the static application manifest (not embedded) to your project, as a resource.
type: Answer

rest
tags question: http://stackoverflow.com/q/25973575
tags question: http://stackoverflow.com/q/26010367
tags question: http://stackoverflow.com/q/26005494
tags question: http://stackoverflow.com/q/25951602
tags question: http://stackoverflow.com/q/25975679
tags question: http://stackoverflow.com/q/26015560
tags question: http://stackoverflow.com/q/25957721
tags question: http://stackoverflow.com/q/25944964
tags question: http://stackoverflow.com/q/25967073
tags question: http://stackoverflow.com/q/25909518
tags question: http://stackoverflow.com/q/25957818
tags question: http://stackoverflow.com/q/26022178
tags question: http://stackoverflow.com/q/25980582
tags question: http://stackoverflow.com/q/25953056
tags question: http://stackoverflow.com/q/25928116
tags question: http://stackoverflow.com/q/25931543
tags question: http://stackoverflow.com/q/26001006
tags question: http://stackoverflow.com/q/25909559
tags question: http://stackoverflow.com/q/25951849
tags question: http://stackoverflow.com/q/26006323
tags question: http://stackoverflow.com/q/25883742
tags question: http://stackoverflow.com/q/25907630
tags question: http://stackoverflow.com/q/25884711
tags question: http://stackoverflow.com/q/25988851
tags question: http://stackoverflow.com/q/25897555
tags question: http://stackoverflow.com/q/25922868
tags question: http://stackoverflow.com/q/26010481
tags question: http://stackoverflow.com/q/25947849
tags question: http://stackoverflow.com/q/26027275
tags question: http://stackoverflow.com/q/25874896
tags question: http://stackoverflow.com/q/25897535
tags question: http://stackoverflow.com/q/25937821
tags question: http://stackoverflow.com/q/25896516
tags question: http://stackoverflow.com/q/25971287
tags question: http://stackoverflow.com/q/25890909
tags question: http://stackoverflow.com/q/26030586
tags question: http://stackoverflow.com/q/25879898
tags question: http://stackoverflow.com/q/25923900
tags question: http://stackoverflow.com/q/25948702
type: Tag
tags question: http://stackoverflow.com/q/25950475
tags question: http://stackoverflow.com/q/25916796
tags question: http://stackoverflow.com/q/25927782
tags question: http://stackoverflow.com/q/25921573
tags question: http://stackoverflow.com/q/25915049
tags question: http://stackoverflow.com/q/25955910
tags question: http://stackoverflow.com/q/25972681
tag name: rest
tags question: http://stackoverflow.com/q/26030851
tags question: http://stackoverflow.com/q/25933432
tags question: http://stackoverflow.com/q/25993256
tags question: http://stackoverflow.com/q/25874250
tags question: http://stackoverflow.com/q/26022184
tags question: http://stackoverflow.com/q/25916211
tags question: http://stackoverflow.com/q/25963565
tags question: http://stackoverflow.com/q/26009738
tags question: http://stackoverflow.com/q/25998192
tags question: http://stackoverflow.com/q/26000342
tags question: http://stackoverflow.com/q/25927817

http://stackoverflow.com/comment/40501818
has text: Just so you know, it would return `15`, not `12`. But I believe you could just add `x * 100` to it?
score: 0
comment on: http://stackoverflow.com/q/25880071
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40572862
comment on: http://stackoverflow.com/a/25915597
score: 0
type: Comment
has text: Must be some other issue then
type: AnswerComment

http://stackoverflow.com/comment/40669194
comment on: http://stackoverflow.com/q/25973181
score: 0
type: Comment
type: QuestionComment
has text: Your error is not reproducible so it cannot get a reasonable answer.

http://stackoverflow.com/comment/69742528
type: Comment
comment on: http://stackoverflow.com/q/25960815
score: 1
type: QuestionComment
has text: In newers versions of Volley, It do that automatically, you only need to set the gzip encode in the apache server. I wrote a article about it: http://angelluispg.es/bitybyte/2016/05/01/gzip-y-ssl-en-servicios-web/ (Sorry, it is in spanish, maybe you understand a little or you could use a translator)

http://stackoverflow.com/q/26009674
has answer: http://stackoverflow.com/a/26009924
has title: set Rating value to text box
has answer: http://stackoverflow.com/a/26009876
possible better answer: http://stackoverflow.com/a/26009876
type: Question
has body: Here I'm Using rating feature of ControlsFX. Each time rating value 's altered, I need to update the value in TextField as shown in screen shot. Is it possible to use javafx.concurrent.Task here? and how can I apply it? here's my code: @FXML private HBox ratinghbox; @FXML private TextField yourratingtxt; private Rating rating; @Override public void initialize(URL url, ResourceBundle rb) { rating = new Rating(); rating.setPartialRating(true); ratinghbox.getChildren().add(rating); yourratingtxt.setText(String.valueOf(rating.getRating())); }
accepted answer: http://stackoverflow.com/a/26009924
type: AnsweredQuestion
tagged with: java
tagged with: javafx
tagged with: rating
answer count: 2
tagged with: controlsfx
score: 0

http://stackoverflow.com/a/25970005
accepted answer of: http://stackoverflow.com/q/25968483
has body: RFC5545 section on UID ([link][1]) is aligned with your expectations and unfortunately not with the implementation on the server you are connecting to: Property Name: UID Purpose: This property defines the persistent, globally unique identifier for the calendar component. Unfortunately there is nothing really which can be done against bad server side implementations... [1]: https://www.rfc-editor.org/rfc/rfc5545#section-3.8.4.7
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/78920977
score: 19
upvote count: 19
answers question: http://stackoverflow.com/q/25968483
type: AcceptedAnswer

http://stackoverflow.com/a/25948611
answers question: http://stackoverflow.com/q/25948569
has body: The same value of id_Faq is inserted two times. In your table attribute id_Faq has unique constraint. So every value of the id_Faq should be unique.
score: 0
type: Answer

http://stackoverflow.com/a/25881038
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25881008
type: Answer
has body: Here float counter = 0; float pColor = counter / ((float)Math.abs((x_end - x_start))); The result of pColor is always 0.0 because 0 divided to any number is zero. for example: System.out.println( 0 / 1); output: 0 Another Example: 0 divided by any number is 0. This result is explained by the fact that no number, even 0, can go into 0. In the example below 9 cannot go into 0 at all, resulting in the 0 answer. Example: 0 / 9 = 0 Source of the Example
score: 1
accepted answer of: http://stackoverflow.com/q/25881008
upvote count: 1

http://stackoverflow.com/a/26005495
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26003470
has body: it's not allowed to store these data for more than 30 calendar days (https://developers.google.com/maps/terms#section_10_1_3) APPROXIMATE means APPROXIMATE , it's fine when results become more precise

http://stackoverflow.com/comment/40714206
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25998116
has text: @dasblinkenlight yes. `Ajout` and `soustr` are two JRadioButtons and i have set one of them checked by default
score: 0

http://stackoverflow.com/q/25925306
downvote count: 0
possible better answer: http://stackoverflow.com/a/25925459
tagged with: multithreading
has answer: http://stackoverflow.com/a/25925459
has title: Why volatile and synchronized statements cannot avoid thread interference here?
type: Question
has answer: http://stackoverflow.com/a/25925805
has answer: http://stackoverflow.com/a/25925474
tagged with: java
tagged with: concurrency
has answer: http://stackoverflow.com/a/25925583
has comment: http://stackoverflow.com/comment/40584037
upvote count: 2
has body: package simple; public class ThreadInterference { public static volatile Integer count = 1000; public static class MyThread implements Runnable { @Override public void run() { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } for (int i = 0; i &lt; 10000; i++) { count++; count--; count++; count--; } } } public static void main(String[] args) throws InterruptedException { System.out.println(count); Thread t1 = new Thread(new MyThread()); Thread t2 = new Thread(new MyThread()); Thread t3 = new Thread(new MyThread()); Thread t4 = new Thread(new MyThread()); t1.start(); t2.start(); t3.start(); t4.start(); t1.join(); t2.join(); t3.join(); t4.join(); System.out.println(count); } } The count variable is marked as volatile but the output is: 1000 1230 If I change to synchronized statements, thread interference also happens: package simple; public class ThreadInterference { public static Integer count = 1000; public static class MyThread implements Runnable { @Override public void run() { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } for (int i = 0; i &lt; 10000; i++) { synchronized(count) { count++; count--; count++; count--; } } } } public static void main(String[] args) throws InterruptedException { System.out.println(count); Thread t1 = new Thread(new MyThread()); Thread t2 = new Thread(new MyThread()); Thread t3 = new Thread(new MyThread()); Thread t4 = new Thread(new MyThread()); t1.start(); t2.start(); t3.start(); t4.start(); t1.join(); t2.join(); t3.join(); t4.join(); System.out.println(count); } } output of this time is: 1000 1008 Why?
favorite count: 0
answer count: 4
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25925805

http://stackoverflow.com/q/25885100
type: UnansweredQuestion
tagged with: excel
has answer: http://stackoverflow.com/a/25885451
tagged with: java
score: -1
type: Question
has body: I already have a java application which exports some data into an Excel 2003 dataformat and I would like to get it exported into Excel 2010 by using org.apache.poi library. Is it possible to do it using java?
answer count: 1
has title: Export Excel 2010 in JavaScript using Apache POI library
has comment: http://stackoverflow.com/comment/80515430
downvote count: 1
favorite count: 0
upvote count: 0
tagged with: apache-poi

http://stackoverflow.com/a/48069986
has body: for maven project you can add such properties &lt;properties&gt; &lt;maven.compiler.source&gt;1.7&lt;/maven.compiler.source&gt; &lt;maven.compiler.target&gt;1.7&lt;/maven.compiler.target&gt; &lt;/properties&gt;
answers question: http://stackoverflow.com/q/25885323
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/40638668
score: 0
type: Comment
type: AnswerComment
has text: it is I am slowly figuring it out.
comment on: http://stackoverflow.com/a/25956633

http://stackoverflow.com/comment/40667553
score: 0
comment on: http://stackoverflow.com/a/25972503
type: Comment
has text: `Hadoop 2.3.0-cdh5.1.0`
type: AnswerComment

http://stackoverflow.com/q/25990014
score: 0
has comment: http://stackoverflow.com/comment/40701189
answer count: 1
accepted answer: http://stackoverflow.com/a/25990212
has title: does java lists.transform can change the list order?
has body: I have a unit test that checks the order of a sorted results list. The strange thing is that the test always passes in intellij but always fails when I run from console ./gradlew can it be that transform or other method works differently depending on the environment? public List&lt;Image&gt; sortImages(List&lt;Image&gt; inputImages, UserInfo userInfo) { if (inputImages == null) { return null; } List&lt;ImageScore&gt; imageScoreList = createImageScoreListFromImageList(inputImages); Collections.sort(imageScoreList, imageScoreDescComparator); imageScoreList = getSubListIfListIsTooLong(userInfo, imageScoreList); List&lt;Image&gt; sortedImages = transformImageScoreListToImageList(imageScoreList); return sortedImages; } private List&lt;ImageScore&gt; getSubListIfListIsTooLong(UserInfo userInfo, List&lt;ImageScore&gt; imageScoreList) { if (userInfo != null &amp;&amp; userInfo.channel != null &amp;&amp; userInfo.channel.equals(UserInfo.UserChannel.CLIENT)) { if (imageScoreList.size() &gt; VenueConfig.s.MAX_IMAGES_TO_RETURN_TO_CLIENT) { imageScoreList = imageScoreList.subList(0, VenueConfig.s.MAX_IMAGES_TO_RETURN_TO_CLIENT); } } return imageScoreList; } private List&lt;Image&gt; transformImageScoreListToImageList(List&lt;ImageScore&gt; imageScoreList) { Collection result = Collections2.transform(imageScoreList, new Function&lt;ImageScore, Image&gt;() { @Override public Image apply(ImageScore input) { return input.image; } }); return new ArrayList(result); } private List&lt;ImageScore&gt; createImageScoreListFromImageList(List&lt;Image&gt; inputImages) { Collection result = Collections2.transform(inputImages, new Function&lt;Image, ImageScore&gt;() { @Override public ImageScore apply(Image input) { ImageScore imageScore = new ImageScore(input); imageScore.score = imageScoreCalculator.getScoreForImage(input); return imageScore; } }); return new ArrayList(result); } Update: I do the following logic: 1) transform Image to ImageScore (with elements {int score, Image image}) which…
has answer: http://stackoverflow.com/a/25990212
type: AnsweredQuestion
tagged with: list
tagged with: java
type: Question
tagged with: transform
tagged with: intellij-idea
linked to: http://stackoverflow.com/q/1565214

http://stackoverflow.com/comment/40780578
type: AnswerComment
comment on: http://stackoverflow.com/a/26027510
score: 0
type: Comment
has text: Thanks for your answer. I have test it, but it don't have the expected result. For the box, it is Ok, but when I do SupportRecord support = sql.limit(1).fetchOneInto(SUPPORT); it is the Box id which come into the SupportRecord.ID (because they have the same field name ?)

http://stackoverflow.com/comment/40645249
has text: @MadProgrammer: The input stream is not corrupt as established by comparing a checksum of saved bytes against the file contents. This is towards the end of my post.
comment on: http://stackoverflow.com/q/25954052
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139052021
score: 0
type: Comment
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).
type: AnswerComment
comment on: http://stackoverflow.com/a/78851516

http://stackoverflow.com/comment/40503899
comment on: http://stackoverflow.com/a/25881151
score: 0
type: AnswerComment
has text: I have about 30 properties in the Item class and have similar few other classes in my project. This not an acceptable solution for me. I was looking for a more generic solution. May be BeanDeserializerModifier? or custom null detector?
type: Comment

http://stackoverflow.com/comment/40658253
score: 0
comment on: http://stackoverflow.com/q/25966888
type: Comment
type: QuestionComment
has text: I don't see any auto wiring material (no `@Autowired` or `@Inject` for instance). When using the `SpringBeanAutowiringInterceptor` a file called `beanRefContext.xml` is needed which loads all the xml files containing the configuration. It doesn't use the `ContextLoaderListener`. Which is explained in [the documentation](http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/ejb/interceptor/SpringBeanAutowiringInterceptor.html) of the `SpringBeanAutowiringInterceptor`.

http://stackoverflow.com/a/25890666
has body: You cannot cast a String to any Java object. You can either: Translate the SQL string to a jOOQ query With jOOQ's DSL API, you'd be writing something like: DSL.using(configuration) .select() .from(CAR); With jOOQ's Model API (i.e. to produce a SelectQuery), you'd be writing something like: SelectQuery select = DSL.using(configuration).selectQuery(); select.addFrom(CAR); You're looking for the latter. The two APIs are compared here, in the manual Embed the SQL string in a jOOQ query This is not what you're looking for, but for completeness's sake, you can also embed SQL strings directly into jOOQ objects, e.g. ResultQuery&lt;?&gt; query = DSL.using(configuration).resultQuery("SELECT * FROM car");
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25890361
upvote count: 2

http://stackoverflow.com/a/51223643
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25974302
has body: If you are using Maven as well then check if "-1.0-SNAPSHOT" (or other version/as per your app) is attached at the end of the application-ejb file name as "application-ejb-1.0-SNAPSHOT", The full name would be "java:global/application-ear/application-ejb-1.0-SNAPSHOT/fileName"

http://stackoverflow.com/q/25961408
accepted answer: http://stackoverflow.com/a/25961907
has comment: http://stackoverflow.com/comment/40647364
has comment: http://stackoverflow.com/comment/40647377
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40647276
possible better answer: http://stackoverflow.com/a/25961891
has answer: http://stackoverflow.com/a/25961891
tagged with: token
has comment: http://stackoverflow.com/comment/40647352
tagged with: append
has answer: http://stackoverflow.com/a/25961907
has comment: http://stackoverflow.com/comment/40647875
type: AnsweredQuestion
has body: I have a running code which reads a csv file line by line and append each line with new info. But I need to compare the last token of each line. If the last token is not equal to the last token of previous line, I want to increment the appended leading label by 1. Or to make things easier to understand. The String 'label' = last token of the line. StringBuffer sb = new StringBuffer(); BufferedReader br = new BufferedReader(new FileReader(filename)); String line = br.readLine(); Scanner scanner; while (line != null) { sb.append(label); int indexCount = 1; scanner = new Scanner(line); scanner.useDelimiter(","); while (scanner.hasNext()) { sb.append(" " + scanner.next() + ":" + indexCount); } sb.append(System.getProperty("line.separator")); line = br.readLine(); } My current output is this : 1 0.24887:1 0.64811:1 0.5987:1 0.39418:1 0.96313:1 0.92772:1 1:1 1 0.59092:1 0.66222:1 0.6655:1 0.45021:1 0.87868:1 0.92897:1 1:1 1 0.67556:1 0.66291:1 0.43898:1 0.37441:1 0.95397:1 0.92851:1 1:1 1 0.70637:1 0.66395:1 0.859:1 0.39656:1 0.96331:1 0.93005:1 2:1 1 0.93686:1 0.66841:1 0.66013:1 0.39382:1 0.96343:1 0.92674:1 2:1 1 0.1355:1 0.66448:1 0.15662:1 0.39256:1 0.98848:1 0.90344:1 2:1 What I want to achieve is this: 1 0.24887:1 0.64811:1 0.5987:1 0.39418:1 0.96313:1 0.92772:1 1:1 1 0.59092:1 0.66222:1 0.6655:1 0.45021:1 0.87868:1 0.92897:1 1:1 1 0.67556:1 0.66291:1 0.43898:1 0.37441:1 0.95397:1 0.92851:1 1:1 2 0.70637:1 0.66395:1 0.859:1 0.39656:1 0.96331:1 0.93005:1 2:1 2 0.93686:1 0.66841:1 0.66013:1 0.39382:1 0.96343:1 0.92674:1 2:1 2 0.1355:1 0.66448:1 0.15662:1 0.39256:1 0.98848:1 0.90344:1 2:1 How can I achieve this?
tagged with: java.util.scanner
has title: Read and compare last token of each line using Scanner
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40647344

http://stackoverflow.com/comment/40620426
type: Comment
comment on: http://stackoverflow.com/q/25945905
type: QuestionComment
has text: can i just post block if it alright than you can work your way up. Thanks and post comment @Arif_suhail_123 so i can get the notification that you posted some thing
score: 0

http://stackoverflow.com/comment/40584398
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25925562
type: QuestionComment
has text: using strings is totally unnecessary in your case. All you need is 12 integers so just use integers then :)

http://stackoverflow.com/q/25955951
has comment: http://stackoverflow.com/comment/40637143
favorite count: 0
has answer: http://stackoverflow.com/a/25956043
accepted answer: http://stackoverflow.com/a/25956043
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40637159
tagged with: java
tagged with: javafx
downvote count: 3
tagged with: swing
has comment: http://stackoverflow.com/comment/40637238
type: Question
tagged with: concurrency
has body: please can someone help me clarify these concepts am from c++ and trying to learn java for some time now and just got onto these terms(the first two) when i attempted to try my hands on some swing application...
has title: Platform.RunLater(), swingUtilities.InvokeLater(), and Thread(runnable) confusion
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40637222

http://stackoverflow.com/q/25965506
tagged with: size
has answer: http://stackoverflow.com/a/25965544
has answer: http://stackoverflow.com/a/25965533
accepted answer: http://stackoverflow.com/a/25965531
has answer: http://stackoverflow.com/a/25965536
has answer: http://stackoverflow.com/a/25965552
type: Question
type: AnsweredQuestion
has body: Im kinda lost, i havent coded for months and I cant figure out why size return 0... I clearly added elements in the constructor right package com.data; import java.util.Date; import java.util.Vector; import com.vols.Vol; public class InfosVols { public static Vector&lt;Vol&gt; listeVol = new Vector&lt;Vol&gt;(); public InfosVols(){ listeVol.addElement(new Vol(999999,"Montreal", "Toronto", false, new Date(), 9, 3)); listeVol.addElement(new Vol(111,"Montreal", "Toronto", false, new Date(), 9, 3)); listeVol.addElement(new Vol(112,"Montreal", "Toronto", false, new Date(), 10, 3)); listeVol.addElement(new Vol(121,"Montreal", "Vancouveur", false, new Date(), 8, 5)); listeVol.addElement(new Vol(131,"Montreal", "Calgary", false, new Date(), 14, 3)); listeVol.addElement(new Vol(132,"Montreal", "Calgary", false, new Date(), 16, 3)); } public static void main(String[] args) { System.out.println(listeVol.size()); } } thanks
tagged with: java
has answer: http://stackoverflow.com/a/25965531
tagged with: vector
score: 0
has title: java, can't add elements in vector (size 0)
answer count: 5
possible better answer: http://stackoverflow.com/a/25965533

http://stackoverflow.com/q/26001096
has body: What is the best way to load a file into a java application to be passed to another class? Currently I am using JFileChooser to select a source file (C, C++, Java) which is then passed to an executable called src2srcml. My code runs the src2srcml tool which takes the source file and converts it to an XML which is then stored in my workspace (eclipse). I then want to take that XML file and pass it over to another class to be analysed. As you can see below I am currently trying the getResources method. It can find the file fine but I don't actually know how to pass it to the class UnitXMLReader. GetResources returns a URL to the file but the other class needs the filepath. Is there a better way to find the file? JButton btnRunSourceCode = new JButton("Run Source Code"); btnRunSourceCode.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { //------Check for loaded file ----// if(filePath == null){ textArea.setText("Please Load a source file (C, C++, Java)"); } else{ try{ int c; textArea.setText("Converting Source Code to XML"); String workspace = System.getProperty("user.dir"); String classPath = System.getProperty("java.class.path"); String[] commands = {"/bin/bash", "-c", "cd " + workspace + " &amp;&amp; ./src2srcml --position " + selectedFile.getName() + " -o " + classPath + "/xmlParseGUI/targetFile.xml"}; Process src2XML = Runtime.getRuntime().exec(commands); InputStream in1 = src2XML.getErrorStream(); InputStream in2 = src2XML.getInputStream(); while ((c = in1.read()) != -1 || (c = in2.read()) != -1) { System.out.print((char)c); } src2XML.waitFor(); } catch(Exception exc){/*src2srcml Fail*/} } ParallelXMlGUI c = new ParallelXMlGUI(); Class&lt;? extends ParallelXMlGUI&gt; cls = c.getClass(); // finds resource relative to the class location URL url = cls.getResource("targetFile.xml"); //UnitXMLReader.ChosenFile = filePath; //UnitXMLReader.main(null); System.out.println("Value = " + url);
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: file-io
has title: Java Load File to pass to other class
has comment: http://stackoverflow.com/comment/40719946
upvote count: 2
has answer: http://stackoverflow.com/a/26001212
accepted answer: http://stackoverflow.com/a/26001212
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/26013952
score: 2
answers question: http://stackoverflow.com/q/26013921
has body: 2 Array objects are created. int[] array = new int[10];// can hold 10 ints String[] str = new String[10]; // can hold references to 10 Strings
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/a/26004817
score: 0
answers question: http://stackoverflow.com/q/26004207
type: Answer
has body: First off, you would need to know how many dimensions your array has. Because this looks like an image, I'm going to assume that you'll expect a 3D array. Because Java considers multidimensional arrays as an array of arrays, it isn't as dynamic as MATLAB where you can simply figure out how many dimensions there are by just checking the length of the size vector. Assuming that your matrix is not jagged, you can determine how many rows you have by: int rows = oImage.length; If you want to determine how many columns there are, you can use any of the rows in your matrix and obtain its length: int cols = oImage[0].length; If you want to see how many elements there are in each 2D location in your matrix, you would just access any column in any row you specify and get its length. In our case, let's stick with oImage[0]: int dim = oImage[0][0].length; Therefore, you could write a Java method that could return this as an array of elements similar to size in MATLAB: public int[] JSize(int[][][] oImage) { return new int[] {oImage.length, oImage[0].length, oImage[0][0].length}; } Remember, Java has the capacity of declaring jagged multi-dimensional arrays. This means that each row in your 2D matrix does not necessarily have to have the same number of elements like what you would see in a matrix. If you have a multi-dimensional array in Java that follows the above model, then the above code wlll work.

http://stackoverflow.com/a/25885451
score: 1
has body: An example from the apache poi site. Creating the workbook //Excel 2003 Workbook wb = new HSSFWorkbook(); //Excel 2010 and upwords Workbook wb = new XSSFWorkbook(); Saving the workbook as a .xls or the new .xlsx // Write the output to a file String file = "foo.xls"; if(wb instanceof XSSFWorkbook) file += "x"; FileOutputStream out = new FileOutputStream(file); wb.write(out); out.close();
upvote count: 1
answers question: http://stackoverflow.com/q/25885100
type: Answer
downvote count: 0

http://stackoverflow.com/comment/40763341
has text: You mean, you want to synchronize the producer and the consumer? Can you modify the sources of the writer, or isn't it under your control? Have you tried with a filesystem-level watcher? What are the supported OS?
comment on: http://stackoverflow.com/q/26024758
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/25876435
answer count: 1
has comment: http://stackoverflow.com/comment/40497759
has comment: http://stackoverflow.com/comment/40500825
tagged with: jlist
has answer: http://stackoverflow.com/a/25876618
tagged with: user-interface
has comment: http://stackoverflow.com/comment/40495307
favorite count: 0
has body: I need to reload a jList after I have added new Data to my HashSet. After I have filled all TextFields and press the "save" Button it creates a new jListDemo Object wich will be added to my HashSet. I have written a method that converts the HashSet into a String[] and returns the data for the jList Source. I have a fully working example below. Here is the class jListDemo which is in the package gui: Click this pastebin link. And here is the jList GUI: Click this pastebin link. When a new Object was created I want to reload the jList with the function fillListOwners but I only get the following errors which you can find on this pastebin doc. I hope that someone has a hint for me. Thanks for any help.
type: UnansweredQuestion
has title: Reload jList on Button clicked from new data of HashSet
downvote count: 2
tagged with: swing
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40496687
has comment: http://stackoverflow.com/comment/40497063
upvote count: 0
has comment: http://stackoverflow.com/comment/40498731
score: -2

garbage-collection
tags question: http://stackoverflow.com/q/25914897
tags question: http://stackoverflow.com/q/25887715
tags question: http://stackoverflow.com/q/25885826
tags question: http://stackoverflow.com/q/25960184
tags question: http://stackoverflow.com/q/26021770
tag name: garbage-collection
tags question: http://stackoverflow.com/q/25998367
type: Tag
tags question: http://stackoverflow.com/q/25916825
tags question: http://stackoverflow.com/q/25937927
tags question: http://stackoverflow.com/q/25908259

http://stackoverflow.com/comment/40669050
score: 0
comment on: http://stackoverflow.com/q/25901117
type: Comment
type: QuestionComment
has text: @Baz, Sorry about that. I thought that once you post a comment, all participants get notified.

http://stackoverflow.com/q/25910173
linked to: http://stackoverflow.com/q/7849528
has answer: http://stackoverflow.com/a/25910582
type: AnsweredQuestion
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/40555791
has comment: http://stackoverflow.com/comment/40555686
has body: After reading this answer from @Peter Lawrey and especially this sentence : close() can ensure the file is actually written to disk (or not depending on the OS) (emphasis is mine.) I have 3 questions : Is it true that there is no guaranty that all the bytes will be available on disk after calling close() ? (I guess it's true since it came from @Peter Lawrey) In general (i.e. valid on all OS), what is the best way to be sure that all bytes are effectively written to disk ? (I can imagine counting the bytes written to the stream, and waiting until file.length() == byteCount ... but is there a better approach ?) In particular, on Android, is it enough to call fileOutputStream.close() to be sure that all bytes are effectively written to the file system ? Here is some code (ignoring exceptions, ... to keep it simple) to illustrate my post final InputStream instream = getInputStreamFromSomewhere(); final FileOutputStream outputstream = new FileOutputStream(someExistingFile); int l; final byte[] tmp = new byte[1024]; while ((l = instream.read(tmp)) != -1) { outstream.write(tmp, 0, l); } instream.close(); //outputStream.flush(); //useless call since outputStream.flush() do nothing on FileOutputStream outputStream.close(); //at this point : are all bytes written to disk ?
type: Question
tagged with: filesystems
score: 5
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25910582
has title: FileOutputstream.close() is not always writing bytes to file system?
tagged with: java-io
favorite count: 0
has comment: http://stackoverflow.com/comment/40555721
tagged with: android

http://stackoverflow.com/comment/40702779
type: Comment
type: QuestionComment
has text: '@Schedules' and '@Schedule' would allow you to schedule several timers, unlike the timer service
comment on: http://stackoverflow.com/q/25955676
score: 0

http://stackoverflow.com/q/25940720
has comment: http://stackoverflow.com/comment/40626054
upvote count: 11
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40611768
has body: I'm new to software testing. In a tutorial I read that I can test some methods like this: @Test public void testMultiply() { MyClass tester = new MyClass(); assertEquals("10 x 5 must be 50", 50, tester.multiply(10, 5)); } So I have to pass some parameters to a method and get a return value. But in my case I have some classes without any parameters and return values: ArrayList al = new ArrayList(); public void Main(){ methodA(); methodB(); } public void methodA(){ // connect to URL // get some data for(int i=0; i&lt;someThing; i++){ al.add(data); } } public void methodB(){ // do something with al } Is it also possible to test them? For example whether the right value comes from the URL in methodA().
has comment: http://stackoverflow.com/comment/40611762
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/40611769
has answer: http://stackoverflow.com/a/25940770
tagged with: java
has title: Testing a method with return type void
score: 11
possible better answer: http://stackoverflow.com/a/25940770
has answer: http://stackoverflow.com/a/25940830
has answer: http://stackoverflow.com/a/25940924
tagged with: mockito
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/25940767
linked to: http://stackoverflow.com/q/1244541
favorite count: 0
has answer: http://stackoverflow.com/a/25940865
answer count: 5
accepted answer: http://stackoverflow.com/a/25940767

http://stackoverflow.com/comment/40627712
comment on: http://stackoverflow.com/a/25935744
has text: I've tested the codes again but it does not work. Any ideas because it's not running in the background
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26019571
possible better answer: http://stackoverflow.com/a/26019732
has title: Get Text from EditText after certain position
type: AnsweredQuestion
tagged with: android-edittext
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26020828
score: -1
has body: I'm trying to get the text of an EditText after a certain position. For example, if I had an EditText and loaded the text "Hello" (i.e. .setText("Hello");) inside, it would look like: Hello Then If i typed "Hi" it would look like.. HelloHi Is there away to use getText to just return ("Hi"). I.e. getText after .length() == 5, or something like that! I hope there is a solution for this, thanks for any help!
has answer: http://stackoverflow.com/a/26019897
answer count: 3
upvote count: 0
favorite count: 0
tagged with: position
accepted answer: http://stackoverflow.com/a/26020828
has answer: http://stackoverflow.com/a/26019732
tagged with: android

h2
tags question: http://stackoverflow.com/q/25898865
tags question: http://stackoverflow.com/q/25896143
type: Tag
tag name: h2
tags question: http://stackoverflow.com/q/26029333
tags question: http://stackoverflow.com/q/25939129
tags question: http://stackoverflow.com/q/25975401
tags question: http://stackoverflow.com/q/26026624
tags question: http://stackoverflow.com/q/25984157

http://stackoverflow.com/a/25975636
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25975459
has body: You could try a subclassing DefaultTableCellRenderer, and call setCellRenderer. When the relevant column number is passed to getTableCellRendererComponent, return a blank JLabel, otherwise call the default super.getTableCellRendererComponent. This should mean the column is still visible, but each cell will be blank. If you want to display the data when a row is selected, you will need add a listener to the selection model (from getSelectionModel) to store the selected row in a variable, and call a repaint. You can then use this value in your CellRenderer.

http://stackoverflow.com/a/25935111
has body: It is an issue with the XML file setup. You are not providing constructor arguments, but rather telling Spring to instantiate a new object with certain properties. See this stack overflow post: Does Spring require all beans to have a default constructor? You have to provide the constructor arguments in order to inform Spring that you want to use the constructor with the arguments. ie: &lt;bean id="CustomerBean" class="com.andrew.SpringInnerBeans.Customer"&gt; &lt;property name="person"&gt; &lt;bean class="com.andrew.SpringInnerBeans.Person"&gt; &lt;constructor-arg index="0" value="Andrew"/&gt; &lt;constructor-arg index="1" value="Address"/&gt; &lt;constructor-arg index="2" value="27"/&gt; &lt;/bean&gt; &lt;/property&gt; &lt;/bean&gt; This will tell Spring that you want to use the constructor provided that accepts arguments instead of the no-arg constructor. Technically speaking, you do not need to provide the default constructor at all.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25934791
downvote count: 0
type: Answer

http://stackoverflow.com/a/26012065
has body: call ChildClass.super.myMethod(value); Note : You can also use ChildClass.this.myAttribute / ChildClass.this.myMethod() if you want to access instance attributes/methods from ChildClass.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26011964
score: 5
upvote count: 5

http://stackoverflow.com/comment/40769183
type: Comment
comment on: http://stackoverflow.com/a/26026945
has text: woooooow!!! You know, it worked! Can you explain me the theory behind it please? Because my original document got lot of paragraphs..
score: 0
type: AnswerComment

big-o
tags question: http://stackoverflow.com/q/25883759
tags question: http://stackoverflow.com/q/25962165
type: Tag
tags question: http://stackoverflow.com/q/25920318
tags question: http://stackoverflow.com/q/25987976
tag name: big-o

http://stackoverflow.com/q/25894423
downvote count: 0
has title: Build nested condition with SelectQuery object
possible better answer: http://stackoverflow.com/a/25894934
favorite count: 0
has answer: http://stackoverflow.com/a/25894934
tagged with: jooq
type: Question
upvote count: 2
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25896920
has body: Can I build nested conditions using the SelectQuery object? I want to get: select * from car where ((car.color = 'blue' or car.model = 'Genesis') or (car.manufactor = 'ford' and car.color = 'blue'))
type: AnsweredQuestion
score: 2
tagged with: sql
accepted answer: http://stackoverflow.com/a/25896920

http://stackoverflow.com/a/25907960
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25907780
type: Answer
has body: To understand the difference between the JDK and JRE, see this SO post. As for your questions: Question 1: Yes, you need a JDK if you want to write Java code. The JRE doesn't contain the program javac (Java Compiler) to compile the code. Question 2: Depends on the IDE. Most IDE setup includes a JDK bundle. During installation, it installs the JDK first, and then the IDE, application the installation and IDE settings to the JDK path. That way, you don't need to do all the configuration and installation yourself. Like I said, not all IDEs do this. Question 3: If you need to only run Java applications only. JDK --> Write and compile code. I hope this helps.

http://stackoverflow.com/q/25986904
score: 3
has comment: http://stackoverflow.com/comment/40694292
upvote count: 3
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/40694304
has comment: http://stackoverflow.com/comment/40694775
type: Question
tagged with: for-loop
has comment: http://stackoverflow.com/comment/40694695
has body: I have an assignment that calls for an input integer, it then decrements that integer all the way down to 1. it must use a while loop to display that number all the way down to 1 and on another line use a for loop to do the same. Now after I initiated the while loop, my output for the for loop does not display. Obviously because startNum is now set to 0 after the while loop. How can I get around this so that I can display the decremented numbers on both lines? Code I currently have: public class CountDown { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a number: "); int startNum = input.nextInt(); System.out.println("WHILE LOOP: "); while (startNum &gt; 0) { System.out.print(startNum + " "); startNum--; } System.out.println("\nFOR LOOP:"); for (int x = 0; x &lt; startNum; x++) { System.out.print(startNum + " "); } } }
possible better answer: http://stackoverflow.com/a/25987168
has comment: http://stackoverflow.com/comment/40694520
has answer: http://stackoverflow.com/a/25986961
has answer: http://stackoverflow.com/a/25987168
answer count: 3
tagged with: while-loop
downvote count: 0
has answer: http://stackoverflow.com/a/25986951
favorite count: 0
accepted answer: http://stackoverflow.com/a/25986951
has title: 2 loops 1 decremented variable
type: AnsweredQuestion

http://stackoverflow.com/a/25874367
has comment: http://stackoverflow.com/comment/40491641
answers question: http://stackoverflow.com/q/25874252
score: 0
has comment: http://stackoverflow.com/comment/40491492
type: Answer
has body: ^A=(\w+);?(?:B=(\w+))?;?(?:C=(\w+))?$ Use this.This will give correct groups.See demo. http://regex101.com/r/hJ7nT4/7

http://stackoverflow.com/comment/40688156
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25979929
has text: @zuaxis did u understand how to solve your issue?
score: 0

http://stackoverflow.com/a/26009564
answers question: http://stackoverflow.com/q/26005902
type: Answer
downvote count: 0
score: 1
has body: There is no other way, a message must be consumed to take remove it from a queue. Changing to CLIENT_ACKNOWLEDGE from AUTO_ACKNOWLEDGE will not make any difference as the acknowledge is way to tell the messaging provider to remove a message from queue. The AUTO_ACKNOWLEDGE option tells the JMS client to automatically send a confirmation to provider to remove a message whereas CLIENT_ACKNOWLEDGE is used by the application to explicitly tell the provider to remove message(s). You could probably take a look at setting an expiry time on messages that you don't plan to consume. Messages with an expiry time set, will not be available for delivery after the expiry time is over. Read through JMSExpiration property of a message.
upvote count: 1

http://stackoverflow.com/comment/40508551
has text: @RuchiraGayanRanaweera - yes.. I was checking the byte code to reconfirm `integer.intValue()` was being called.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25884029

http://stackoverflow.com/comment/40738496
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26010520
has text: Though this is what I asked for it will be great if you can provide regex for the base class also. http://regex101.com/r/tO8qG1/6 Here the 4th line should get converted to if(isTrue) funcB(param0,funcC())
score: 0

http://stackoverflow.com/a/56804554
answers question: http://stackoverflow.com/q/25996021
has comment: http://stackoverflow.com/comment/100164073
score: 0
has body: From activiti 6.0.0 Version need to use springConfiguration.setAsyncExecutorActivate(true); <property name="dataSource" ref="dataSource" /> <property name="transactionManager" ref="transactionManager" /> <property name="databaseSchemaUpdate" value="true" /> <property name="asyncExecutorActivate" value="true" /> <property name="history" value="activity"/>
type: Answer

http://stackoverflow.com/q/25951044
upvote count: 3
tagged with: excel
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25957416
tagged with: java
accepted answer: http://stackoverflow.com/a/25957416
type: Question
has body: I want to understand the use of cell type CELL_TYPE_ERROR in apache poi. I tried the following code, I see no error. Workbook wb = new XSSFWorkbook(); Row row = sheet1.createRow(0); Cell cell = row.createCell(0); cell.setCellType(Cell.CELL_TYPE_ERROR); cell.setCellValue(234); System.out.println("error cell value-"+ cell.getNumericCellValue()); //this prints 234.0 Also, I want to understand if the cell can be of type error if we don't manually set its type.
downvote count: 0
score: 3
answer count: 1
has comment: http://stackoverflow.com/comment/40635821
favorite count: 0
has comment: http://stackoverflow.com/comment/40628403
has title: What is the use of CELL_TYPE_ERROR?
tagged with: apache-poi

http://stackoverflow.com/q/25950877
has comment: http://stackoverflow.com/comment/40628107
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40628580
has comment: http://stackoverflow.com/comment/40628714
has comment: http://stackoverflow.com/comment/40628075
has title: Java Servlet understanding
tagged with: java
has comment: http://stackoverflow.com/comment/40628153
tagged with: servlets
type: Question
tagged with: ascii
score: 0
has comment: http://stackoverflow.com/comment/40628549
has body: So I have been asked to create a servlet that reads an ascii file and sends the output to the browser that invokes the servlet. I have started on this but ultimatly I don't know what exactly the above means... Here is what I have, could someone tell me if what I have does what is requested? If not what do I need to do to finish my servlet? public class MessageServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { // output an HTML page res.setContentType("text/html"); // load a configuration parameter (you must set this yourself) String root = getInitParameter("root"); // print some html ServletOutputStream out = res.getOutputStream(); out.println(" "); out.println(" Bryan Rigsbee's Page "); out.println(" My Test Servlet for Understanding "); // print the file InputStream in = null; try { in = new BufferedInputStream (new FileInputStream(root + "/message.txt") ); int ch; while ((ch = in.read()) !=-1) { out.print((char)ch); } } finally { if (in != null) in.close(); // very important } // finish up out.println(" "); } }
answer count: 0

http://stackoverflow.com/comment/41213152
comment on: http://stackoverflow.com/q/26030886
score: 0
type: QuestionComment
type: Comment
has text: Please edit your question to include a [complete example](http://stackoverflow.com/help/mcve) that shows your revised approach based on the comments posted.

http://stackoverflow.com/comment/40694414
comment on: http://stackoverflow.com/q/25986967
score: 0
has text: @user3628602 try this code to see if you can understand it better. for (int count = 0; count <=3; count++) { for (int count2 = 0; count2 < count; count2++) System.out.print(count2 + " "); System.out.println(""); }
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40552802
comment on: http://stackoverflow.com/a/25882901
score: 0
type: Comment
has text: You need to maintain an array for editText as you are maintaining for TextView in your custom Adapter.
type: AnswerComment

http://stackoverflow.com/comment/124971058
type: Comment
has text: Where do we set this system property “log4j1.compatibility” to a value of “true” as mentioned in the doc - https://logging.apache.org/log4j/2.13.0/manual/compatibility.html
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26006646

http://stackoverflow.com/comment/40763772
comment on: http://stackoverflow.com/q/26025093
type: Comment
type: QuestionComment
has text: The usual mechanism is to distribute the JAR file (which is cross-platform). You seem to be building a deb file (which is a native package mechanism).
score: 4

http://stackoverflow.com/a/25924524
score: 26
has body: Android Activity classes must have a default constructor that takes no parameters. Your ChatConnect class has this constructor: public ChatConnect(Socket s){ socket = s; } But the system is looking for one like this: public ChatConnect(){ } and not finding one, which is why it's crashing.
upvote count: 26
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25924465

http://stackoverflow.com/comment/40527055
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25894316
has text: Yes I do have the correct entty named. The error also clearly states the `*` is unexpected...
type: AnswerComment

http://stackoverflow.com/a/25909052
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25908272
has body: i think you can not delete the cache of downloadmanager, i think it clears itself automatically after you removed the downloadid from its database but if you like to have a control to your file you can set destination folder to your private external storage and then after download completed delete it. File rootDirectory = new File(getActivity().getExternalFilesDir(null).getAbsoluteFile().toString()); if(!rootDirectory.exists()){ rootDirectory.mkdirs(); } req.setDestinationInExternalFilesDir(getActivity(),null ,&quot;/&quot; + fileName); and after your download completed you can delete it like: from.delete(); and the doc says: public int remove (long... ids) Cancel downloads and remove them from the download manager. Each download will be stopped if it was running, and it will no longer be accessible through the download manager. If there is a downloaded file, partial or complete, it is deleted. http://developer.android.com/reference/android/app/DownloadManager.html#remove%28long...%29
accepted answer of: http://stackoverflow.com/q/25908272
score: 4

http://stackoverflow.com/a/25980285
answers question: http://stackoverflow.com/q/25977534
score: 0
type: Answer
has body: Straight from JPA 2.0 documentation about merge The persistence provider must not merge fields marked LAZY that have not been fetched: it must ignore such fields when merging. As your documents are LAZY LOADED you would have fetch them with your main entity first, otherwise changes made to collections will be ommited. However, I am curious why it is not working becouse you should have fetched collections (LAZY WAY) to remove some entities from it, so the collection should be fetched by proxy anyway. Could you please show us the code where you fetch and manipulate such collection?
has comment: http://stackoverflow.com/comment/40683405

http://stackoverflow.com/comment/40685673
score: 2
has text: And I do confirm that you should use: the latest 2.4 version of the SonarQube Java plugin, the latest 3.0 version of the SonarQube Findbugs plugin and the latest 2.2 version of the PMD plugin.
type: AnswerComment
comment on: http://stackoverflow.com/a/25916359
type: Comment

http://stackoverflow.com/a/26337770
upvote count: 5
has comment: http://stackoverflow.com/comment/49140316
answers question: http://stackoverflow.com/q/26004517
downvote count: 0
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/50024456
has body: I have the same problem. Mine is caused by a vmware installation. It is vmware worstation v8 on windows 7 and was a default installation. Running netstat -aon | find ":80" | find "LISTENING" from cmd showed PID of the service causing the problem, this related to vmware. Going to services, I manually stopped all of the running vmware services (did not change their start up type, just a manual stop - I want them to work again after the next reboot) I could immediately test my webservice, glassfish 4 started as it should. Hope it helps
has comment: http://stackoverflow.com/comment/52987120

http://stackoverflow.com/comment/40609219
has text: And another problem is String str index?
type: Comment
comment on: http://stackoverflow.com/a/25939181
score: 0
type: AnswerComment

http://stackoverflow.com/a/25948816
has comment: http://stackoverflow.com/comment/40625015
answers question: http://stackoverflow.com/q/25948799
has comment: http://stackoverflow.com/comment/40624894
has comment: http://stackoverflow.com/comment/40624898
has comment: http://stackoverflow.com/comment/40625495
score: 1
has body: It will be two one for String s1 = "Hello"; another for String s4 = new String("Hello")
upvote count: 1
has comment: http://stackoverflow.com/comment/40624757
has comment: http://stackoverflow.com/comment/40642480
type: Answer
has comment: http://stackoverflow.com/comment/40629319
downvote count: 0

http://stackoverflow.com/comment/40763604
comment on: http://stackoverflow.com/a/26024354
type: AnswerComment
has text: Never the less, it must create an object to call `isEmpty` on so this is going to be slower than a method which works the same way, but doesn't create an object.
score: 0
type: Comment

http://stackoverflow.com/comment/111743173
comment on: http://stackoverflow.com/a/57392854
type: AnswerComment
score: 0
type: Comment
has text: do you have sample project?

http://stackoverflow.com/q/25880632
favorite count: 0
has comment: http://stackoverflow.com/comment/40522558
type: UnansweredQuestion
has body: So I have all these byte[]'s, and their encoding could be one of many different formats, depending on where I'm currently debugging. I'd like to be able to toss together a list of projections for the byte array. I'm using IntelliJ's Data Type Renderers view, applying the renderer to type byte[], and I'm primarily concerned with the List of Expressions box. So I've seen how you can render the node with the expression new String(this), however that doesn't work in the list of expressions view below. Eventually I want to do expressions like new String(this, "UTF16") (or do conversions to hex or base64 or w/e) but this doesn't appear to be a byte[] in the expressions list box - in fact, when I try to typecast like (byte[])this the result says Inconvertible types; cannot cast '_Dummy_.__Array__≤T≥' to 'byte[]' (same behavior for java.lang.Byte[]). It's really strange behavior, that in one place it's a byte[] and in another it's some opaque internal type. What does work is simply displaying the fields - i.e., an expression like this.length works as expected. Also, an expression like this simply rerenders the node, claiming its type is byte[] and its object id is the same as the original's id.
tagged with: intellij-13
upvote count: 7
has comment: http://stackoverflow.com/comment/40531248
has answer: http://stackoverflow.com/a/40812529
has title: How to use Data Type Renderers list for byte[] in IntelliJ
score: 7
tagged with: java
type: Question
tagged with: intellij-idea
downvote count: 0
linked to: http://stackoverflow.com/q/21771305
answer count: 1

http://stackoverflow.com/q/25908247
has answer: http://stackoverflow.com/a/25908352
tagged with: intellij-idea
downvote count: 0
accepted answer: http://stackoverflow.com/a/25908375
has title: how to let intellij know the file format of xml with other file extension names?
favorite count: 0
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/25908375
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: I don't know for what reason(maybe for safety?),the legacy project's spring configuration xmls what named to applicationContext.XCVASF.static but not applicationContext.xml.It's not possible to rename them.How to configure intellij idea to let it know their's format is xml? It's better to let it know it's spring's configuration files.
possible better answer: http://stackoverflow.com/a/25908352
answer count: 2

input
tags question: http://stackoverflow.com/q/25962939
tags question: http://stackoverflow.com/q/26003339
tags question: http://stackoverflow.com/q/25909555
tags question: http://stackoverflow.com/q/25880209
tags question: http://stackoverflow.com/q/25980486
tags question: http://stackoverflow.com/q/25926885
tags question: http://stackoverflow.com/q/25939674
tag name: input
type: Tag
tags question: http://stackoverflow.com/q/25963718

http://stackoverflow.com/q/25951633
has title: Is there a way to convert custom object and validate it in method signature after receiving it as POSTed JSON?
tagged with: spring
accepted answer: http://stackoverflow.com/a/25951718
has comment: http://stackoverflow.com/comment/40629051
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25951718
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/40629438
has body: I need to convert received json object to custom entity type Product and validate it. I need to persist it afterward. Is there a way to use annotation and Spring framework support for RESTful web services to do it with annotations and in controller's method signature only? Controller @RestController @RequestMapping("/") public class pController { @RequestMapping(value = "/addProduct", method = RequestMethod.POST) @ResponseBody public String addProduct(Model model, @Valid Product product , BindingResult result){ // somehow get converted json as Product, should be already validated } Entity @Table(name = "product") @Entity public class Product implements Serializable { @Id @Column(name = "product") @GeneratedValue private int product; @Column(name = "name") @Basic @NotEmpty private String name; ... }
has comment: http://stackoverflow.com/comment/40629452

sql
tags question: http://stackoverflow.com/q/25934325
tags question: http://stackoverflow.com/q/25919531
tags question: http://stackoverflow.com/q/25907404
tags question: http://stackoverflow.com/q/25904972
tags question: http://stackoverflow.com/q/25992304
tags question: http://stackoverflow.com/q/26011804
tags question: http://stackoverflow.com/q/25884169
tags question: http://stackoverflow.com/q/25894423
tags question: http://stackoverflow.com/q/25935207
tags question: http://stackoverflow.com/q/25957566
tags question: http://stackoverflow.com/q/25961555
tags question: http://stackoverflow.com/q/25912693
tags question: http://stackoverflow.com/q/25929301
tags question: http://stackoverflow.com/q/25912854
tags question: http://stackoverflow.com/q/25995144
tags question: http://stackoverflow.com/q/25936097
tags question: http://stackoverflow.com/q/25884397
tags question: http://stackoverflow.com/q/25905368
tags question: http://stackoverflow.com/q/25998180
tags question: http://stackoverflow.com/q/25986482
tags question: http://stackoverflow.com/q/25964544
tags question: http://stackoverflow.com/q/25912599
tags question: http://stackoverflow.com/q/25991437
tags question: http://stackoverflow.com/q/25929777
tags question: http://stackoverflow.com/q/25958116
tags question: http://stackoverflow.com/q/26021649
tag name: sql
type: Tag
tags question: http://stackoverflow.com/q/25930427
tags question: http://stackoverflow.com/q/25998286
tags question: http://stackoverflow.com/q/25909540
tags question: http://stackoverflow.com/q/25920826
tags question: http://stackoverflow.com/q/25895853
tags question: http://stackoverflow.com/q/26032733
tags question: http://stackoverflow.com/q/25902881
tags question: http://stackoverflow.com/q/25921275
tags question: http://stackoverflow.com/q/25877458
tags question: http://stackoverflow.com/q/25895645
tags question: http://stackoverflow.com/q/25979642
tags question: http://stackoverflow.com/q/26023421
tags question: http://stackoverflow.com/q/25887967
tags question: http://stackoverflow.com/q/25886620
tags question: http://stackoverflow.com/q/26002259
tags question: http://stackoverflow.com/q/25921000
tags question: http://stackoverflow.com/q/26021050
tags question: http://stackoverflow.com/q/25975401
tags question: http://stackoverflow.com/q/26026624
tags question: http://stackoverflow.com/q/25907875
tags question: http://stackoverflow.com/q/25928628
tags question: http://stackoverflow.com/q/25996460
tags question: http://stackoverflow.com/q/25999786
tags question: http://stackoverflow.com/q/25940090
tags question: http://stackoverflow.com/q/26009492
tags question: http://stackoverflow.com/q/25975362
tags question: http://stackoverflow.com/q/25885267
tags question: http://stackoverflow.com/q/25895446
tags question: http://stackoverflow.com/q/25930119
tags question: http://stackoverflow.com/q/25932089
tags question: http://stackoverflow.com/q/25892982
tags question: http://stackoverflow.com/q/25992471
tags question: http://stackoverflow.com/q/25978233
tags question: http://stackoverflow.com/q/25987072
tags question: http://stackoverflow.com/q/26027525
tags question: http://stackoverflow.com/q/25892850
tags question: http://stackoverflow.com/q/25893528
tags question: http://stackoverflow.com/q/25898865
tags question: http://stackoverflow.com/q/25918889
tags question: http://stackoverflow.com/q/25916563
tags question: http://stackoverflow.com/q/25936092
tags question: http://stackoverflow.com/q/25977595
tags question: http://stackoverflow.com/q/25969716
tags question: http://stackoverflow.com/q/25988055
tags question: http://stackoverflow.com/q/25890361
tags question: http://stackoverflow.com/q/25911678

http://stackoverflow.com/comment/40574204
score: 0
type: Comment
has text: I just did another test: I changed the port forwarding settings and ran the server on my windows pc. I then connected via my app with 3G and when I shut the server down, it worked. Do you have any idea why it does not work with the linux server?
comment on: http://stackoverflow.com/a/25898560
type: AnswerComment

http://stackoverflow.com/q/25896513
has body: // Count total no of words in String class Word { static int Wordcount(String k) { int count=0; char ch[]=k.toCharArray(); for(int i=0;i&lt;k.length();i++) { if(ch[i]==32 &amp;&amp; ch[i+1]!=32) { count++; } } return(++count); } public static void main(String... s) { String k="java is a programming lan"; /* if input string is "java is a prog lan " then its gives//Exception */ int b=Wordcount(k); System.out.println("Your input String has "+b +" words"); } } // Exception aati h agr string khtm ho ri h space se
tagged with: java
tagged with: indexoutofboundsexception
has title: Why its gets error when my input string ends with spaces..?
type: Question
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/40531279
tagged with: string
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40531122
has answer: http://stackoverflow.com/a/25896585
has answer: http://stackoverflow.com/a/25896589

http://stackoverflow.com/comment/40779067
score: 0
type: Comment
has text: Yes that's good. Thank you. Now im trying to cut the words after the point. I want the program to count til the point.
comment on: http://stackoverflow.com/a/26017283
type: AnswerComment

http://stackoverflow.com/a/25914476
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40564897
score: 0
has body: In the manifestfile of your activity, set android:windowSoftInputMode to adjustPan <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
answers question: http://stackoverflow.com/q/25914155
type: Answer
accepted answer of: http://stackoverflow.com/q/25914155

http://stackoverflow.com/a/26725682
type: Answer
answers question: http://stackoverflow.com/q/25943943
upvote count: 1
score: 1
has body: This is a recursive approach I did, it works for me. Let me know if there is any problem. public void pairwiseSwap(Node node){ if(size() == 0){ System.out.println("empty"); return; } if(node.next == null){ System.out.println(node.value); return; } Node one = node; Node two = node.next; System.out.println(two.value); System.out.println(one.value); if(two.next == null) return; pairwiseSwap(two.next); }
downvote count: 0
has comment: http://stackoverflow.com/comment/42091362

http://stackoverflow.com/q/26002393
answer count: 1
favorite count: 0
has body: I'm a little confused by the Java compiler. I've got an interface that has a method signature with "Object": public interface Bean { public void setCreated(final Object created); } I would like to implement it using a generic: public class BeanImpl&lt;T extends Object&gt; implements Bean{ private T created; public void setCreated(final T created){ this.created = (T)created; } } However, this produces a compiler error: Name clash: The method setCreated(T) of type BeanImpl&lt;T&gt; has the same erasure as setCreated(Object) of type Bean but does not override it Given that by definition, T is an Object (), why does the compiler not allow me to make this construct? Trying to mark it is @Override just produces an error msg that the method doesn't actually override a supertype. It is almost as though the compiler does not understand/see that T is actually an Object.
upvote count: 3
tagged with: generics
has title: Why can't I use a generic type to implement a non-generic signature
downvote count: 0
accepted answer: http://stackoverflow.com/a/26002446
has comment: http://stackoverflow.com/comment/40722122
type: Question
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26002446
tagged with: java
has comment: http://stackoverflow.com/comment/40722204

http://stackoverflow.com/comment/40539751
has text: thread-safeness not an issue because as all code in this case run on one thread.
type: AnswerComment
comment on: http://stackoverflow.com/a/25893969
score: 0
type: Comment

http://stackoverflow.com/a/25898468
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25890436
has comment: http://stackoverflow.com/comment/40631147
accepted answer of: http://stackoverflow.com/q/25890436
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40621757
type: Answer
has body: Chapter 8.2.2 "Memory Ordering" of Intel Architectures Software Developer’s Manual says that locked instructions have a total order, no reads or writes can be reordered with locked instructions. David Dice explains in his blog why LOCK ADD has been chosen instead of MFENCE instruction. cc (condition codes) clobber indicates that the flags register is modified.

http://stackoverflow.com/q/25951915
downvote count: 0
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40629487
has answer: http://stackoverflow.com/a/25952030
has body: Main class. Trying to iterate through cards in hand, and check if the value exceeds 21. int handValue; for(int z = 0; z&lt;hand.size(); z++){ //iterate through cards in hand Cards card = hand.get(z); //to add values and check if bust (21) System.out.println(valueofcards); // hand.get(z).RankPoints() // Rank.valueOf(hand.get(z), a) } System.out.println("Bust.");//check if bust The Cards class contains this enum, with method RankPoints(). I'm trying to access this method from the main class, however much google-foo I try I can't find a solution. I originally thought the problem was trying to use it from an ArrayList, but I don't think that's the problem. public enum Rank{ ACE(11), DEUCE(2), THREE(3), FOUR(4), FIVE(5), SIX(6), SEVEN(7), EIGHT(8), NINE(9), TEN(10), JACK(10), QUEEN(10), KING(10); private int RankPoints; Rank (int points){ this.RankPoints = points; } public int RankPoints(){ return this.RankPoints; } } And here is the card constructor using the enum: private final Rank rank; private final Suit suit; Cards(Suit suit, Rank rank) { this.rank = rank; this.suit = suit; } Thanks.
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40629476
upvote count: 1
type: Question
tagged with: enums
accepted answer: http://stackoverflow.com/a/25952030
has comment: http://stackoverflow.com/comment/40629595
tagged with: java
has title: Finding value of ENUM from object in ArrayList from different class
answer count: 1

http://stackoverflow.com/a/25977531
has body: You should always use entrySet() method when iterating over keys and values of an HashMap. Moreover in ConcurrentHashMap, entrySet() will never throw "ConcurrentModificationException" (see Javadoc)
type: Answer
answers question: http://stackoverflow.com/q/25977238
score: 0

http://stackoverflow.com/a/25909074
type: Answer
has body: Have you checked the long times for step 2 aren't simply due to how Selenium functions? It may be worth researching alternative solutions, or creating your own more efficient replacement. Alternatively, you can increase the timeout (although obviously this isn't ideal) in your config.xml, specifically this section: &lt;JTA MaxUniqueNameStatistics="5" TimeoutSeconds="300" RecoveryThresholdMillis="150000" MaxResourceUnavailableMillis="900000" MaxResourceRequestOnServer="60" MaxXACallMillis="180000" /&gt; (from Oracle docs)
answers question: http://stackoverflow.com/q/25908983
score: 0

http://stackoverflow.com/q/25977660
favorite count: 0
has answer: http://stackoverflow.com/a/25981370
has title: How to log Spring Data JPA repository method execution time?
tagged with: spring
score: 8
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: spring-data
has answer: http://stackoverflow.com/a/25979319
accepted answer: http://stackoverflow.com/a/25979319
upvote count: 8
type: Question
has body: I have simple Spring Data JPA repository. public interface UserRepository extends JpaRepository&lt;UserEntity, Serializable&gt;{ … } Is there any way to monitor execution time for methods generated by Spring (for example findOne(…))?
possible better answer: http://stackoverflow.com/a/25981370
tagged with: spring-data-jpa
answer count: 2
tagged with: jpa

http://stackoverflow.com/q/25903972
type: Question
has answer: http://stackoverflow.com/a/25904053
score: 0
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25904053
has title: Pascal Triangle in Lisp
type: AnsweredQuestion
tagged with: common-lisp
tagged with: lisp
has body: I just started learning Lisp and I am having trouble understanding what this code from Rosetta Code says: (defun pascal (n) (genrow n '(1))) (defun genrow (n l) (when (&lt; 0 n) //is the command "when" something like if in Java? (print l) (genrow (1- n) (cons 1 (newrow l))))) (defun newrow (l) (if (&gt; 2 (length l)) '(1) (cons (+ (car l) (cadr l)) (newrow (cdr l))))) I've been looking at some websites about lisp but it still confusing. The only programming language I know is Java. If someone could please explain in Java what the bold parts say, I would be grateful.

http://stackoverflow.com/comment/40523099
type: Comment
has text: You will have to create some objects of FooA using `new FooA()`. your *syntax* is incorrect.
comment on: http://stackoverflow.com/a/25892162
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40594605
comment on: http://stackoverflow.com/q/25931305
score: 0
type: Comment
type: QuestionComment
has text: I just want to completely remove the img tag and p tags to leave unstyled text only.

http://stackoverflow.com/comment/40719799
comment on: http://stackoverflow.com/q/26001021
type: Comment
type: QuestionComment
has text: Due to erasure, `Class<MyObj<T>>` will just be bound to any `Object`. It may be better to use `Class<?>` instead; this way, you could also just pull the class information from `arg` via `arg.getClass()`.
score: 0

http://stackoverflow.com/comment/40840388
has text: Hmmm... This error only occurs when c is large. When I reduce it to 1000 the error does not occur. Any idea why this is happening?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25985287

http://stackoverflow.com/comment/40641098
comment on: http://stackoverflow.com/a/25958010
type: Comment
score: 1
type: AnswerComment
has text: he seems to enjoy down-voting people :)

http://stackoverflow.com/comment/40703821
has text: @zymus developers break the hashcode/equals contract all of the time; but yes extending a class and then overriding its hashcode to behave differently to its parent creates edge cases where the parent and child will no longer be interchangeable. A developer may decide that not being interchangeable is fine; however most do it without knowing about the potential issue.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25992204

http://stackoverflow.com/comment/40745061
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26014812
has text: i run in Emulator. Post,put,get methods work well but delete gives me an error. my url looks true, i will check again
type: Comment

http://stackoverflow.com/q/25961796
tagged with: php
has comment: http://stackoverflow.com/comment/40650057
tagged with: java
has comment: http://stackoverflow.com/comment/40648114
type: Question
has title: PHP to Java - Sockets
score: 0
answer count: 1
has body: I am trying to communicate from php to java using sockets. I have the following java code: private static ServerSocket socket; private static Socket connection; private static String command = new String(); private static String responseStr = new String(); private static int port = 2500; public static void main(String args[]) { System.out.println("Server is running."); try { socket = new ServerSocket(port); while (true) { connection = socket.accept(); InputStreamReader inputStream = new InputStreamReader(connection.getInputStream()); DataOutputStream response = new DataOutputStream(connection.getOutputStream()); BufferedReader input = new BufferedReader(inputStream); command = input.readLine(); response.writeBytes(responseStr); response.flush(); } } catch (IOException e) { System.out.println("Fail!: " + e.toString()); } } I have the following PHP code: &lt;?php $socket = stream_socket_server("tcp://192.168.0.10:2500", $errno, $errstr); if (!$socket) { echo "$errstr ($errno)&lt;br /&gt;\n"; } else { while ($conn = stream_socket_accept($socket)) { fwrite($conn, 'The local time is ' . date('n/j/Y g:i a') . "\n"); fclose($conn); } fclose($socket); } I start the java app, which starts fine, When I run the php, I get the following error: An attempt was made to access a socket in a way forbidden by its access permissions. (0) I have searched Google and have tried all the solutions I could find although nothing has worked. I have restarted both machines and disabled the firewall, neither worked. I am not sure where to go from here. [update from comment:] 192.168.0.10 is the machine with the java app and web server on it. I am connecting from another machine 192.168.0.7
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/25962111
has comment: http://stackoverflow.com/comment/40648434

http://stackoverflow.com/a/25999177
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25999016
has body: Place your imports outside your class and try using http:// in your url - import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class TestClass1{ public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://www.google.com"); driver.quit(); } }
downvote count: 0

http://stackoverflow.com/q/25972927
has title: Change input dialog locale to hebrew in java
has answer: http://stackoverflow.com/a/25977849
has answer: http://stackoverflow.com/a/26086647
has comment: http://stackoverflow.com/comment/40699258
has body: My application is in Hebrew. The computers that are running my app all have English set as the default language and Hebrew as the secondary language Every time they need to input stuff to the app, they have to "alt + shift" to change language. In my last question --> Change input language in java I got a great idea of how to set the locale for text fields, and it worked perfectly ! Now I need to do the same in all my popup Input dialogues. The previous solution was based on using the FocusGained method of the JTextField FocusListener, now I don't have a FocusGained option, at least as far as I know :) IE: response = JOptionPane.showInputDialog(requestLine.this, ("&lt;html&gt;&lt;b&gt;&lt;font color=\"#8F0000 + + \"size=\"10\" face=\"Ariel\"&gt;" + "הכנס סטטוס חדש: " + "&lt;/font&gt;&lt;/p&gt;&lt;/html&gt;"), ""); This option pane asks for input, and stores it in a string, I need it to pop up ready for input in Hebrew . Is that even possible ? Thanks, Dave
linked to: http://stackoverflow.com/q/25959166
accepted answer: http://stackoverflow.com/a/26086647
tagged with: hebrew
has comment: http://stackoverflow.com/comment/40670628
has comment: http://stackoverflow.com/comment/40669382
type: AnsweredQuestion
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/40869822
tagged with: java
has comment: http://stackoverflow.com/comment/40697291
tagged with: swing
type: Question
tagged with: locale
score: 0
possible better answer: http://stackoverflow.com/a/25977849
answer count: 2
has comment: http://stackoverflow.com/comment/40669187

http://stackoverflow.com/comment/40745066
type: Comment
type: QuestionComment
score: 3
has text: Try to remove all versions from `schemaLocation`. For example, `http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd` will be changes to `http://www.springframework.org/schema/mvc/spring-mvc.xsd`
comment on: http://stackoverflow.com/q/26015240

http://stackoverflow.com/q/25996460
tagged with: sql
tagged with: jdbc
has title: JDBC Connection Pool Issue
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40710827
tagged with: java
has comment: http://stackoverflow.com/comment/40713805
type: Question
has comment: http://stackoverflow.com/comment/40710964
has body: I'm experiencing an issue executing a sql query from within my java application; it's difficult to detect what the exact problem is until I get debugging going - there are no errors are returned The only thing returned in the logs is some Connection Pool information along with my sql query - I've noticed the pool size is set to '0' [2014-09-23 07:58:33,253] DEBUG StringType:80 - binding 'DATA' to parameter: 1 [2014-09-23 07:58:33,253] DEBUG StringType:80 - binding 'Y' to parameter: 2 [2014-09-23 07:58:33,255] DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1 [2014-09-23 07:58:33,256] DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0 [2014-09-23 07:58:33,257] DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0 The exact same code is deployed on a separate application server and working properly (Specifically Weblogic - working vs. Tomcat - not working). The setup of the libraries is different between to the two, so from a high-level perspective: Could this be a driver error? Should a Connection Pool's size be set to "0"?
score: 0

http://stackoverflow.com/q/26012224
answer count: 2
tagged with: gwt
has answer: http://stackoverflow.com/a/26012342
tagged with: java
tagged with: javascript
has answer: http://stackoverflow.com/a/26012320
possible better answer: http://stackoverflow.com/a/26012342
has comment: http://stackoverflow.com/comment/40739937
tagged with: google-maps
type: AnsweredQuestion
has body: I want to write a class that defines a geographical point is in a zone or out of it; I save the point in sequence that they connected to each other when create zone ; no how can i determine that a point is in zone or out of zone ; this picture depicts the mentioned zone thanks in advance
has comment: http://stackoverflow.com/comment/40739844
type: Question
has title: how to define that a point in out of a zone in google map
has comment: http://stackoverflow.com/comment/40739890
accepted answer: http://stackoverflow.com/a/26012320
score: 0

http://stackoverflow.com/a/25923032
has body: You are modifying an object inside the list, not the list itself. If you want to avoid such modifications, your immutable list must contain immutable objects.
answers question: http://stackoverflow.com/q/25922996
accepted answer of: http://stackoverflow.com/q/25922996
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 11
score: 11

http://stackoverflow.com/comment/40575604
score: 0
comment on: http://stackoverflow.com/q/25918356
type: QuestionComment
has text: I like the idea of linking them all together like that, but I think if I understand you correctly that will lead to some pretty straight connections, where I was thinking of more twisting passages. I'll give it a try and see what effect it gives though, thanks for the advice @Gus
type: Comment

http://stackoverflow.com/q/25926012
answer count: 2
has body: 1) In LinkedList implementation all the 3 member varaibles size, first, last are transient, then what is the use of implementing serializable? 2) What will be persisted when we try to serialize a LinkedList?
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25926032
score: 8
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25926035
upvote count: 8
type: Question
has title: As all the member variables of java LinkedList is transient, what will be the use of implementing Serializable?

http://stackoverflow.com/q/26006278
type: AnsweredQuestion
downvote count: 0
score: 1
has body: try { int count; URL url = new URL("http://www.exampleserver.com/file names.txt"); URLConnection connection = url.openConnection(); connection.setReadTimeout(TIMEOUT_CONNECTION); connection.setConnectTimeout(TIMEOUT_SOCKET); connection.setRequestProperty("connection", "close"); connection.connect(); int lengthOfFile = connection.getContentLength(); long total = 0; InputStream input = new BufferedInputStream(url.openStream()); OutputStream output = new FileOutputStream(BasindaOneCikanDosyalar); byte data[] = new byte[40096]; while ((count = input.read(data)) != -1) { total += count; output.write(data, 0, count); } output.flush(); output.close(); input.close(); } catch (IOException e1) { e1.printStackTrace(); } I'm using this algorithm but if the filename contains a space, I got java.io.FileNotFoundException and getResponseCode:400. Is there library or different algorithm for download URL?
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/26006321
has title: If filename includes spaces how can we download with URLConnection in android?
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/26006302
tagged with: java
has answer: http://stackoverflow.com/a/26006302
has answer: http://stackoverflow.com/a/26006321

http://stackoverflow.com/q/25961837
tagged with: image
score: 2
linked to: http://stackoverflow.com/q/6373621
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40648111
answer count: 2
tagged with: embedded-resource
tagged with: swing
has comment: http://stackoverflow.com/comment/40653777
has body: I've got a simple swing application with a JFrame that holds various components. On the JFrame I have a custom toolbar class that extends JPanel. On the JPanel I plan on adding buttons with image icons. My directory structure is as follows: Project/src/gui (Package holds source files for application) Project/src/images (Package holds a jar file jlfgr-1_0.jar with button icons and /or individual images files) The issue is that I want to avoid copying the individual image files to the images package. I'd rather somewhow just load the images directly from the jar file. I've got private method that returns the appropriate icon. This method works, for example if I drag an image file to the images package and call: button.setIcon(createIcon("/images/Save16.gif")); private ImageIcon createIcon(String path) { URL url = getClass().getResource(path); ImageIcon icon = new ImageIcon(url); if(url == null) { System.err.println("Unable to load image: " + path); } return icon; I know this is basic, but how can I get my images directly from the jar file in my current setup? Thanks.
tagged with: java
has answer: http://stackoverflow.com/a/25961931
tagged with: eclipse
has answer: http://stackoverflow.com/a/37411808
has title: Loading images from jar files (Using Eclipse IDE)
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26013116
score: 0
has comment: http://stackoverflow.com/comment/40744730
has comment: http://stackoverflow.com/comment/40741853
type: UnansweredQuestion
tagged with: annotations
type: Question
tagged with: reflection
has comment: http://stackoverflow.com/comment/40744882
tagged with: java
has body: How to create a custom annotation and make it work and i don't want to use "main" method and "spring bean post processor" because for this the class should be spring component if i use my custom annotation in my class. And the processor should process and search annotation in jar also. The the Retention for this annotation is "RUNTIME" and target is on "FIELD". I have used "Spring 3.1" in my project. Thanks.
has comment: http://stackoverflow.com/comment/40744637
has comment: http://stackoverflow.com/comment/40744775
has comment: http://stackoverflow.com/comment/40741925
has title: Java - How to create/write a custom annotation and make it work?
has answer: http://stackoverflow.com/a/26013473
upvote count: 1
has comment: http://stackoverflow.com/comment/40741911
answer count: 1
downvote count: 1
favorite count: 0

jakarta-ee
tags question: http://stackoverflow.com/q/25994321
tags question: http://stackoverflow.com/q/25927430
tags question: http://stackoverflow.com/q/25931750
tags question: http://stackoverflow.com/q/25972526
tags question: http://stackoverflow.com/q/25986094
tags question: http://stackoverflow.com/q/25964497
type: Tag
tags question: http://stackoverflow.com/q/25909657
tags question: http://stackoverflow.com/q/25998618
tags question: http://stackoverflow.com/q/25940412
tags question: http://stackoverflow.com/q/25982947
tags question: http://stackoverflow.com/q/26014656
tags question: http://stackoverflow.com/q/25920526
tags question: http://stackoverflow.com/q/25971265
tags question: http://stackoverflow.com/q/25922823
tags question: http://stackoverflow.com/q/25939024
tags question: http://stackoverflow.com/q/25884398
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/25971898
tags question: http://stackoverflow.com/q/25970817
tags question: http://stackoverflow.com/q/25880954
tags question: http://stackoverflow.com/q/25888400
tags question: http://stackoverflow.com/q/26018748
tags question: http://stackoverflow.com/q/25909559
tags question: http://stackoverflow.com/q/25963795
tags question: http://stackoverflow.com/q/26033360
tags question: http://stackoverflow.com/q/25912574
tags question: http://stackoverflow.com/q/25960847
tags question: http://stackoverflow.com/q/25961103
tags question: http://stackoverflow.com/q/25951037
tags question: http://stackoverflow.com/q/25883588
tags question: http://stackoverflow.com/q/25972994
tags question: http://stackoverflow.com/q/25989530
tags question: http://stackoverflow.com/q/25967459
tags question: http://stackoverflow.com/q/25908983
tags question: http://stackoverflow.com/q/25974302
tags question: http://stackoverflow.com/q/25950393
tags question: http://stackoverflow.com/q/26001273
tags question: http://stackoverflow.com/q/26011864
tags question: http://stackoverflow.com/q/25948605
tags question: http://stackoverflow.com/q/25999642
tags question: http://stackoverflow.com/q/26031832
tags question: http://stackoverflow.com/q/26017767
tags question: http://stackoverflow.com/q/25970246
tags question: http://stackoverflow.com/q/25951175
tags question: http://stackoverflow.com/q/25949598
tags question: http://stackoverflow.com/q/25928969
tags question: http://stackoverflow.com/q/25911469
tags question: http://stackoverflow.com/q/25898812
tags question: http://stackoverflow.com/q/25906838
tags question: http://stackoverflow.com/q/25915321
tags question: http://stackoverflow.com/q/25990343
tags question: http://stackoverflow.com/q/25876160
tags question: http://stackoverflow.com/q/25875396
tags question: http://stackoverflow.com/q/25970170
tags question: http://stackoverflow.com/q/25955676

http://stackoverflow.com/comment/40707218
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25994145
has text: In fact, this looks just like it: http://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.24

http://stackoverflow.com/comment/40505910
type: QuestionComment
has text: http://www.theappguruz.com/blog/android-take-photo-camera-gallery-code-sample/
comment on: http://stackoverflow.com/q/25882479
score: 0
type: Comment

http://stackoverflow.com/q/25980377
favorite count: 0
accepted answer: http://stackoverflow.com/a/25981028
has answer: http://stackoverflow.com/a/25980434
type: Question
has answer: http://stackoverflow.com/a/25980456
answer count: 8
possible better answer: http://stackoverflow.com/a/25980434
has answer: http://stackoverflow.com/a/25980463
upvote count: 2
score: 0
has answer: http://stackoverflow.com/a/25980460
downvote count: 2
tagged with: methods
has answer: http://stackoverflow.com/a/25981662
has title: Incompatible int to String (getLast() method)
has answer: http://stackoverflow.com/a/25981028
tagged with: java
has answer: http://stackoverflow.com/a/25980437
has body: I have a string array String[] names; lets say there are a given number of elements in the array I would like to make a getLast method which returns a string public String getLast() { return names.length - 1; } This gives me an error that it's incompatible. How could I do this to return a string? Also the same with an add method public void add(int index, String element){ I'm curious how this would work without using Linkedlist or Arraylist, but rather an Array-based list.
type: AnsweredQuestion
tagged with: arrays
has comment: http://stackoverflow.com/comment/40681990
has answer: http://stackoverflow.com/a/25980447

http://stackoverflow.com/comment/40627621
score: 0
type: Comment
has text: scan.next(); is blocking what about r.readLine(); both return string
comment on: http://stackoverflow.com/a/25950703
type: AnswerComment

http://stackoverflow.com/comment/40570789
comment on: http://stackoverflow.com/q/25918119
type: QuestionComment
type: Comment
score: 0
has text: Can you add a bit of specification to explain exactly what you expect to be happening?

http://stackoverflow.com/comment/40537115
comment on: http://stackoverflow.com/q/25898021
score: 0
has text: I don't see any loop there? In any case, that's exactly what AsyncTask is there for with a readily implemented onProgressUpdate callback. Why reinvent the wheel by thread spawning?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25927017
type: Answer
has comment: http://stackoverflow.com/comment/40587539
has comment: http://stackoverflow.com/comment/40656150
downvote count: 0
answers question: http://stackoverflow.com/q/25925972
upvote count: 6
has body: I'm a bit confused what exactly you are trying to achieve. It looks like you want a Factory, i.e. a class that hides how to create objects of a certain class. There is no need for a Singleton in that case, unless you have other reasons. As to your problems: You are nor returning a class instance, but an object of that class. I thought that was the whole point: creating that POI object ant returning it. I guess there is some confusion about the nomenclature, so please explain what you mean by class instance, and why you don't want to return it. In your factory method createNewPOI() you just overwrite your reference to the last created POI object, not the object itself. Unless your factory class (resp. your Singleton) is doing something with the POI object itself, there is no need to keep a reference. You return the object to the caller of the method. After that you can just forget it: . public POI createNewPOI() { return new POI(); } There is one more problem in your code: Your locking in the getInstance() method won't work. For a ReentrantLock to do its job it has to be shared between multiple threads. In your case each thread creates its own copy of the lock, without knowing of the other theads. The easiest way is to just make the method synchronized: public static synchronized ArlabFacade getInstance(Context context) { if(mArlabFacade == null) { mArlabFacade = new ArlabFacade(context); } return mArlabFacade; }
has comment: http://stackoverflow.com/comment/40658081
has comment: http://stackoverflow.com/comment/40587822
has comment: http://stackoverflow.com/comment/40655982
score: 6

http://stackoverflow.com/q/25892318
favorite count: 0
tagged with: google-api
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: google-fusion-tables
type: Question
tagged with: google-api-java-client
has title: Receiving "Rate Limit Exceeded" while writing into a Fusion Table
upvote count: 1
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25894849
accepted answer: http://stackoverflow.com/a/25894849
has body: I'm developing an web application that writes data to Fusion Tables using the API and a Service Account (OAuth2). For some reason, after 30 INSERT's, I get "Rate Limit Exceeded" (403). The only workaround is to apply exponential backoff as in https://developers.google.com/drive/web/handle-errors. According to the release notes (https://developers.google.com/fusiontables/docs/v1/release_notes), every INSERT counts for 5 requests, and my 30 INSERT's complete in ~1,5 minute, so this is about 5*30/90, thus less than 2 requests/user/second. Even if I have changed the limit in the API console to be 10, 50, 100 (requests/user/second), nothing changes; 30 INSERTS look like the best I can do in a row. It seems that I'm exceeding some other limit, but which?

http://stackoverflow.com/comment/40499524
score: 0
type: Comment
type: QuestionComment
has text: You're using main's args array, which if you're just running in your compiler likely has no arguments and a length of 0. You need to declare your own array. After that, you'll probably get a few more errors from the sc.nextLine() not being checked.
comment on: http://stackoverflow.com/q/25878755

http://stackoverflow.com/q/25926774
has answer: http://stackoverflow.com/a/25926892
type: Question
has answer: http://stackoverflow.com/a/25926814
tagged with: algorithm
has body: I did some research on importance and existence of continue; statement in Java. I can't understand why it exists, when we can modify our if(condition) to do exactly what we want to achieve. int i = 0; while (i &lt; 100) { i++; if (i % 2 == 0) { continue; } System.out.println("with continue: odd number " + i++); } System.out.println("--------"); i = 0; while (i &lt; 100) { i++; if (i % 2 != 0) System.out.println("without continue: odd number " + i++); }
possible better answer: http://stackoverflow.com/a/25926892
tagged with: continue
score: 0
answer count: 3
has title: why use "continue;" statement when I can modify if (condition)
has answer: http://stackoverflow.com/a/25926816
accepted answer: http://stackoverflow.com/a/25926814
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/25883032
answers question: http://stackoverflow.com/q/25883023
type: Answer
score: 3
has body: You need to initialize n here. int n=10; // initialize n to some value System.out.println(arithmeticprogress(n, i)); //else you will get error here Use IDE to coding. Then you will get int n; System.out.println(arithmeticprogress(n, i));//'n' might not be initialize Or else you can use n as class level variable. Then it will set to it's default value.
upvote count: 3
has comment: http://stackoverflow.com/comment/40506744
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25883023
has comment: http://stackoverflow.com/comment/40506768

http://stackoverflow.com/comment/40576233
type: Comment
type: QuestionComment
has text: Did you read the documentation?
score: 0
comment on: http://stackoverflow.com/q/25920735

http://stackoverflow.com/comment/40526226
type: Comment
type: QuestionComment
has text: What is your specific question?
comment on: http://stackoverflow.com/q/25893904
score: 0

http://stackoverflow.com/comment/40537879
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25900130
has text: This is indeed strange, since [`Vector`](http://docs.oracle.com/javase/7/docs/api/java/util/Vector.html) does not have a `bounce()` method. I would expect `Ball` to have a `bounce()` method.

http://stackoverflow.com/comment/40645130
comment on: http://stackoverflow.com/a/25958850
score: 0
type: AnswerComment
type: Comment
has text: how do i do that then?

http://stackoverflow.com/comment/40615581
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25942616
has text: certainly is not enough and workaround is also not asked by OP.

http://stackoverflow.com/comment/40632634
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25907555
type: Comment
has text: Works pretty good :) Thanks so far. If you can also help me to center the JScrollbar, then I mark your answer as the accepted answer. Because right now the label and the scrollbar are both aligned both on the left side. But the scrollbar should stick out on the left and on the right side of my label a bit.

http://stackoverflow.com/comment/40824737
type: Comment
has text: This definitely helps, but it doesn't cover all my needs. For example, I can prevent `java.lang.System` from being used like in the above example by using `importsBlacklist` and `c.setIndirectImportCheckEnabled(true)`, but this would still work: `Class.forName("java.lang.System").getMethod("currentTimeMillis", null).invoke(null)`. Another thing, we already have our custom classloader which is used (and works) for other script engines we support (javascript and python), so I would prefer if it would be possible to achieve this by using custom classloader.
comment on: http://stackoverflow.com/a/26041291
score: 0
type: AnswerComment

http://stackoverflow.com/a/26006106
has body: The only type-safe way to do it is to have a static factory method for creating the class based on the natural ordering of a comparable, instead of a constructor. The static method will be generic and will only accept types that satisfy the comparable-to-itself constraint: public class Test&lt;Data&gt; { Comparator&lt;Data&gt; c; public Test(Comparator&lt;Data&gt; comparator) { System.out.println("Comparator"); this.c = comparator; } public static &lt;T extends Comparable&lt;? super T&gt;&gt; Test&lt;T&gt; createWithComparable() { System.out.println("Comparable"); return new Test&lt;T&gt;(new Comparator&lt;T&gt;() { @Override public int compare(T p1,T p2) { return p1.compareTo(p2); } }); } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40739686
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/40731849
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26003145
answers question: http://stackoverflow.com/q/26003145

http://stackoverflow.com/comment/40607408
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25938052
has text: I find it kind of amusing that they are teaching you about arrays, but left out the fundamental concept of the index. Without which, arrays make no sense at all.
score: 0

http://stackoverflow.com/q/25989068
upvote count: 1
has answer: http://stackoverflow.com/a/26143991
type: Question
tagged with: ant
has title: What is the purpose of adfm.jar file? How to exclude it from build?
downvote count: 0
answer count: 1
tagged with: jar
has body: Mine is an adf application. adfm.jar is already available in our runtime environment and hence I don't want it to be a part of the build(ear). Please let me know what is the purpose of this adfm.jar file and how can I exclude it from being a part of the build. The build process is using ant. Sample target of my build.xml is - &lt;target name="ear" description="Deploy JDeveloper profiles" depends="init"&gt; &lt;taskdef name="ojdeploy" classname="oracle.jdeveloper.deploy.ant.OJDeployAntTask" uri="oraclelib:OJDeployAntTask" classpath="${oracle.jdeveloper.ant.library}"/&gt; &lt;ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask" executable="${oracle.jdeveloper.ojdeploy.path}" ora:buildscript="${oracle.jdeveloper.deploy.dir}/ojdeploy-build.xml" ora:statuslog="${oracle.jdeveloper.deploy.dir}/ojdeploy-statuslog.xml"&gt; &lt;ora:deploy&gt; &lt;ora:parameter name="workspace" value="${oracle.jdeveloper.workspace.path}"/&gt; &lt;ora:parameter name="profile" value="${oracle.jdeveloper.deploy.profile.name}"/&gt; &lt;ora:parameter name="outputfile" value="${oracle.jdeveloper.deploy.outputfile}"/&gt; &lt;/ora:deploy&gt; &lt;/ora:ojdeploy&gt; Any help would be greatly appreciated. Thanks.
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-adf
score: 1
tagged with: java

http://stackoverflow.com/q/25874120
has answer: http://stackoverflow.com/a/25874135
tagged with: ternary-operator
score: -2
has comment: http://stackoverflow.com/comment/40490764
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/40490506
type: Question
tagged with: java
has body: How can I convert the logic below to a ternary (?:) operator? if (node.getLeftChild() == null) return 0; else return node.getLeftChild().getValue();
has comment: http://stackoverflow.com/comment/40490470
upvote count: 0
answer count: 1
has title: Code conversion to ternary operator
favorite count: 0

http://stackoverflow.com/comment/40589593
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25915321
has text: I don't understand why this action entityManager.unwrap(Connection.class) results in clearing cache
score: 0

http://stackoverflow.com/q/25889113
downvote count: 0
linked to: http://stackoverflow.com/q/12575068
accepted answer: http://stackoverflow.com/a/25889207
answer count: 3
tagged with: android
favorite count: 0
possible better answer: http://stackoverflow.com/a/25889262
has title: How to set the UI values in fragment
has answer: http://stackoverflow.com/a/25889262
has comment: http://stackoverflow.com/comment/40517381
type: AnsweredQuestion
score: 3
tagged with: android-fragments
has answer: http://stackoverflow.com/a/25889207
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25889297
type: Question
has body: I have one mainactivity layout composing of fragment layout. Now I have created one fragment class and implementing asyncTask in the fragment class. Now on postExecute i am trying to set the values for the fragment view like trying to set text for TextView. But i am getting NullPointerException. My code snippet is: public class MainHandlerFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new MyTask().execute("xyzname"); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.home_fragment, container, false); return view; } public class MyTask extends AsyncTask<String, Void, Organization> { @Override protected String doInBackground(String... urls) { // getting api calls } @Override protected void onPostExecute(String str) { loadData(str); } } public void loadData(String str){ getSupportFragmentManager().beginTransaction() ((TextView) findViewById(R.id.text_frag)).setText("name"); // at this line getting null pointer exception } } } main_layout.xml <fragment android:id="@+id/home_fragment" android:name="com.stata.mobile.android.ui.MainHandlerFragment" android:layout_height="wrap_content" android:layout_width="match_parent"/> home_fragment.xml <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/text_frag"/>

http://stackoverflow.com/comment/40737685
has text: do u have any function do that for u? or you wanna have it?
score: 0
comment on: http://stackoverflow.com/q/26010659
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25888998
score: 0
has comment: http://stackoverflow.com/comment/40519363
type: Answer
has body: TestNG by itself provides such functionality - execution model. You use TestNG with Silk4J to create sequenced regression tests (assuming this is waht is required from you). All of the tests execution can be in a specific order - and some tests trigger a 'skip all remaining tests' when a super-critical error occurs. I'm sure that you'll find these TestNG resources helpful: How_to_execute_tests Execution_procedure Execution_Order_of_tests
answers question: http://stackoverflow.com/q/25887564

http://stackoverflow.com/q/25879761
tagged with: substring
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25879803
score: 1
tagged with: string
has body: I am attempting to write code to remove a whole sentence from a paragraph. It doesn't matter which sentence it is, but it needs to be at least one. String edit = "The cow goes moo. The cow goes boo. The cow goes roo. The cow goes jew."; int sentencestart = (edit.substring(edit.length()/2).indexOf('.') + edit.length()/2); int sentenceend = edit.substring(sentencestart).indexOf('.') + sentencestart; edit = edit.substring(0, sentencestart) + edit.substring(sentenceend); System.out.println(edit); This is the code I currently have. It is currently printing the exact same string that I begin with. Any one have any ideas? EDIT: I was wrong to imply that any sentence should be removed. I meant any sentence aside from the first. Preferably the sentence to be removed would fall somewhere within the middle of the string, and the actual application would be used in very large strings.
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/40501284
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25879816
upvote count: 1
tagged with: text-segmentation
has title: Removing a sentence from a paragraph
has answer: http://stackoverflow.com/a/25879822
has comment: http://stackoverflow.com/comment/40501286
tagged with: java

http://stackoverflow.com/q/25976190
upvote count: 4
has answer: http://stackoverflow.com/a/25979118
accepted answer: http://stackoverflow.com/a/25979118
has answer: http://stackoverflow.com/a/25977243
has body: I am working with an application that uses a Neo4J graph containing about 10 million nodes. One of the main tasks that I run daily is the batch import of new/updated nodes into the graph, on the order of about 1-2 million. After experimenting with Python scripts in combination with the Cypher query language, I decided to give the embedded graph with Java API a try in order to get better performance results. What I found is about a 5x improvement using the native Java API. I am using Neo4j 2.1.4, which I believe is the latest. I have read in other posts that the embedded graph is a bit faster, but that this should/could be changing in the near future. I would like to validate my findings with anyone who has observed similar results? I have included snippets below just to give a general sense of methods used - code has been greatly simplified. sample from cypher/python: cnode = self.graph_db.create(node(hash = obj.hash, name = obj.title, date_created = str(datetime.datetime.now()), date_updated = str(datetime.datetime.now()) )) sample from embedded graph using java: final Node n = Graph.graphDb.createNode(); for (final Label label : labels){ n.addLabel(label); } for (Map.Entry&lt;String, Object&gt; entry : properties.entrySet()) { n.setProperty(entry.getKey(), entry.getValue()); } Thank you for your insight!
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has title: Performance of Java API versus Python with Cypher for Neo4J
score: 4
answer count: 3
has answer: http://stackoverflow.com/a/25977314
tagged with: neo4j
favorite count: 0
tagged with: cypher
possible better answer: http://stackoverflow.com/a/25977243
tagged with: python

http://stackoverflow.com/a/25879535
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25879487
type: Answer
answers question: http://stackoverflow.com/q/25879487
has body: The messages will be delivered only to the handler you use to send the message, two different handlers will not share any info about the messages sent to a different handler, hence, if you have the same "what" attribute in different messages, it will be passed to the "handleMessage(Message msg)" of the handler that called "sendMessage(yourMessage)", for example: secondUIThreadHandler.sendMessage(secondMsg); In the code above it means that the message will be received by the second handler only and it will be able to use the "what" attribute no matter if that attribute is the same for another message other than the current one used in secondUIThreadHandler. Hope it helps! Regards!

http://stackoverflow.com/q/25945590
answer count: 2
possible better answer: http://stackoverflow.com/a/25945752
accepted answer: http://stackoverflow.com/a/25945754
downvote count: 0
has answer: http://stackoverflow.com/a/25945752
linked to: http://stackoverflow.com/q/14922014
favorite count: 0
linked to: http://stackoverflow.com/q/25712596
has comment: http://stackoverflow.com/comment/40620046
has title: 3-Sum Java to Python conversion
tagged with: python
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/40620032
tagged with: java
has comment: http://stackoverflow.com/comment/40619940
type: Question
score: 3
has body: I am trying to convert this Java(I think) code into Python. From: public class ThreeSum { public static int count(int[] a) { int N = a.length; int count = 0; for (int i = 0; i &lt; N; i++) for (int j = i+1; k &lt; N; j++) for (int k = j+1; k&lt;N; k++) if (a[i] + a[j] + a[k] == 0) count++; return count; } public static void main(String[] args) { int[] a = In.readInts(args[0]); StdOut.printIn(count(a)); } } To: a = [30,-40,-20,-10,40,0,10,5] def check(list): N = len(list) count = 0 i = 0 while i &lt; N: i += 1 j = i+1 while j &lt; N: j += 1 k = j+1 while k &lt; N: k += 1 if a[i]+a[j]+a[k] == 0: #&lt;-- this is the main part with error "list index out of range" count += 1 return count print count check(a) It's supposed to check all the numbers in the list how many sums of 3 pairs equals 0. I'm not sure what to use instead of "for(int i = 0; i &lt; N; i++)". I think my while loops do the same thing, or am I wrong?
has answer: http://stackoverflow.com/a/25945754
has comment: http://stackoverflow.com/comment/40620041
has comment: http://stackoverflow.com/comment/40625643

http://stackoverflow.com/q/26019086
score: 0
has title: Gson to Plain Old Java Object(POJO)
answer count: 1
has body: I have read through the GSon user guide and looked at some questions on here but I am really struggling to understand why I am getting error whilst trying to make a java object with GSon public class TestJSON extends ActionBarActivity { private Location start; private String length; private String url = "http://maps.googleapis.com/maps/api/directions/json?origin="; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test_json); // dummyprovider is provided by google to let me set a location. start = new Location("dummyprovider"); start.setLatitude(51.5033630); start.setLongitude(-0.1276250); // Recieve an android warning if you run a retrieval task (such as JSON) // in the main thread). try { System.out.println("printing Json"); Thread thread = new Thread(new Runnable() { @Override public void run() { try { toJava(readJsonFromUrl(urlBuilder())); } catch (Exception e) { e.printStackTrace(); } } }); thread.start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.test_json, 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); } // I think in future I will call this function a ton of times and send it // some locations as waypoints for it to try and get closer to the // distances. private String urlBuilder() { String newUrl = url + start.getLatitude() + "," + start.getLongitude() + "&destination=51.5042178,23"; return newUrl; } // Builds the string for JSON. private Str…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26019531
has comment: http://stackoverflow.com/comment/40752573
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
linked to: http://stackoverflow.com/q/25817922
has comment: http://stackoverflow.com/comment/40752564
has comment: http://stackoverflow.com/comment/40752719
has comment: http://stackoverflow.com/comment/40752795
tagged with: pojo
has comment: http://stackoverflow.com/comment/40753072
duplicate of: http://stackoverflow.com/q/25817922

http://stackoverflow.com/a/31432562
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25910553
has body: Probably, it is a dependency issue. You need to add commons-lang3 as dependency. You can find the required .jar file here. Check this answer. P.S.- May be I should have put this in comment but as my reputation is quite low, I can't.
downvote count: 0

http://stackoverflow.com/a/26009396
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26009284
has body: As a matter of fact it looks to me like your eclipse doesnt recognize your app-compat anymore. This happend to me once too, after I closed and reopend the appcompat-project. Try to close all your projects -> open the appcompat first -> restart eclipse and maybe do a clean on your project Hope this helps.
upvote count: 1

http://stackoverflow.com/comment/40598136
type: AnswerComment
comment on: http://stackoverflow.com/a/25919719
type: Comment
has text: Yeah..checked this file...nothing there except for a few default comments.
score: 0

http://stackoverflow.com/comment/40547555
score: 1
comment on: http://stackoverflow.com/q/25905662
type: Comment
type: QuestionComment
has text: Sometimes it's a good idea to spilt up code into multiple methods or classes with descriptive names. This gives you a better, more abstract view on your algorithm so it is much easier to find problems.

http://stackoverflow.com/q/25935836
has answer: http://stackoverflow.com/a/25937890
accepted answer: http://stackoverflow.com/a/25937890
has body: I am working in Grails application and want to log messages in different files. I want to log exceptions, normal and API logs in different files. But according to Log4j general roles, If we set logger level to 'Info' then warn and error messages will also start logging in this file while I want to log error messages in different file. So, thus my error messages will be logged twicely in error file and in info file too. While I want that 'info' logger log just 'info' level messages not 'error' level messages too. And 'error' logger just log error messages. Below is my Log4j Configuration: log4j = { def layoutPattern = new PatternLayout("[%d{ISO8601}] %m \r\n") def dailyRollingInfoFile = new DailyRollingFileAppender( name:"rollingInfoFileAppender", layout: layoutPattern, //Path of the Log File fileName:"C:\\MS-Logs\\Application\\MSLogs.log", datePattern: "'.'dd-MM-yyyy") def dailyRollingExceptionFile = new DailyRollingFileAppender( name:"rollingExceptionFileAppender", layout: layoutPattern, //Path of the Log File fileName:"C:\\MS-Logs\\Exceptions\\ExceptionLogs.log", datePattern: "'.'dd-MM-yyyy") def dailyRollingExceptionAPIFile = new DailyRollingFileAppender( name:"rollingAPIFileAppender", layout: layoutPattern, //Path of the Log File fileName:"C:\\MS-Logs\\API\\MS-NotificationsLogs.log", datePattern: "'.'dd-MM-yyyy") //For logging exceptions stack trace appenders { appender dailyRollingInfoFile appender dailyRollingExceptionFile appender dailyRollingExceptionAPIFile } root { info 'rollingInfoFileAppender', additivity: false debug 'rollingAPIFileAppender', additivity: false error 'rollingExceptionFileAppender' } } And Now, this is how I add filters: dailyRollingExceptionFile.addFilter(new org.apache.log4j.varia.LevelMatchFilter(levelToMatch:'ERROR', acceptOnMatch: true)) dailyRollingExceptionFile.addFilter(new org.apache.log4j.varia.DenyAllFilter()) //To make it sure that It will just Log, Messages by Info Logger dailyRollingInfoFile.addFilter(new org.apache.log4j.va…
tagged with: logging
type: Question
tagged with: java
tagged with: grails
linked to: http://stackoverflow.com/q/14844945
score: 0
linked to: http://stackoverflow.com/q/6330436
answer count: 1
has title: Avoiding Multiple Logging of Same Message Due to Default behaviour in Log4j
tagged with: log4j
type: AnsweredQuestion

http://stackoverflow.com/comment/40608516
type: Comment
type: QuestionComment
has text: Can you post the stack trace?
comment on: http://stackoverflow.com/q/25939010
score: 0

http://stackoverflow.com/comment/40698942
type: Comment
comment on: http://stackoverflow.com/a/25989596
type: AnswerComment
score: 0
has text: thanks for your reply.. already i tried this way.. but formatting is not happen.... display the number right to left order

http://stackoverflow.com/comment/40577653
type: QuestionComment
comment on: http://stackoverflow.com/q/25920617
score: 0
has text: @WillP added example DSL
type: Comment

http://stackoverflow.com/a/25999314
answers question: http://stackoverflow.com/q/25998991
type: Answer
has body: I would make an array of all words in the text. Then check it with 2 for loops if the textArray contains all the searchterms. public boolean search(String text, String[] searchItems) { String[] textArray = text.split(" "); for(String searchitem: searchItems) { boolean b = false; for(String word : textArray) { if(word.equals(searchitem)) { b = true; break; } } // text doesn't contain searchitem if(!b) return false; } return true; }
score: 0

http://stackoverflow.com/q/25925023
accepted answer: http://stackoverflow.com/a/25925200
tagged with: ejb
has title: Adding state to a @Stateless bean
answer count: 1
downvote count: 0
has body: I have some code in a bean that monitors a connection handle: @Stateless public class MyClass { private CloseableHttpAsyncClient deviceHandle = null; @Schedule(second="*/30", minute="*", hour="*", persistent=false) void checkConnection() { if (deviceHandle != null) { if (deviceHandle.isRunning()) { // Ping connection } else { deviceHandle = reconnectToDevice(); } } } public void initialise() { deviceHandle = connectToDevice(); } } According to the EJB 3.1 specs @Schedule may be used only on @Stateless beans, so of course my code fails because I get a different bean on the timer ticks with a null deviceHandle. Therefore, my question is what is the best practise for this requirement - where should I stash my handle? @Inject a @Singleton? @Inject an @ApplicationScoped bean? @Inject the bean from my ServletContextListener and store the state there (I do that with another truly @Stateless timer tick)?
favorite count: 0
has answer: http://stackoverflow.com/a/25925200
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/25959948
tagged with: linux
tagged with: jce
upvote count: 12
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/1179672
type: Question
has answer: http://stackoverflow.com/a/25960171
tagged with: java
accepted answer: http://stackoverflow.com/a/25960171
has body: In java platform documentation http://www.oracle.com/technetwork/java/javase/jrereadme-182762.html. Regarding the comment about /lib/security/local_policy.jar /lib/security/US_export_policy.jar Unlimited Strength Java Cryptography Extension Due to import control restrictions for some countries, the Java Cryptography Extension (JCE) policy files shipped with the Java SE Development Kit and the Java SE Runtime Environment allow strong but limited cryptography to be used. An unlimited strength version of these files indicating no restrictions on cryptographic strengths is available on the JDK web site for those living in eligible countries. Those living in eligible countries may download the unlimited strength version and replace the strong cryptography jar files with the unlimited strength files. Questions Does every JDK bundle comes with local_policy.jar and US_export_policy.jar ? What is the limitation in default local_policy.jar and US_export_policy.jar. Is it the key size ? If I need to use 128 bit keys does it required to go for Unlimited Strength Java Cryptography Extension Is there a way I can keep these two jars in external path and load it. Because I have more 50 servers rather than coping in each JDK I would prefer to maintain it in a central place.
score: 12
answer count: 1
favorite count: 0
has title: local_policy.jar and US_export_policy.jar different with Unlimited Strength Vs Default.

http://stackoverflow.com/a/25906392
has body: Try this way,hope this will help you to solve your problem. Here i try to improve your LinearLayout weight allocation <ImageView android:id="@+id/buttonClip" android:layout_width="wrap_content" android:layout_height="match_parent" android:src="@drawable/ic_launcher" android:scaleType="fitXY"/> <EditText android:id="@+id/editChatMessage" android:layout_width="0dp" android:layout_height="match_parent" android:gravity="top|left" android:maxLines="5" android:layout_weight="1"/>
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25906217
answers question: http://stackoverflow.com/q/25906217
has comment: http://stackoverflow.com/comment/40549325

http://stackoverflow.com/q/25928642
has answer: http://stackoverflow.com/a/25928731
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40589776
has comment: http://stackoverflow.com/comment/40589767
type: Question
accepted answer: http://stackoverflow.com/a/25928731
has title: Meaning of Java syntax: class A extends B<C>
has body: What does this syntax mean in Java: class A extends B&lt;C&gt;? I came across this in an Android library and couldn't find it on google. More specifically, this is what I had come across: public class PullToRefreshExpandableListView extends PullToRefreshAdapterViewBase&lt;ExpandableListView&gt;
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/7282677
score: -3
duplicate of: http://stackoverflow.com/q/7282677
downvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/comment/40580094
comment on: http://stackoverflow.com/q/25922434
score: 0
has text: Rather than use Function<T, T> you can shorthand to UnaryOperator<T>
type: Comment
type: QuestionComment

key-value
tags question: http://stackoverflow.com/q/25955749
tag name: key-value
type: Tag

http://stackoverflow.com/comment/40729809
comment on: http://stackoverflow.com/a/26006339
score: 0
type: AnswerComment
has text: That worked like a charm. Thank you Makoto. One more question, the example records the audio to a raw byte file...how do I go about recording it to say an mp3 or ogg file?
type: Comment

http://stackoverflow.com/comment/40702354
comment on: http://stackoverflow.com/q/25991543
has text: If it's just a getter, I doubt this is a performance problem - especially in the context of web. If you have a readability problem, sure - refactor.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/25928349
has title: Radio Button setchecked cannot be set to true in Android
possible better answer: http://stackoverflow.com/a/25928393
answer count: 2
tagged with: radio-button
accepted answer: http://stackoverflow.com/a/25928878
downvote count: 0
favorite count: 0
tagged with: android
tagged with: checkbox
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am trying to make a radio button toggle using setChecked(). setChecked(false) works fine but setChecked(true) doesn't work. Also tried toggle(), even this doesn't uncheck the radio button. I need a solution without using radio groups. Just a single radio button and on tapping should toggle its state. MainActivity.java public void radioCheck(View v) { System.out.println("radioCheck"); RadioButton rb = (RadioButton) findViewById(R.id.radioButton1); //rb.toggle(); if (rb.isChecked() == true) { rb.setChecked(false); } else { rb.setChecked(true); } } activity_main.xml &lt;RadioButton android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/button1" android:layout_centerHorizontal="true" android:onClick="radioCheck" android:text="Set me" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/radioButton1" android:layout_centerHorizontal="true" android:layout_marginBottom="39dp" android:onClick="radioCheck" android:text="On/ Off" /&gt; Surprisingly, setChecked works when a button is used to uncheck the radio button but the same doesn't work when set on radio button.
upvote count: 1
has answer: http://stackoverflow.com/a/25928878
type: Question
has answer: http://stackoverflow.com/a/25928393
has comment: http://stackoverflow.com/comment/40589174

http://stackoverflow.com/comment/40594070
comment on: http://stackoverflow.com/a/25929437
type: AnswerComment
type: Comment
has text: i thought of making the EmailId column unique to the signup table and getting the CustId through it
score: 0

cider
tag name: cider
type: Tag
tags question: http://stackoverflow.com/q/25930222

http://stackoverflow.com/comment/40622205
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25942071
has text: I added namespace to the xml file. Without it couldn't work `xmlns="http://www.opentravel.org/OTA/2003/05"`. But you saw which output It got. I couldn't understand why this happen. Can you give some suggestions how to parse **from xml to objects without JAXB**? Which approach will be better to parse this `request.xml`.
score: 0

http://stackoverflow.com/q/25978683
has answer: http://stackoverflow.com/a/41231644
tagged with: url
has answer: http://stackoverflow.com/a/25979354
has body: Pages with spaces in the URL don't get correctly translated: i.e. http://www.streetinsider.com/Press Releases/National Trends Reflected in Plano Housing Market/9778767.html or http://www.streetinsider.com/Press%20Releases/National+Trends+Reflected+in+Plano+Housing+Market/9778767.html Gives 404. Please note "Press Releases" is encoded as "Press%20Releases". However following two versions work fine where "Press Releases" is encoded as "Press+Releases". http://www.streetinsider.com/Press+Releases/National+Trends+Reflected+in+Plano+Housing+Market/9778767.html The article parses fine with plus signs or HEX spaces %20. http://www.streetinsider.com/Press+Releases/National%20Trends%20Reflected%20in%20Plano%20Housing%20Market/9778767.html Both + and %20 represent spaces. Then why this behavior. And also, in java what could I use to get the correct encoded URL
answer count: 3
upvote count: 1
tagged with: query-string
favorite count: 0
type: UnansweredQuestion
has title: Different behavior when space is encoded as + and %20 in a URL
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25979245
tagged with: encoding

http://stackoverflow.com/a/25939290
has comment: http://stackoverflow.com/comment/40608988
score: 1
has body: You can do use this as a condition collection1.size()==collection2.size() &amp;&amp; collection1.containsAll(collection2) Here you are checking that both the collections are of same size as well as the have all the elements. As per the comments by joachim-isaksson you can do this but will not be efficient. collection1.containsAll(collection2) &amp;&amp; collection2.containsAll(collection1) You should use ReflextionAsserter
has comment: http://stackoverflow.com/comment/40609094
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/40608993
has comment: http://stackoverflow.com/comment/40609338
has comment: http://stackoverflow.com/comment/40609029
answers question: http://stackoverflow.com/q/25939261
type: Answer
has comment: http://stackoverflow.com/comment/40609448
has comment: http://stackoverflow.com/comment/40609733
has comment: http://stackoverflow.com/comment/40608971
has comment: http://stackoverflow.com/comment/40609815

http://stackoverflow.com/comment/40537350
score: 0
type: Comment
type: QuestionComment
has text: @MikeKobit Thats intentional. The example demostrates that none of these objects should get created because of the incorrect fully qualified name for the bean AInstance. yet, depending on how I order them, it is possible that spring will construct the B and C classes anyway, possibly leaking resources.
comment on: http://stackoverflow.com/q/25899632

http://stackoverflow.com/comment/40639738
score: 0
comment on: http://stackoverflow.com/q/25954233
type: Comment
type: QuestionComment
has text: @azurefrog yea indeed it is string but I cannot output it in a system.Out.Print because of the reader. Line is 0 or 1 depending if the service started or not but I also want to check the other states... If I do an system. Out of the line before the while loop ends, the output will be 0 if the service is stopped

http://stackoverflow.com/comment/40494565
type: QuestionComment
has text: This is a very broad question. Please research first, try some tutorial, and when you get stuck at a specific point and don't find a solution elsewhere, you are welcome to post a question.
comment on: http://stackoverflow.com/q/25876210
score: 0
type: Comment

http://stackoverflow.com/a/25899374
type: Answer
answers question: http://stackoverflow.com/q/25892831
upvote count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40727154
has body: The exception means: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes. noticed you, that jersey can't find service classes. Your init-param jersey.config.server.provider.packages isnt set correct and additionally at the wrong place. Thats the place where you want to add resource CLASSES and after that, jersey wants to find some @Path annotations aka resource classes in there. As i said, its at the wrong place - its not part of an filter, its part of the ServletContainer servlet config. Alternatively you could leave this out and declare packages in your ResourceConfig or Application implementation. pls read: deployment guide Summary: &lt;filter&gt;...&lt;/filter&gt; is where you can place filters and &lt;servlet&gt;...&lt;/servlet&gt; (i can't find in your part of web.xml) is where you should insert ServletContainer to. Cause I've answered this question to you yesterday, i really advice you to read the manuals and try some sample projects, like: gradle &amp; tomcat jersey examples You will also find some web.xml there.

http://stackoverflow.com/q/25885758
upvote count: 1
has answer: http://stackoverflow.com/a/26362811
type: Question
tagged with: profile
score: 1
tagged with: java
downvote count: 0
answer count: 1
tagged with: tomcat
favorite count: 0
has body: I have developed a web app using log4j-1.2.14.jar, and I am seeing that org.apache.log4j.spi.LocationInfo is taking up 76% of my CPU time. I have checked Java VisualVM Can anybody helps me in order to improve the efficience of my web app Thank you so much in advance
tagged with: log4j
has title: Log4j LocationInfo Struts + Tomcat slowness
tagged with: visualvm
type: UnansweredQuestion

http://stackoverflow.com/comment/40571558
type: Comment
type: QuestionComment
score: 1
has text: array is primitive or Object type?
comment on: http://stackoverflow.com/q/25918532

http://stackoverflow.com/a/26031550
has body: why don't you turn it to lowercase? while (fileName.toLowerCase().endsWith(".csv")) { fileName = fileName.substring(0, fileName.toLowerCase().lastIndexOf(FILE_SUFFIX_CSV)); if (fileName.trim().isEmpty()) { throw new IllegalArgumentException(); } }
upvote count: 12
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26031519
type: Answer
has comment: http://stackoverflow.com/comment/40802068
answers question: http://stackoverflow.com/q/26031519
has comment: http://stackoverflow.com/comment/40775326
has comment: http://stackoverflow.com/comment/40775297
has comment: http://stackoverflow.com/comment/40775259
score: 12

http://stackoverflow.com/a/25905220
has comment: http://stackoverflow.com/comment/40548209
score: 1
downvote count: 1
upvote count: 2
has body: The expression (count * (count - 1)) is not count!, not by a long shot. When count becomes four, you start getting errors. because 4! is 24 but 4 x 3 is only 12. It gets worse, of course: 10 x 9 is 90 but 10! is a whopping three and half million. Another problem you have is that your if (count &gt;= n) condition may not be doing what you expect. Aside from the fact it's almost certainly the wrong condition for some of the statements (you'd only want to do another term if count was still less than n but the break makes sense with the given condition), your indentation leads me to believe that you think the whole block will be executed for that if statement: if (count &gt;= n) count = count + 2; sum = x + (x * -(x * x) / (count * (count - 1))); x = sum; break; However, indentation doesn't control that, braces do. Without the braces, only the first indented statement is subject to the if, all the others happen in every iteration. But, regardless of that, your code logic seems very ... err, tortured. The great thing about most infinite series calculations is that you really only to worry about the sum and the current term. It seems very convoluted to be swapping around all those variables continuously when you can just have a loop like this: double mult = 1.0; while (count &lt;= n) { term = Math.pow(x,count) / facto (count); sum += mult * term; count += 2; mult = -mult; } A complete program showing this in action follows: import java.util.Scanner; public class Test { public static double facto (int inum) { double num = inum; while (--inum &gt; 1) num *= inum; return num; } public static void main(String[] args) { double term = 0.0, sum = 0.0, x; int n, count = 1; Scanner kb = new Scanner(System.in); System.out.print("Enter positive odd integer: "); n = kb.nextInt(); if ((n &lt; 1) || (n % 2) == 0) { System.out.println("Apparently, someone can't read too well :-)"); n = (n &lt; 1) ? 1 : n + 1; } System.out.println("Using " + n); System.out.print("Enter x: "); x = kb.next…
type: Answer
answers question: http://stackoverflow.com/q/25905063
has comment: http://stackoverflow.com/comment/40548507

http://stackoverflow.com/comment/40681732
score: 0
type: Comment
type: QuestionComment
has text: Take a look at [is-java-pass-by-reference-or-pass-by-value](http://stackoverflow.com/questions/40480/is-java-pass-by-reference-or-pass-by-value) for more information.
comment on: http://stackoverflow.com/q/25980000

http://stackoverflow.com/q/26004920
tagged with: arrays
has comment: http://stackoverflow.com/comment/40727112
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26005002
has comment: http://stackoverflow.com/comment/40727254
has comment: http://stackoverflow.com/comment/40727329
has title: Setting Variable in Class that Extends other class
has body: the psuedo for what im trying to do is -send Array of EMPLOYEE objects to Restaurant Class -In Class RESTAURANT give each of the employee objects a name and last name (last name not in employee Class but in PERSON Class which Employee CLass Extends. -print say employeeList[1].getLastName() hopefully my code explains better class Person { public Person(final String last) { } } class Employee extends Person { private String firstName; // getFirstName method // getLastName Method Employee(final String first, final String last) { super(last); } } class Restaurant { // set first object in array have first and last name public void setFirstLast(final Employee[] employeeList) { String firstName = "Jovana"; String lastName = "Valdez"; employeeList[0] = new Employee(firstName, lastName); // set up via constructor } } public class Main { private String lastName; public static void main(final String[] args) { Employee[] employeeList = new Employee[1]; // my array of Employee objects, all set to null Restaurant restaurant = new Restaurant(); restaurant.setFirstLast(employeeList); } } from main when i try to print System.out.printf("first is %d\n",arrayList.getFirst()); i get null for the value as well as the value for the last name so what is the correct way to go about and set values to objects in the array? Edit arrayList initialized in Class restaurant by public Table[] create_table_array(Table table,int number) { Table[] TableList = new Table[number]; int i = 0; for(i = 0; i &lt; number; i++) { TableList[i] = table; } return TableList;
tagged with: super
has comment: http://stackoverflow.com/comment/40727193
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26007057
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40727083

http://stackoverflow.com/q/25880891
type: UnansweredQuestion
tagged with: jdbc
has title: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
has body: i have a java system application which connects to a MySQL server hosted on bigRock , the application is working fine when i try to retrieve data from the database but on insertion it shows the following error. SEVERE: null com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Connection reset by peer: socket write error STACKTRACE: java.net.SocketException: Connection reset by peer: socket write error My connection class looks like import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; import java.sql.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import sun.jdbc.odbc.JdbcOdbc; public class DataBaseFunctionting { Connection conn =null; PreparedStatement preparedStatement=null; boolean reachable ; private void connectionCheck() // checks wether client is connected to the internet and host is reachable { Socket socket = null; reachable = false; try { socket = new Socket("www.rinchedmurtipujaksang.com", 80); reachable = true; } catch (UnknownHostException ex) { Logger.getLogger(addNewArea.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(addNewArea.class.getName()).log(Level.SEVERE, null, ex); } finally { if (socket != null) try { socket.close(); } catch(IOException e) {} } } public Connection connect() { connectionCheck(); if(!reachable) { JOptionPane.showMessageDialog(null,"Unable to reaach the Server.\nCheck your internet connection OR contact host."); return null; } try { String dbURL = "jdbc:mysql://rinchedmurtipujaksang.com:3306/rin*******a"; String username ="rinc*******min"; String password = "****"; conn = null; Statement stmt = null; ResultSet rs = null; Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(dbURL, username, password); return conn; } catch (Exception e) { Logger.getLogger(DataBaseFunctionting…
tagged with: database-connection
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
type: Question
duplicate of: http://stackoverflow.com/q/9527459
has comment: http://stackoverflow.com/comment/41177008
upvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/9527459

http://stackoverflow.com/comment/40677986
has text: sorry to hear that; The message you get is java telling you that it can't find a class. This is usually due to classpath errors. Other options are wrong path settings for stardog or really missing files.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25975465

http://stackoverflow.com/q/25984275
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26074357
accepted answer: http://stackoverflow.com/a/26074357
has title: android: why Am I getting END_TAG error when I execute a function while it is a copy-paste of other which is working?
type: Question
score: 1
tagged with: java
tagged with: ksoap2
has body: I am getting an END_TAF error when I call to WCF webservice. My Stack error is : 09-22 22:43:30.711: W/System.err(3338): org.xmlpull.v1.XmlPullParserException: expected: END_TAG {http://schemas.xmlsoap.org/soap/envelope/}Body (position:END_TAG </{http://schemas.xmlsoap.org/soap/envelope/}s:Fault>@1:802 in java.io.InputStreamReader@536f30c4) 09-22 22:43:30.711: W/System.err(3338): at org.kxml2.io.KXmlParser.require(KXmlParser.java:2046) 09-22 22:43:30.715: W/System.err(3338): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:138) 09-22 22:43:30.715: W/System.err(3338): at org.ksoap2.transport.Transport.parseResponse(Transport.java:63) 09-22 22:43:30.715: W/System.err(3338): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100) 09-22 22:43:30.715: W/System.err(3338): at org.tempuri.IAndroid.userPasswordExists(IAndroid.java:304) 09-22 22:43:30.715: W/System.err(3338): at org.tempuri.IAndroid.getAllProductsAndOffers(IAndroid.java:50) 09-22 22:43:30.715: W/System.err(3338): at info.android.AllFragment.onCreateView(AllFragment.java:48) 09-22 22:43:30.719: W/System.err(3338): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829) 09-22 22:43:30.719: W/System.err(3338): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035) 09-22 22:43:30.719: W/System.err(3338): at android.app.BackStackRecord.run(BackStackRecord.java:635) 09-22 22:43:30.719: W/System.err(3338): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397) 09-22 22:43:30.719: W/System.err(3338): at android.app.Activity.performStart(Activity.java:5017) 09-22 22:43:30.723: W/System.err(3338): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2032) 09-22 22:43:30.723: W/System.err(3338): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 09-22 22:43:30.723: W/System.err(3338): at android.app.ActivityThread.access$600(ActivityThread.java:130) 09-22 22:43:30.723: W/System.err(3338): at androi…
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android

http://stackoverflow.com/q/25972299
has answer: http://stackoverflow.com/a/25972425
has comment: http://stackoverflow.com/comment/40668844
has comment: http://stackoverflow.com/comment/40667013
has comment: http://stackoverflow.com/comment/40667021
type: UnansweredQuestion
tagged with: singleton
has answer: http://stackoverflow.com/a/25972778
linked to: http://stackoverflow.com/q/25901714
has comment: http://stackoverflow.com/comment/40668799
score: 0
tagged with: java
tagged with: multithreading
has title: Using Singleton Design with Inheritance in a multithreaded Application
tagged with: design-patterns
type: Question
has comment: http://stackoverflow.com/comment/40667000
has answer: http://stackoverflow.com/a/25972366
tagged with: inheritance
has body: I am having an application where code is somewhat written like this public Interface SuperCLass{ //....to do some methods } public class BaseClass1 implements SuperCLass{ //....to do some methods } public class BaseClass2 implements SuperCLass{ //....to do some methods } Now in my application only one object can be instantiated for SuperClass reference, i.e a synchronized singleton. Now, I can include public static synchronized SuperCLass getInstance(){ //initialise } in any of the base classes, but I cannot include this declaration in SuperClass interface due to which I cannot get back instance of base class using reference of super class. e.g. I want to do this(its a very vague example) BaseClass1 bc1 = BaseClass1.getInstance(); SuperClass sc = bc1.getInstance(); Now somewhere later in the code bc1=sc.getInstance(); How can this be achieved? Note: Several threads would be accessing these objects hence synchronisation is mandatory
has comment: http://stackoverflow.com/comment/40668870
answer count: 3

http://stackoverflow.com/comment/40773855
type: QuestionComment
type: Comment
has text: I'm going to try one last time. This is a Q&A website (read the Help Center). You've dumped your requirements, but you haven't asked a question. Is your question: "How do I sort data?"? You'll have to be much more specific.
comment on: http://stackoverflow.com/q/26030602
score: 0

http://stackoverflow.com/a/25969816
has body: The trick is that in the way you define it, B has 2 members that are called a. Consider this: add methods to class B as follows: public int x() { return this.a; } public int y() { return super.a; } If you then do public static void main(String[] args) { B b = new B(); System.out.println(b.x()); System.out.println(b.y()); } Output will be: 3 9 Your definition of a in class B does not replace or overwrite the a from class A: it hides it. As you can see, you can still access it through calling super, but it does lead to unmaintainable code and is therefore discouraged. There are several things you should do to avoid this kind of mishap: Do not give several fields the same name, because it will make your code less clear. Make your object members private unless you really have a compelling reason not to. Your example has demonstrated that even protected access can make things opaque in a hurry. Use getters and setters for the members. If your object is of type B, then it doesn't matter whether your object is defined as A or B. Whether you write this: A obj = new B(); obj.getA(); or this: B obj = new B(); obj.getA(); won't matter for your output, because your method call will always call the getter as "low" as possible in the class hierarchy, which will always be B (if a method is available) because the runtime type of the object is B. That last bit is actually @TheLostMind 's point
answers question: http://stackoverflow.com/q/25969519
has comment: http://stackoverflow.com/comment/40662993
type: Answer
has comment: http://stackoverflow.com/comment/40663127
score: 0

http://stackoverflow.com/q/25931853
type: Question
tagged with: animation
answer count: 1
linked to: http://stackoverflow.com/q/6255106
tagged with: oop
has title: Java Applet isn't displaying circle
score: 0
tagged with: java
has body: I was trying to make a circle and displaying that on applet window. But after running the code it neither creates any window nor displays the Circle. My code doesn't show any error. Where is the error? package webgame; import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; import java.util.logging.Level; import java.util.logging.Logger; public class StartingPoint extends Applet implements Runnable { int x = 0; int y = 0; int dx = 2; int dy = 2; int radius = 10; @Override public void init() { } @Override public void start() { Thread thread = new Thread(this); thread.start(); } @Override public void run() { while (true) { repaint(); try { Thread.sleep(17); } catch (InterruptedException e) { //Logger.getLogger(StartingPoint.class.getName()).log(Level.SEVERE, null, e); e.printStackTrace(); } } //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void stop() { } @Override public void destroy() { } @Override public void paint(Graphics g) { g.setColor(Color.CYAN); g.fillOval(x, y, radius, radius); } public static void main(String[] args) { // TODO code application logic here } }
has comment: http://stackoverflow.com/comment/40618595
type: UnansweredQuestion
tagged with: applet
tagged with: netbeans
has answer: http://stackoverflow.com/a/25932105

http://stackoverflow.com/q/25980860
has body: UPDATE: It appears that it is Expression Language (EL) that is not being processed. Inclusion of scriptlets like <% System.out.println("Hello"); %> do in fact work. So it looks like (this is a wild guess) it's something that's not happy with the JSP 2.1 api that I'm including as a Maven dependency: javax.servlet.jsp jsp-api 2.1 provided ORIGINAL: This is a remarkably simple problem, but I can't find what's causing it. Hopefully someone can look at it and say "oh, you forgot the X!" (Whatever "X" turns out to be.) I created a web project from the Maven Simple Webapp archetype, which yields a simple project with one JSP page, index.jsp, <%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> Hello World! <c:set var="myVar" >Some Text Here</c:set> ${myVar} When build and run this app in Tomcat, I would expect to get a web page that says Hello World! Some Text Here but instead I get: Hello World! ${myVar} So, the JSP is not being processed somehow. I don't get an error, but I also don't get the expected result. The Tomcat server is installed and working with other apps, so I don't think the problem is there. This app is extremely small and simple, here's the web.xml Archetype Created Web Application Here's the entire pom.xml 4.0.0 org.sample myweb war 1.0-SNAPSHOT myweb Maven Webapp http://maven.apache.org 1.6 junit junit 3.8.1 test javax.servlet jstl 1.1.2 taglibs standard 1.1.2 javax.servlet servlet-api 2.5 provided javax.servlet.jsp jsp-api 2.1 provided myweb org.apache.maven.plugins maven-compiler-plugin 2.5.1 ${compilerSource} ${compilerSource} true true
has answer: http://stackoverflow.com/a/25984065
has comment: http://stackoverflow.com/comment/40685464
accepted answer: http://stackoverflow.com/a/25984065
tagged with: maven
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40683007
possible better answer: http://stackoverflow.com/a/25981024
tagged with: java
has answer: http://stackoverflow.com/a/25981024
has comment: http://stackoverflow.com/comment/40686007
type: Question
tagged with: jsp
has title: Maven Simple Webapp archetype doesn't process jsp pages?
tagged with: tomcat
score: 0
answer count: 2

http://stackoverflow.com/q/25886289
has answer: http://stackoverflow.com/a/25886461
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40516083
has comment: http://stackoverflow.com/comment/40538225
has title: Follow-up:How to show all combinations of IP address that can be created from a string of numbers?
has answer: http://stackoverflow.com/a/25887281
tagged with: data-structures
has answer: http://stackoverflow.com/a/25886735
has answer: http://stackoverflow.com/a/25886653
has comment: http://stackoverflow.com/comment/40538158
has comment: http://stackoverflow.com/comment/40538073
has body: This is a follow-up to this question. I need to format the input string into IP address format, so I have the following code; however, the problem is that it is providing all the combinations but I need to find those that each of their groups in not more than 255. Question: From provided string 19216801, I think you can't identify exact ip. It can be 192.168.0.1 or 19.216.80.1 or any other combination? Answer: I am not looking for any specific IP I just need to show all the possible combinations that their groups are not more than 255. Code String number = "19216801"; int l = number.length() - 3; for(int a = 0; a &lt; l; a++) { for(int b = 0; b &lt; l-a; b++){ for(int c = 0; c &lt;l-a-b; c++){ StringBuilder sb = new StringBuilder(number); sb.insert(a+1, "."); sb.insert(a+b+3, "."); sb.insert(a+b+c+5, "."); System.out.println(sb); } } }
type: UnansweredQuestion
answer count: 4

http://stackoverflow.com/comment/40557810
type: AnswerComment
comment on: http://stackoverflow.com/a/25910861
has text: Thanks a Ton!! It worked. But i dint get the logic behind this , can you please let me know what is the trick here ?
type: Comment
score: 0

http://stackoverflow.com/a/25967155
type: Answer
answers question: http://stackoverflow.com/q/25966551
has body: If you want to prompt the user for something from the terminal, the easiest way is probably to use java.io.Console, in particular one of its readLine() methods: import java.io.Console; ... Console console = System.console(); if (console == null) { throw new IllegalStateException("No console to read input from!"); } String fileName = console.readLine("What would you like to name your file? "); // Whatever the user inputed is now in fileName See http://docs.oracle.com/javase/7/docs/api/java/io/Console.html.
score: 0

http://stackoverflow.com/comment/40503560
type: QuestionComment
has text: it will be helpful if you post your complete Logcat too ....
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25881010

http://stackoverflow.com/comment/100509131
comment on: http://stackoverflow.com/a/37924394
type: AnswerComment
has text: I found this which cleared it up: [Java Closures Using Mutable Objects](https://miromannino.com/blog/java-8-lambdas-limitations-closures/#java-closures-using-mutable-objects). I guess the object reference itself can't change, but any of the object's members can. I still find the Java restriction pointless, but at least this is a good workaround (despite the fact that the author of that page doesn't like it).
score: 0
type: Comment

http://stackoverflow.com/q/25877515
has body: So, I am dynamically creating an image within my app by animating various Views that I display to the user in the main layout of my application. Currently I am generating my scene within a RelativeLayout, taking the image of the layout as a bitmap, then saving the bitmap to SD to be accessed by the appwidget via uri. This is all working great, but... in an attmept to create rounded corners for the appwidget image, i've tried using these two snippets that I found here. My Problem: is that this method generates a drawable (whose rounded corners look perfect if displayed as a drawable) but I need to export these transparent corners as an image file. The drawToBitmap method in CustomView below, does generate a bitmap image, but the corners are full and square. /** * shows a bitmap as if it had rounded corners. based on : * http://rahulswackyworld.blogspot.co.il/2013/04/android-drawables-with-rounded_7.html */ public class RoundedCornersDrawable extends BitmapDrawable { private final BitmapShader bitmapShader; private final Paint p; private final RectF rect; private final float borderRadius; public RoundedCornersDrawable(final Resources resources, final Bitmap bitmap, final float borderRadius) { super(resources, bitmap); bitmapShader = new BitmapShader(getBitmap(), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); final Bitmap b = getBitmap(); p = getPaint(); p.setAntiAlias(true); p.setShader(bitmapShader); final int w = b.getWidth(), h = b.getHeight(); rect = new RectF(0, 0, w, h); this.borderRadius = borderRadius &lt; 0 ? 0.15f * Math.min(w, h) : borderRadius; } @Override public void draw(final Canvas canvas) { canvas.drawRoundRect(rect, borderRadius, borderRadius, p); } } and public class CustomView extends ImageView { private FrameLayout mMainContainer; private boolean mIsDirty=false; // TODO for each change of views/content, set mIsDirty to true and call invalidate @Override protected void onDraw(final Canvas canvas) { if (mIsDirty) { mIsDirty = false; drawContent(); r…
linked to: http://stackoverflow.com/q/16161448
possible better answer: http://stackoverflow.com/a/25885762
linked to: http://stackoverflow.com/q/22741202
linked to: http://stackoverflow.com/q/25944639
has answer: http://stackoverflow.com/a/25955135
tagged with: android-appwidget
tagged with: android
tagged with: bitmap
tagged with: http://stackoverflow.com/tag/png
type: AnsweredQuestion
tagged with: java
has title: AppWidget image with rounded corners
type: Question
has comment: http://stackoverflow.com/comment/95083179
has answer: http://stackoverflow.com/a/25885762
accepted answer: http://stackoverflow.com/a/25955135
score: 0
answer count: 2

http://stackoverflow.com/comment/40725856
comment on: http://stackoverflow.com/q/25959906
has text: I don't know any options, I need to know which options are available. Is you who have to tell me how to do! ;)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40576828
type: QuestionComment
comment on: http://stackoverflow.com/q/25894821
has text: http://stackoverflow.com/a/11955737/337621 this seems to be your problem
score: 0
type: Comment

http://stackoverflow.com/q/25995205
score: 2
tagged with: modelmapper
type: AnsweredQuestion
downvote count: 11
tagged with: java
type: Question
answer count: 2
has title: ModelMapper: how to map java.util.Map to POJO?
has body: How can I map a java.util.Map to a POJO? The following test gives me a configuration error. It seems a similar issue was opened but it was not resolved https://github.com/jhalterman/modelmapper/issues/116. Test: package org.me.modelmapper; import java.util.HashMap; import org.modelmapper.ModelMapper; import org.modelmapper.PropertyMap; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class MapperTest { private ModelMapper modelMapper; public MapperTest() { } public static class Foo { public String a; public String b; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } } @BeforeMethod public void setUpMethod() throws Exception { modelMapper = new ModelMapper(); modelMapper.getConfiguration() .setFieldMatchingEnabled(true); } @Test public void shouldMapHashMapToFoo() { HashMap&lt;String, String&gt; map = new HashMap&lt;&gt;(); map.put("a", "aaaa"); map.put("b", "bbbb"); PropertyMap&lt;HashMap&lt;String, String&gt;, Foo&gt; fooMap = new PropertyMap&lt;HashMap&lt;String, String&gt;, MapperTest.Foo&gt;() { @Override protected void configure() { map(source.get("a"), destination.a); map(source.get("b"), destination.b); } }; modelMapper.addMappings(fooMap); Foo foo = modelMapper.map(map, Foo.class); Assert.assertEquals(foo.getA(), map.get("a")); Assert.assertEquals(foo.getB(), map.get("b")); } } Error: Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@60acc399 Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.326 sec &lt;&lt;&lt; FAILURE! shouldMapHashMapToFoo(org.me.modelmapper.MapperTest) Time elapsed: 0.186 sec &lt;&lt;&lt; FAILURE! org.modelmapper.ConfigurationException: ModelMapper configuration errors: 1) Invalid source method java.util.HashMap.get(). Ensure that method has zero parameters and does not return void. 2) Invalid source method java.util.Has…
possible better answer: http://stackoverflow.com/a/55361934
has answer: http://stackoverflow.com/a/26055509
has answer: http://stackoverflow.com/a/55361934
has comment: http://stackoverflow.com/comment/40708395
favorite count: 0
has comment: http://stackoverflow.com/comment/40708664
has comment: http://stackoverflow.com/comment/40708590
accepted answer: http://stackoverflow.com/a/26055509
upvote count: 13

http://stackoverflow.com/q/26024326
has title: working (compiling and running) on project with java 6 when java 8 installed
has comment: http://stackoverflow.com/comment/40762221
tagged with: java
score: -1
tagged with: eclipse
upvote count: 0
has comment: http://stackoverflow.com/comment/40762278
answer count: 1
has body: I have java8 JDK installed on my computer. I work on my all projects with java 8, but now I need to develop another project, but with java 6! I'm using eclipse and when i do right click on a project, select properties -> java compiler -> compiler compliance level, there is possibility to switch between versions from 1.3 to 1.8. It looks like it was enough to develop project with whatever java version (lower or equal then I have installed), but I'm rather asking because I was searching and found many discussions on this topic, and all of them were difficult and I still have java 8 version on my classpath. Thanks.
favorite count: 0
has comment: http://stackoverflow.com/comment/40762418
has comment: http://stackoverflow.com/comment/40762920
has comment: http://stackoverflow.com/comment/40762308
has comment: http://stackoverflow.com/comment/40762655
has comment: http://stackoverflow.com/comment/40762316
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40762625
has answer: http://stackoverflow.com/a/26024881
downvote count: 1
has comment: http://stackoverflow.com/comment/40762256
type: Question

http://stackoverflow.com/q/25949145
score: 10
has answer: http://stackoverflow.com/a/25949789
answer count: 3
downvote count: 0
has body: How does JVM make sure threads acquire a lock after entering synchronized method of an object?
has answer: http://stackoverflow.com/a/25949212
tagged with: jvm
favorite count: 0
tagged with: synchronization
has title: Synchronized keyword internal implementation
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/53506540
tagged with: java
upvote count: 10
type: Question

http://stackoverflow.com/a/37196796
has comment: http://stackoverflow.com/comment/108846641
score: 10
downvote count: 0
has body: I also had faced same issue. For contact table i marked only firstname column as @Id. And table had multiple rows with same firstname due to which first row record with same firstname was getting duplicated in entire result set. To resolve this issue i made IdClass with first name and last name as id attribute and imported it as id class in my bean. Since firstname and lastname together form unique combination, it resolved my issue. Idclass as below public class ContactKey implements Serializable{ protected String firstName; protected String lastName; public boolean equals(final Object inObject) { if (null != inObject) { if (inObject.getClass().equals(this.getClass())) { CqCamAdminKey siteKey = (CqCamAdminKey) inObject; return (null != this.getFirstName() &amp;&amp; this.getFirstName().equals(siteKey.getFirstName()) &amp;&amp; null != this.getLastName() &amp;&amp; this.getLastName().equals(siteKey.getLastName())); } } return super.equals(inObject); } public int hashCode() { if (this.getFirstName() != null &amp;&amp; this.getLastName() != null) { return this.getFirstName().hashCode() + this.getLastName().hashCode(); } return super.hashCode(); } } bean class as below @IdClass(contactKey.class) public abstract class CqCamAdminDataBean implements DataModelConstants{ private static final long serialVersionUID = 7686374823515894764L; @Id @JsonIgnore @XmlTransient @Column(name = FIRST_NAME) protected String firstName; @Id @JsonIgnore @Column(name = LAST_NAME) protected String lastName; }
type: Answer
answers question: http://stackoverflow.com/q/26021050
upvote count: 10

http://stackoverflow.com/q/25919843
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25920231
has answer: http://stackoverflow.com/a/25919924
type: UnansweredQuestion
tagged with: android
has title: If statement not working correctly
tagged with: java
type: Question
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40574361
has comment: http://stackoverflow.com/comment/40574206
has answer: http://stackoverflow.com/a/25920093
has body: I'm making an App for Android that would allow you to see if a date is available. If the date isn't in the arraylist it will get added in, if the date is in the arraylist then the user will receive a message "please try again". The If statement wont work and never gives the "please try again" message regardless if the date entered is already in the arraylist. I have confirmed that the data is being written into the arraylist. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second_activity); final ArrayList&lt;String&gt; DateArray = new ArrayList&lt;String&gt;(); DateArray.add("0101"); //test code addListenerRadioGroup(); //not important mNextButton = (Button)findViewById(R.id.NextButton); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mEditText2 =(EditText)findViewById(R.id.editText2); if (DateArray.contains(mEditText2)) { //looks for edit text info Toast.makeText(getApplicationContext(), //This should pop up if user "please try again", Toast.LENGTH_SHORT).show(); //enters "0101" } else { DateArray.add(mEditText2.getText().toString()); } } }); }
tagged with: arraylist
score: 0
answer count: 3

http://stackoverflow.com/a/25901459
type: Answer
downvote count: 1
has body: You can do it by changing this: double myScore=Double.parseDouble(keyboard.next()); To this: String code = keyboard.next(); if(code == "exit") //if user types 'exit' then exit the while loop break; double myScore = Double.parseDouble(code);
score: -1
answers question: http://stackoverflow.com/q/25901375
upvote count: 0

http://stackoverflow.com/comment/40760648
type: QuestionComment
has text: I tried this %windir%\system and that folder is empty...
comment on: http://stackoverflow.com/q/26023490
score: 0
type: Comment

http://stackoverflow.com/q/25901198
type: Question
upvote count: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40539790
favorite count: 0
tagged with: int
has body: I need java to keep the results their true values, here is my code: ` Scanner scan = new Scanner(System.in); int test1; int test2; int quiz1; int quiz2; int quiz3; double homework; System.out.println("Please enter your test grades."); test1 = scan.nextInt(); test2 = scan.nextInt(); System.out.println("Please enter you quiz grades."); quiz1 = scan.nextInt(); quiz2 = scan.nextInt(); quiz3 = scan.nextInt(); System.out.println("Please enter your homework average."); homework = scan.nextDouble(); double quizaverage = (quiz1 + quiz2 + quiz3)/3; double testaverage = (test1 + test2)/2; System.out.println("Test Average " + (testaverage) + ""); System.out.println("quiz Average " + (quizaverage) + ""); double finalgrade = (testaverage) * 0.5 + (quizaverage)* 0.3 + (homework) * 0.2; System.out.println("Final Grade " + (finalgrade) + "");` The values I am inputting: *test 1=89, test 2=86, quiz 1=84, quiz 2=84, quiz 3=83, homework=90.12* Everything works but the problem is I need the test average variable and quiz average variable to not round down, because I am getting 87.0 for my test average and 83.0 for my quiz average when I run the program, those values then affect the final grade variable because I need to get 86.874 for the final grade, not 86.424. so I their true values of 87.5 for the test average and 83.66666666666667 for the quiz average to get the true final grade. Basically I need to know how to prevent java from rounding down (I think). I hope I did not make it sound complicated, all help is appreciated.
has answer: http://stackoverflow.com/a/25901236
accepted answer: http://stackoverflow.com/a/25901236
tagged with: java.util.scanner
tagged with: double
score: 2
type: AnsweredQuestion
has title: Need java double to not round down
tagged with: math
tagged with: java
linked to: http://stackoverflow.com/q/3553047

http://stackoverflow.com/comment/40620358
type: Comment
comment on: http://stackoverflow.com/q/25945902
score: 0
has text: If building a proxy application is an option as you mentioned in #4, then I would go that route and serve it from an isolated server/cluster that is available to the DMZ (either directly or via proxy) to avoid the possibility of accidentally exposing the intranet application.
type: QuestionComment

http://stackoverflow.com/q/25927207
has comment: http://stackoverflow.com/comment/40587206
has title: Is there any difference between object of ordinary class and object of generic type class?
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/40587207
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25927766
type: UnansweredQuestion
has body: Is there any difference between object of class MyClass and object of class MyClass&lt;String&gt; apart from the fact that one is of 'Raw Type' and other is of 'Generic type'.If we call 'getClass()' method on object of Raw type 'MyClass' and on object of Generic Type MyClass&lt;String&gt; both will return same answer. So what exactly the difference is ?. Thanks class MyClass { } class MyClass&lt;String&gt; { }
tagged with: java
score: -4
type: Question
has comment: http://stackoverflow.com/comment/40587211

http://stackoverflow.com/comment/40649943
type: QuestionComment
comment on: http://stackoverflow.com/q/25962804
score: 0
has text: @Smutje yes. it is located on line 18
type: Comment

http://stackoverflow.com/comment/40700815
type: QuestionComment
has text: When you insert into a table you need to be sure that you satisfy all constraints (including foreign key). Please clarify your problem, as it stands it is hard to tell exactly what you are having problems with, and therefor it is not really answerable.
score: 0
comment on: http://stackoverflow.com/q/25990571
type: Comment

http://stackoverflow.com/comment/40658794
comment on: http://stackoverflow.com/q/25963157
type: Comment
type: QuestionComment
has text: for best results, use `<T extends Comparable<? super T>>`
score: 0

http://stackoverflow.com/a/26015917
answers question: http://stackoverflow.com/q/26015827
score: 0
type: Answer
has body: You dont't close the if about "if" and "goto" before you open the one about ":", so ":" will only be reported if an "if" or "goto" is present.

http://stackoverflow.com/a/25883398
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25883339
answers question: http://stackoverflow.com/q/25883339
type: Answer
has body: In general, when extending a genericized class, need to specify the generic type in your extended class' signature as well: public class CSVReader&lt;T&gt; extends DataReader&lt;T&gt; { ... @Override public T readNext() throws IOException { ... } } In your case, where you want a List, you can get more specific and do this: public class CSVReader&lt;T extends List&lt;E&gt;&gt; extends DataReader&lt;T&gt; { ... @Override public List&lt;E&gt; readNext() throws IOException { ... } } I took a look at ICsvListReader and the class is not genericized, which will make your implementation of readNext() somewhat problematic. It appears that read always returns List&lt;String&gt;. So if someone instantiates an instance of CSVReader that is CSVReader&lt;List&lt;Integer&gt;&gt; then you're in trouble (heap pollution) because readNext is returning List&lt;String&gt;, and then you'll end up with a ClassCastException when you try to access elements of the list. The compiler may warn you (I think Java 7 does) but the code will actually compile because generic types are lost at runtime due to type erasure. Hence in this case I think it's better to be really explicit and do this instead: public class CSVReader extends DataReader&lt;List&lt;String&gt;&gt; { private final ICsvListReader reader; ... @Override public List&lt;String&gt; readNext() throws IOException { return reader.read(); //read already throws an IOException so you're good to go } }
upvote count: 1

http://stackoverflow.com/q/25937927
answer count: 1
has title: Java garbage collection 5
has answer: http://stackoverflow.com/a/25938013
favorite count: 0
upvote count: 3
downvote count: 0
tagged with: garbage-collection
type: Question
has comment: http://stackoverflow.com/comment/40607078
type: AnsweredQuestion
score: 3
has body: This piece of code is from a book. The question is, how many objects are created how many objects are eligible for gc when the line // do stuff is reached. The answers, according to the book, are 5 and 2. Here is the code: class Dozens { int[] dz = {1,2,3,4,5,6,7,8,9,10,11,12}; } public class Eggs{ public static void main(String[] args){ Dozens[] da = new Dozens[3]; da[0] = new Dozens(); Dozens d = new Dozens(); da[1] = d; d = null; da[1] = null; // do stuff } } In answer to the first question, do you also count the int[] dz object as an additional object each time you instantiate Dozens? Similarly, when you reach // do stuff, in calculating the number of objects eligible for gc, for each Dozens object, do you also count the int[] dz object contained therein? I did not count the int[] dz objects, and arrived at the answers 5 and 3. Can someone explain what I might be doing wrong? Thanks.
tagged with: java
accepted answer: http://stackoverflow.com/a/25938013

http://stackoverflow.com/q/25964965
has comment: http://stackoverflow.com/comment/40653845
has comment: http://stackoverflow.com/comment/40653872
has comment: http://stackoverflow.com/comment/40653833
tagged with: java
possible better answer: http://stackoverflow.com/a/25964987
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40653841
linked to: http://stackoverflow.com/q/7048423
linked to: http://stackoverflow.com/q/8395916
has comment: http://stackoverflow.com/comment/40653861
has body: I compiled my java program using "javac LabOne.java" and it complied suscessfully. Now in that folder there is a LabOne.java and LabOne.class as expected. But when i try to run the program by using "java LabOne" i get an error saying "Error: Could not find or load main class LabOne". Please can someone assist me. Code : /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package labone; import java.util.Scanner; /** * * */ public class LabOne { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner userInput = new Scanner(System.in); System.out.println("Welcome To The String Editor!"); System.out.println(""); System.out.println("Please choose what you would like to do by choosing one of the options below:"); System.out.println("1. Input String"); System.out.println("2. Print Current String"); System.out.println(""); int userOption = userInput.nextInt(); String stringInput = new String (); switch (userOption) { case 1: stringInput = userInput.nextLine(); System.out.println(stringInput); break; case 2: System.out.println(stringInput); break; default: ; break; } // TODO code application logic here } }
score: -1
has comment: http://stackoverflow.com/comment/40653960
type: Question
has comment: http://stackoverflow.com/comment/40653999
answer count: 3
accepted answer: http://stackoverflow.com/a/25965087
upvote count: 0
has title: Java - Running my java program error
has answer: http://stackoverflow.com/a/25964987
favorite count: 0
has answer: http://stackoverflow.com/a/25965087
has answer: http://stackoverflow.com/a/25965010

http://stackoverflow.com/comment/40716689
score: 0
type: AnswerComment
has text: You are welcome :) Yes, I suspected your code was just an example but I like pointing out that kind of details mostly to help future visitors.@iXô
type: Comment
comment on: http://stackoverflow.com/a/25973505

http://stackoverflow.com/comment/40643974
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25955115
type: Comment
has text: What are you expecting that layout to be? The main layout when you open the app?

http://stackoverflow.com/comment/40663795
comment on: http://stackoverflow.com/q/25970318
type: Comment
has text: @ZerO can you give me example to which resources?
score: 0
type: QuestionComment

http://stackoverflow.com/a/25898684
upvote count: 2
type: Answer
has body: You might find the following fact useful: the number of strings of n pairs of balanced parentheses is given by the nth Catalan number and its exact value is (2n)! / (n! (n + 1)!) You should be able to directly compute this value mod 997 by using the hint about how products and sums distribute over modulus. Hope this helps!
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40536165
answers question: http://stackoverflow.com/q/25898503

http://stackoverflow.com/q/25931449
score: 5
downvote count: 0
favorite count: 0
tagged with: fft
tagged with: frequency
linked to: http://stackoverflow.com/q/5774104
type: UnansweredQuestion
tagged with: android
answer count: 0
has comment: http://stackoverflow.com/comment/104162229
type: Question
has title: How To Detect Sound Frequency on Android?
upvote count: 5
tagged with: java
tagged with: frequency-analysis
has body: First of all, I am pretty new to Android. I was doing Arduino before this. And my first objective that I want to achieve is to be able to detect a specific sound frequency or pattern. So, before I can even detect a specific sound frequency, I have to be able to at least see all frequencies around. Before anyone can mark this as a duplicate or a question without trying. I have tried my best to the best of what I can try. I can barely understand how does FFT works or zero crossing works. But I've read that zero crossing is not so accurate. So, I am using FFT. I was following this post here pretty closely, but I have no idea how does the the entire working codes looks like. Android audio FFT to retrieve specific frequency magnitude using audiorecord So, I tried to combine both the problem and solution as shown in the below codes. I can barely understand what's going on. FrequencyThread.java package com.example.syahmul.backgroundapp; /** * Record and detect frequency using FFT * Ref: https://stackoverflow.com/questions/5774104/android-audio-fft-to-retrieve-specific-frequency- * magnitude-using-audiorecord */ //Audio Library import android.media.AudioRecord; import android.media.MediaRecorder.AudioSource; import android.media.AudioFormat; import android.provider.MediaStore; import android.util.Log; public class FrequencyThread extends Thread{ protected static final String TAG = "FrequencyThread"; int channel_config = AudioFormat.CHANNEL_IN_MONO; int format = AudioFormat.ENCODING_PCM_16BIT; public int sampleSize = 8000; //public int bufferSize = AudioRecord.getMinBufferSize(sampleSize, channel_config, format); //640 public int bufferSize = 1024; //hardcode this so that can get power of 2 AudioRecord audioInput = new AudioRecord(AudioSource.MIC, sampleSize, channel_config, format, bufferSize); private double ComputeFrequency(int arrayIndex) { //return ((1.0 * sampleRate) / (1.0 * fftOutWindowSize)) * arrayIndex; return ((1.0 * sampleSize) / (1.0 * bufferSize)) * arrayIndex…

http://stackoverflow.com/q/25979522
has answer: http://stackoverflow.com/a/25979603
type: Question
tagged with: monitoring
score: 0
tagged with: metrics
has title: Is there a java monitoring/alerts framework for a cluster?
answer count: 1
accepted answer: http://stackoverflow.com/a/25979603
has body: I have a cluster of servers. Common tasks I manualy code are: collect various stats (failures, success, times) with metrics library. aggregate those combine cross cluster. depending on conditions check out the aggregated stats cross cluster and based on that send alerts. (instead of having each server send an alert, increase global metrics which are polled then to graphite). if a specific node send an alert its first accumulated and base on alerts from other nodes (again cross cluster scenario) then I woudl decide which alert to send (so if i have 100 servers not each of them send a separate alert but single one). I looked into a few frameworks but none of them that I see achieve this: metrics, javamelody, netflix servo, netflix zuul but none of them support for example my cross cluster scenario where i want to aggregate stats over time and only if certain conditions apply send an alert (as a method to avoid duplicating alerts cross servers). Do I need to build my own framework for that? or is there already something existing? (and in case my use case sounded specific so that I should just code it, i have many more such similar use cases which makes me think why isn't there such a framework, before i start coding something i don't want to find i just duplicated some other framework).
type: AnsweredQuestion
tagged with: snmp
tagged with: java

http://stackoverflow.com/comment/40499099
has text: @user3002486: You've posted way too much code. (I realize that user1071777 said to "post your full classes", but what you really need to post is a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25878210

http://stackoverflow.com/comment/40625668
comment on: http://stackoverflow.com/q/25933481
score: 0
type: Comment
type: QuestionComment
has text: @lexicore - you are right, it is due to the different JAXB versions bundled with JDKs. The actual culprit is my `XmlJavaTypeAdapter` . I have created a new question with details on this - http://stackoverflow.com/questions/25942081/xmladapter-not-working-correctly-with-newer-version-of-jaxb

http://stackoverflow.com/comment/40937163
comment on: http://stackoverflow.com/q/25958838
score: 0
type: Comment
type: QuestionComment
has text: You can check [this](http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_passwd.html) and [this](http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.superuser.html) link for P4 Ticket-based authentication. Once you generate the ticket on the given machine, you simply have to paste the ticket id in the place where you specify the password.

design-patterns
tags question: http://stackoverflow.com/q/25945504
tags question: http://stackoverflow.com/q/26019794
tags question: http://stackoverflow.com/q/25989048
tags question: http://stackoverflow.com/q/25954274
tag name: design-patterns
tags question: http://stackoverflow.com/q/26020284
tags question: http://stackoverflow.com/q/25941260
tags question: http://stackoverflow.com/q/25994842
tags question: http://stackoverflow.com/q/25960885
tags question: http://stackoverflow.com/q/25937946
tags question: http://stackoverflow.com/q/26021140
tags question: http://stackoverflow.com/q/25939699
type: Tag
tags question: http://stackoverflow.com/q/25967475
tags question: http://stackoverflow.com/q/25963553
tags question: http://stackoverflow.com/q/26026225
tags question: http://stackoverflow.com/q/25873571
tags question: http://stackoverflow.com/q/25949652
tags question: http://stackoverflow.com/q/25972299
tags question: http://stackoverflow.com/q/25912679

http://stackoverflow.com/q/25989334
has body: I have a text file that consist of string. What i want to do is to separate the string with "[ham]" and the string with "[spam]" inside to the different array, how can i do that, i think about to use regex to recognize the pattern (ham &amp; spam), but i have no idea to start. please help me. String in text file: good [ham] very good [ham] bad [spam] very bad [spam] very bad, very bad [spam] and i want the output to be like this: Ham array: good very good Spam array: bad very bad very bad, very bad Help me please.
has answer: http://stackoverflow.com/a/25989404
has comment: http://stackoverflow.com/comment/40698514
has comment: http://stackoverflow.com/comment/40698322
type: Question
accepted answer: http://stackoverflow.com/a/25989404
has comment: http://stackoverflow.com/comment/40698463
tagged with: java
has title: How to separate string in text file into different array (java)
has answer: http://stackoverflow.com/a/25990035
answer count: 2
tagged with: arrays
tagged with: string
possible better answer: http://stackoverflow.com/a/25990035
score: 0
tagged with: regex
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5868369

http://stackoverflow.com/q/26016569
upvote count: 4
has comment: http://stackoverflow.com/comment/40785400
accepted answer: http://stackoverflow.com/a/26037241
answer count: 1
downvote count: 0
has body: I try to compare two snapshots from one stream programamtically in plain java... Step 1: getting my stream (working) IWorkspaceConnection stream = null; List&lt;IWorkspaceConnection&gt; list = RtcAdapter.inst().getStreams(); //my library for (IWorkspaceConnection connection: list){ if (connection.getName().equalsIgnoreCase("myStreamName") ){ stream = connection; break; } }//now we have found our stream Step 2: getting base lines (working) List&lt;IBaselineSet&gt; snapShotList = RtcAdapter.inst().getSnapShotsFromStream(stream); IBaselineSet snapShot0 = null; IBaselineSet snapShot1 = null; for (IBaselineSet snapShot: snapShotList){ if (snapShot.getName().equalsIgnoreCase("mySnapShotName0") ){ snapShot0 = snapShot; } if (snapShot.getName().equalsIgnoreCase("mySnapShotName1") ){ snapShot1 = snapShot; } }//now we've got also my two snapShots Step 3: comparing each other (not working) IUpdateReport report = workspaceManager.compareBaselineSetConfigurations( snapShot0, snapShot0, stream.getComponents(), monitor); my report is empty... --annoying-- report=com.ibm.team.scm.common.internal.dto.impl.UpdateReportImpl@1de5a20 (stateBefore: &lt;unset&gt;, stateAfter: &lt;unset&gt;) i also tried to get the ChangeHistorySyncReport... IChangeHistorySyncReport report = workspaceManager.compareBaselineSets( snapShot0, snapShot1, componentList(stream), monitor); also the report is empty... so how do I create a proper report? or how can I compare two baselines? (what am I doing wrong? report.getAffectedComponents() returns an empty array, as well does report.getModifiedComponents() UPDATE as far a s i know now i must inspect the ChangeHistorySyncReport... and when i print my report it says: com.ibm.team.scm.common.internal.dto.impl.ChangeHistorySyncReportImpl@150f091 (localTime: &lt;unset&gt;, remoteTime: &lt;unset&gt;, compareFlags: &lt;unset&gt;) this makes my question deeper - how can i set better CompareFlags?
favorite count: 0
has title: comparing two baselines in RTC/Jazz with plain java
has comment: http://stackoverflow.com/comment/40784817
tagged with: rtc
type: AnsweredQuestion
tagged with: jazz
has answer: http://stackoverflow.com/a/26037241
type: Question
tagged with: java
score: 4

http://stackoverflow.com/q/25997870
tagged with: checkbox
has comment: http://stackoverflow.com/comment/40714183
has comment: http://stackoverflow.com/comment/40713985
has comment: http://stackoverflow.com/comment/40714833
tagged with: java
has comment: http://stackoverflow.com/comment/40715001
has comment: http://stackoverflow.com/comment/40715181
type: Question
has comment: http://stackoverflow.com/comment/40715302
has comment: http://stackoverflow.com/comment/40714368
has comment: http://stackoverflow.com/comment/40714488
score: 0
has comment: http://stackoverflow.com/comment/40714752
answer count: 1
has comment: http://stackoverflow.com/comment/40714318
has title: checkbox determining which formula runs
has answer: http://stackoverflow.com/a/25998964
type: UnansweredQuestion
tagged with: android
has body: I'm trying to let the checking of certain checkboxs determine which formula to run. The class's code is as followed. The code in questions is the commented out code. package com.mikitz.rogsimple; import org.apache.commons.lang3.math.NumberUtils; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; public class SaACharisma extends Activity { EditText charisma, persuasion, elicitation, animalhandling; TextView charismafpvalue, persuasionfpvalue, elicitationfpvalue, animalhandlingfpvalue; TextView fpr; CheckBox timid, sanguine; SharedPreferences pref; String getcharisma, getpersuasion, getelicitation, getanimalhandling; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.saa_charisma); pref = getSharedPreferences("Character1", Context.MODE_PRIVATE); fpr = (TextView) findViewById(R.id.fpr); pref.getBoolean("timid", false); pref.getBoolean("sanguine", false); charismafpvalue = (TextView) findViewById(R.id.charismafpvalue); persuasionfpvalue = (TextView) findViewById(R.id.persuasionfpvalue); elicitationfpvalue = (TextView) findViewById(R.id.elicitationfpvalue); animalhandlingfpvalue = (TextView) findViewById(R.id.animalhandlingfpvalue); charisma = (EditText) findViewById(R.id.charisma); persuasion = (EditText) findViewById(R.id.persuasion); elicitation = (EditText) findViewById(R.id.elicitation); animalhandling = (EditText) findViewById(R.id.animalhandling); getcharisma = pref.getString("charisma", ""); getpersuasion = pref.getString("persuasion", ""); getelicitation = pref.getString("elicitation", ""); getanimalhandling = pref.getString("animalhandling", ""); charisma.setText(getcharisma); persuasion.setText(getpersuasion); elicitation.setT…

http://stackoverflow.com/comment/40610145
comment on: http://stackoverflow.com/q/25938601
has text: Your problem is that you asked for an array when it's an object. Go to json.org and learn the JSON syntax.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/a/25891704
type: Answer
has body: I think using the Java scriptlet inside javascript is not good practice, instead you can use the $(InformeAmenazasAGR) to set the request attribute value to a hidden element and put the hidden element anywhere inside your html &lt;body&gt; like this, &lt;input type="hidden" id="jsonData" value="${InformeAmenazasAGR}"&gt; then, get the hidden element value like, var DatosAmenazas = new String($('#jsonData').val()); if you need the request attribute InformeAmenazasAGR to be converted into json data then instead of above you can change your above line as, var DatosAmenazas = JSON.parse($('#jsonData').val()); FYI: Java scriptlets run on server side while javascript on client side
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25891618
has comment: http://stackoverflow.com/comment/40522527
accepted answer of: http://stackoverflow.com/q/25891618
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40544419

http://stackoverflow.com/a/25881714
has comment: http://stackoverflow.com/comment/40504639
has comment: http://stackoverflow.com/comment/40504789
has comment: http://stackoverflow.com/comment/40504660
answers question: http://stackoverflow.com/q/25881659
score: 0
has comment: http://stackoverflow.com/comment/40504694
type: Answer
has body: If I understand your issue you have to use The java.io.BufferedWriter.newLine(): Writes a line separator. The line separator string is defined by the system property line.separator, and is not necessarily a single newline ('\n') character.. if you want to each content of your data file be written in each line, you must call newLine() source: http://docs.oracle.com/javase/7/docs/api/java/io/BufferedWriter.html#newLine() I found this from a post newLine is environment agnostic \r isn't. So newLine will give you \r\n on windows but \n on another environment source: difference between newLine() and carriage return("\r") Difference between \r and \n The difference is not Java-specific, but platform specific. Historically UNIX-like OSes have used \n as newline character, some other deprecated OSes have used \r and Windows OSes have employed \r\n. Source: What are the differences between char literals '\n' and '\r' in Java?
has comment: http://stackoverflow.com/comment/40504650

http://stackoverflow.com/a/27157976
type: Answer
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25883292
has body: The problem was in java config. I fixed it by changing the method signature, I added the entitymanager as a method parameter instead of a method call. @Bean public PlatformTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) throws SQLException { JpaTransactionManager txManager = new JpaTransactionManager(); txManager.setEntityManagerFactory(entityManagerFactory); return txManager; }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25883292
score: 1

http://stackoverflow.com/a/26027966
has body: I guess you are using the primitive type int but here, an array of Objects is expected so you must use the wrapper Integer : print(new Integer[] { 1,2,3,4 });
type: Answer
answers question: http://stackoverflow.com/q/26027946
score: 0

http://stackoverflow.com/q/25970180
type: Question
linked to: http://stackoverflow.com/q/19856324
tagged with: java
has title: BigInteger to key ... Result is Key is too long for wrapping
score: 0
has comment: http://stackoverflow.com/comment/40664576
answer count: 1
has body: I'm trying to convert a BigInteger privateKey to KEY, I found this piece of code and made some modifications like this: KeyFactory factory = KeyFactory.getInstance("RSA"); RSAPrivateKeySpec spec; spec = new RSAPrivateKeySpec(modulus,privateKey); RSAPrivateKey priPEM = (RSAPrivateKey) factory.generatePrivate(spec); Cipher enc = Cipher.getInstance("RSA"); enc.init(Cipher.WRAP_MODE, priPEM); byte[] encryptedKey = enc.wrap(priPEM); However, the result is: Key is too long for wrapping Exception in thread "main" java.security.InvalidKeyException: Key is too long for wrapping I am using keysize (2048), I've tried 1024 and 512 but still the same output error. Any idea on how can I get rid of this error?
has comment: http://stackoverflow.com/comment/40666026
tagged with: key
has answer: http://stackoverflow.com/a/56544769
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40667164
tagged with: biginteger

http://stackoverflow.com/comment/40640937
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25954233
has text: What do you mean by “working”? Just add print statements inside the `if`s and see when they are entered (they are, I did it, mocking your external command). And add a print for `line` in each iteration of the loop to see what you are parsing as I have suggested before. BTW: We are kindly reminded that this discussion is inappropriate for a comments section. Should I click the “move this discussion to chat” link? I have never tried this before so it might kill us.

http://stackoverflow.com/q/25921723
upvote count: 1
tagged with: log4j2
tagged with: logging
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25926877
tagged with: log4j
favorite count: 0
has title: Logging will not display calling Methods or Line Numbers
tagged with: maven
has body: I've set up logging for a project I've developed, but I cannot seem to get line numbers and calling methods to show up in the logs. I have a Maven project, and the maven-compiler-plugin is configured to include debug information in the compiled classes. It'd be very helpful for me to have this information in the logs, and for me to understand why that's not happening right now. Can someone help to explain to me what's going on here and how I can get method names and line numbers in my logs? Here's my pom: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 <cxf.version>3.0.1</cxf.version> <log4j.version>2.0.2</log4j.version> <wsdl.dir>generated\wsdl</wsdl.dir> com.company webservices 0.0.1-SNAPSHOT war Nuance-to-Edify Web Services This project will handle communication between servers. n2e-ws maven-war-plugin 2.4 ${project.build.sourceDirectory} WEB-INF/classes ${project.build.sourceDirectory}\..\resources WEB-INF/classes ${project.build.directory}\${wsdl.dir} WEB-INF/wsdl org.apache.cxf cxf-java2ws-plugin ${cxf.version} org.apache.cxf cxf-rt-frontend-jaxws ${cxf.version} generate-account-service-wsdl prepare-package com.company.ws.data.services.interfaces.AccountServiceEndpointInterface ${project.build.directory}\${wsdl.dir}\AccountService.wsdl REPLACE_WITH_ACTUAL_URL true true java2ws generate-logging-service-wsdl prepare-package com.company.ws.data.services.interfaces.LoggingServiceEndpointInterface ${project.build.directory}\${wsdl.dir}\LoggingService.wsdl REPLACE_WITH_ACTUAL_URL true true java2ws generate-search-service-wsdl prepare-package com.company.ws.data.services.interfaces.SearchServiceEndpointInterface ${project.build.directory}\${wsdl.dir}\SearchService.wsdl REPLACE_WITH_ACTUAL_URL true true java2ws generate-validation-service-wsdl prepare-package com.company.ws.data.services.interfaces.ValidationServiceEndpointInterface ${project.build.directory}\${wsdl.dir}\ValidationService.wsdl REPLACE_WITH_ACTUAL_URL true true java2ws org.apache.tomcat.maven tomcat7-mave…
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25926877

http://stackoverflow.com/a/26065466
upvote count: 1
type: Answer
has body: You might want to check out this implementation of a mongodb token store: https://github.com/iainporter/oauth2-provider/blob/master/src/main/java/com/porterhead/oauth2/mongodb/OAuth2RepositoryTokenStore.java The accompanying blog post might be helpful too: http://porterhead.blogspot.com/2014/05/securing-rest-services-with-spring.html
downvote count: 0
answers question: http://stackoverflow.com/q/26027511
score: 1
accepted answer of: http://stackoverflow.com/q/26027511
type: AcceptedAnswer

http://stackoverflow.com/q/26017043
type: Question
tagged with: try-catch
possible better answer: http://stackoverflow.com/a/26017162
has body: Lets say I have following class: public class RectangularPrism{ public Integer width; public Integer height; public Integer depth; //setters and getters } I use it for calculate sum of volume of all prisms. I have two methods to calculate this. Which one is better? This one use conditional operator. public Integer volumeSum(List&lt;RectangularPrism&gt; prismList){ Integer sum = 0; for(RectangularPrism prism: prismList){ Integer width = prism.getWidth() == null ? 0 : prism.getWidth(); Integer height = prism.getHeight() == null ? 0 : prism.getHeight(); Integer depth = prism.getDepth() == null ? 0 : prism.getDepth(); sum += width * height * depth; } return sum; } This one use try catch block public Integer volumeSum(List&lt;RectangularPrism&gt; prismList){ Integer sum; for(RectangularPrism prism: prismList){ try { Integer width = prism.getWidth(); Integer height = prism.getHeight(); Integer depth = prism.getDepth(); sum += width * height * depth; }catch( NullPointerException e){} } return sum; } Which one would be better If my class would have 100 or more fields which determine result? Is it fine to use try catch to handle null values?
has answer: http://stackoverflow.com/a/26038522
has title: Can try catch be used for code optimization?
has comment: http://stackoverflow.com/comment/40748521
has comment: http://stackoverflow.com/comment/40748397
tagged with: nullpointerexception
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40748660
linked to: http://stackoverflow.com/q/16784601
has comment: http://stackoverflow.com/comment/40748668
favorite count: 0
has answer: http://stackoverflow.com/a/26017078
accepted answer: http://stackoverflow.com/a/26017078
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/26017162
tagged with: java
upvote count: 1

http://stackoverflow.com/q/25973731
has answer: http://stackoverflow.com/a/54665574
has title: How to calculate logarithms in java?
tagged with: java
has answer: http://stackoverflow.com/a/25973881
has body: I'm trying to write a Java program that can take values and put them into a formula involving log 1/3. How can I calculate log 1/3 in Java?
answer count: 5
has answer: http://stackoverflow.com/a/25973773
type: UnansweredQuestion
score: 6
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25973759
has comment: http://stackoverflow.com/comment/40669423
upvote count: 7
has answer: http://stackoverflow.com/a/25973848
downvote count: 1

http://stackoverflow.com/comment/40689709
score: 0
type: Comment
type: QuestionComment
has text: I got it figured out. Thanks much for the input.
comment on: http://stackoverflow.com/q/25984140

http://stackoverflow.com/q/25941488
tagged with: java
has answer: http://stackoverflow.com/a/25945792
type: Question
tagged with: polygon
tagged with: libgdx
score: 0
has title: LIBGDX - how to make dynamic polygons?
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I am making 2D game, where I can move bones of hero. I don't want to use spritesheets. Hero's legs and arms are made by polygons, because I want to easily change it's colour. But I have problem with "dynamic parts of body" i mean knee, ankle and others joints - I must remake polygons for this parts every frame, because for example I change knee angle - so I must create new polygon for knee joint. This makes game laggy on mobile devices :/ Maybe I'm doing it wrong. How to make dynamic polygons in LIBGDX?
tagged with: dynamic

http://stackoverflow.com/a/25915808
type: Answer
has body: First of all, where do you get this l (lowercase L) value in your for loop? Shouldn't this be 1 (number one)? Furthermore, it would be even better if it is 0 (zero) so you can use it as an index for your array. Second thing, what's the point of int y = 0'? You are not using y anywhere in your program. int y = 0; for(int x = l; x &lt;= 100; x++) Change it to: for(int x = 0; x &lt; 100; x++) Since you want to have 3 separate arrays, you should have 3 separate indexes to keep track of them. Now let's see how to initialize an array to store the data. You should declare the size as a variable at the top of your class (or locally in your main()) to make it easier to change it later across your program. You can do the same with your array. Declare it inside your class or locally inside the main(). I will show you how to declare both outside of the class, but you should try it the other way too for practice. Now remember, when using arrays you have to know the size of the array in advance as soon as you create it and you cannot change that size after. This means only that many elements can fit inside the array. If you want variable size structures, check out some of the answers with ArrayLists. public class DataInsideArrays { public static DataInputStream a = new DataInputStream(System.in) public static int size = 100; // now you only change this number and everything works public static int[] productNumbers = new int[size]; public static String[] productNames = new String[size]; public static int[] productPrices = new int[size]; public static void main(String args[]) throws Exception { int prodnumIndex = 0; // index for tracking product numbers int prodnameIndex = 0; // index for tracking product names int prodpriceIndex = 0; // index for tracking product prices for(int x = 0; x &lt; size; x++) { // ... your code... // ... int prodNum = Integer.parseInt(a.readLine()); // check if we didn't reach our maximum size if(prodnumIndex &lt; productNumbers.length) { productNumbers …
score: 0
has comment: http://stackoverflow.com/comment/40566607
has comment: http://stackoverflow.com/comment/40567032
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25914142
accepted answer of: http://stackoverflow.com/q/25914142

http://stackoverflow.com/a/25921061
score: 1
has comment: http://stackoverflow.com/comment/40576742
has comment: http://stackoverflow.com/comment/40576527
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25920493
has comment: http://stackoverflow.com/comment/40577192
has body: I believe is the way you are reading the stream. You are using FileInputStream directly to read the content instead of wrapping it in the InputStreamReader By using the InputStreamReader you may determine which Charset to use. Take in consideration that the Charset defined in the InputStream must be the same you expect as InputStream doesn't detect charsets, it just reads them in that specific format. Try the following changes: InputStreamReader r = new InputStreamReader(new FileInputStream(locationFile), StandardCharsets.UTF_8); then instead of fos.read() use r.read() Finally when writing the String get the bytes in the same Charset as your Reader FileOutputStream fos = new FileOutputStream("C:/Users/me/Desktop/test"); fos.write(fullLocationString.getBytes(StandardCharsets.UTF_8)); fos.close()
type: Answer
has comment: http://stackoverflow.com/comment/40576910
has comment: http://stackoverflow.com/comment/40576558
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25920493
has comment: http://stackoverflow.com/comment/40576642

http://stackoverflow.com/q/25993095
upvote count: 1
tagged with: bitmap
has comment: http://stackoverflow.com/comment/40704887
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25993176
score: 0
answer count: 3
tagged with: networkonmainthread
has answer: http://stackoverflow.com/a/25993158
favorite count: 0
has answer: http://stackoverflow.com/a/25993188
type: UnansweredQuestion
tagged with: android
tagged with: android-imageview
has title: Network on main thread exception occured while setting bitmap array to imageview
has body: I have created a bitmap array and I am updating the elements of the array in an imageview inside listview. But it is showing network on main thread exception. Here is the code: public class InTheaters extends Activity { // the Rotten Tomatoes API key of your application! get this from their // website private static final String API_KEY = "xxxxxxxxxxxxxxxxxx"; protected AdView adView; // the number of movies you want to get in a single request to their web // server private static final int MOVIE_PAGE_LIMIT = 30; private ListView moviesList; String[] movieID; MyAdapter ma; ArrayList&lt;String&gt; movieTitles, releaseyear, castnames, rtscore, audscore; ArrayList&lt;Bitmap&gt; posterbitmap; Boolean fav = false; ProgressBar progress; TextView pleasewaittext; Button retry; JSONArray movies; Bitmap mIcon_val; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.movielistview); movieTitles = new ArrayList&lt;String&gt;(); releaseyear = new ArrayList&lt;String&gt;(); castnames = new ArrayList&lt;String&gt;(); rtscore = new ArrayList&lt;String&gt;(); audscore = new ArrayList&lt;String&gt;(); progress = (ProgressBar) findViewById(R.id.progress); pleasewaittext = (TextView) findViewById(R.id.pleasewaittext); retry = (Button) findViewById(R.id.retry); ma = new MyAdapter(); if(isNetworkAvailable()) { new RequestTask() .execute("http://api.rottentomatoes.com/api/public/v1.0/lists/movies/in_theaters.json?apikey=" + API_KEY + "&amp;page_limit=" + MOVIE_PAGE_LIMIT); } else { progress.setVisibility(View.GONE); pleasewaittext.setText("No Internet Connectivity. Please check."); retry.setVisibility(View.VISIBLE); } retry.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(isNetworkAvailable()) { progress.setVisibility(View.VISIBLE); pleasewaittext.setVisibility(View.VISIBLE); pleasewaittext.setText("Please wait.."); retry.setVisibility(View.GON…
tagged with: java

http://stackoverflow.com/q/25968684
type: Question
has answer: http://stackoverflow.com/a/25968835
has answer: http://stackoverflow.com/a/25969013
score: 4
tagged with: java
has body: I have the following scenario , let us assume 125,250,500 are rounding parameter based on which we have to do rounding. when the rounding parameter is 125 then I need to round off to 1/8 th dollar, ie, value = 10.01 then it should return 10.125 value = 110.2 then it should return 110.250 when the rounding parameter is 250 then I need to round off to quarter dollar, ie, value = 10.01 then it should return 10.250 value = 110.3 then it should return 110.500 when the rounding parameter is 500 then I need to round off to half dollar, ie, value = 10.01 then it should return 10.500 value = 110.6 then it should return 111. I have written code using Math.round(8f * value/8f) which rounds of to nearest 1/8 th dollar but the rounding should be UP always but in my case 10.01 rounds off to 10
answer count: 4
type: UnansweredQuestion
upvote count: 4
downvote count: 0
has title: Rounding UP double values in java based on parameters
favorite count: 0
has answer: http://stackoverflow.com/a/25969186
has answer: http://stackoverflow.com/a/25969297

http://stackoverflow.com/a/25955135
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: In addition to this issue: 'It turns out that the size of my AppWidget was clipping the image the whole time. Clipping it just enough to remove the rounded corners, and just so little as to not have been obviously clipped. So for anyone that comes across this question... all of these method's work for this purpose (just don't forget to make your AppWidget big enough to see the results).' Answer: I found it was critical to also pass the RoundedCornersDrawable through the CustomView.drawToBitMap() method before exporting it to the PNG file. I hope this all helps someone down the road someday!
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40635607
accepted answer of: http://stackoverflow.com/q/25877515
answers question: http://stackoverflow.com/q/25877515

http://stackoverflow.com/comment/40668938
comment on: http://stackoverflow.com/a/25972425
has text: Not sure about google juice... But I am not having very complex/application, so I am avoiding using any external framework...
score: 0
type: AnswerComment
type: Comment

math
tags question: http://stackoverflow.com/q/26022233
tags question: http://stackoverflow.com/q/26028081
tags question: http://stackoverflow.com/q/25977160
tags question: http://stackoverflow.com/q/25919883
tags question: http://stackoverflow.com/q/25890293
tags question: http://stackoverflow.com/q/25942910
tags question: http://stackoverflow.com/q/25963603
tags question: http://stackoverflow.com/q/25905063
type: Tag
tags question: http://stackoverflow.com/q/25929820
tags question: http://stackoverflow.com/q/26017203
tags question: http://stackoverflow.com/q/25944522
tags question: http://stackoverflow.com/q/26027730
tags question: http://stackoverflow.com/q/26019201
tags question: http://stackoverflow.com/q/25984836
tags question: http://stackoverflow.com/q/25898503
tags question: http://stackoverflow.com/q/25881008
tags question: http://stackoverflow.com/q/25894354
tags question: http://stackoverflow.com/q/25901198
tags question: http://stackoverflow.com/q/26020090
tags question: http://stackoverflow.com/q/25901648
tags question: http://stackoverflow.com/q/25974911
tags question: http://stackoverflow.com/q/25923480
tags question: http://stackoverflow.com/q/25954374
tag name: math
tags question: http://stackoverflow.com/q/26002304
tags question: http://stackoverflow.com/q/25926465
tags question: http://stackoverflow.com/q/25946620

http://stackoverflow.com/a/25973282
has body: You are overwriting text via textArea.setText(). Do it only once before the loop or create a boolean flag and set it to true when you set a text to text area and check it everytime in the loop before you trying to set it again.
answers question: http://stackoverflow.com/q/25973061
score: 0
type: Answer

http://stackoverflow.com/comment/40620014
type: Comment
type: QuestionComment
has text: @DigveshPatel yes i have used so many libraries..for ex.itext-asign.jar. then how to add this jar file in progaurd file.
comment on: http://stackoverflow.com/q/25945474
score: 0

http://stackoverflow.com/q/25952730
answer count: 1
has answer: http://stackoverflow.com/a/25952786
favorite count: 0
has title: Can I use file choice dialog when saving files?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40631431
has body: How do I display and use a file choice dialog when I wish to save files from a Swing application?
accepted answer: http://stackoverflow.com/a/25952786
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/40631116
tagged with: swing
has comment: http://stackoverflow.com/comment/40631156
has comment: http://stackoverflow.com/comment/40631175
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40631332
upvote count: 0

http://stackoverflow.com/comment/40690448
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25966078
has text: will add to code above the pack/unpack. Exception is in the doFinal part of the unpack.

http://stackoverflow.com/q/25887993
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40515476
tagged with: xmpp
has comment: http://stackoverflow.com/comment/40519421
tagged with: smack
linked to: http://stackoverflow.com/q/25041025
upvote count: 1
has body: I am using the XMPP smack api 3.3.1 libraries. How do I send is typing information.
tagged with: java
has comment: http://stackoverflow.com/comment/40517195
type: UnansweredQuestion
has title: smack api with typing to send the message
answer count: 0
downvote count: 0
score: 1

http://stackoverflow.com/q/25934715
tagged with: regex
has body: I am having some difficulty trying to create a working regex pattern for recognizing a string of file names. Pattern pattern = Pattern.compile("(\\w+)(\\.)(t)(x)(t)(\\s$|\\,)"); When using a .find() from a matcher class on my sample input, say "file1.txt,file2.txt " I am returned true, which is fine, however other erroneous input also returns true. This erroneous input includes strings such as: "file1.txt,,file2.txt " "file%.text " I have been consulting this website as I have been trying to construct them, I'm pretty sure I am missing something rather obvious though. Link
has answer: http://stackoverflow.com/a/25935020
has answer: http://stackoverflow.com/a/25934933
has title: Setting up a Regex Pattern in Java
has answer: http://stackoverflow.com/a/25934997
has comment: http://stackoverflow.com/comment/40600515
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40600304
has comment: http://stackoverflow.com/comment/40600481
upvote count: 1
has comment: http://stackoverflow.com/comment/40600429
has answer: http://stackoverflow.com/a/25935336
answer count: 4
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40600479

http://stackoverflow.com/comment/40538128
type: Comment
comment on: http://stackoverflow.com/a/25900049
score: 0
type: AnswerComment
has text: sir your out put is {}?

http://stackoverflow.com/a/25892386
upvote count: 3
has comment: http://stackoverflow.com/comment/40523226
accepted answer of: http://stackoverflow.com/q/25892323
score: 3
has body: use 4 slashes instead of 2. Like this - ret =ret.replaceAll("\\\\", ""). You need 1 for java, one for regex engine, and two to parse it literally (removing the special meaning).
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25892323
has comment: http://stackoverflow.com/comment/40524007
type: Answer

http://stackoverflow.com/a/25986509
downvote count: 0
has comment: http://stackoverflow.com/comment/40715894
has comment: http://stackoverflow.com/comment/40694599
upvote count: 2
type: Answer
has body: you have to find a way to removeupdates like mlocManager.removeUpdates(mlocListener); after you send your parse information
has comment: http://stackoverflow.com/comment/40694467
answers question: http://stackoverflow.com/q/25986056
score: 2

http://stackoverflow.com/comment/40708286
has text: max perm size of 1gb seems a bit excessive too; if there really is a need for it to be that high that may already be an indicator that there is something not right.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25995027

http://stackoverflow.com/comment/40709186
type: QuestionComment
score: 7
comment on: http://stackoverflow.com/q/25995551
has text: Call `o.getClass()`?
type: Comment

http://stackoverflow.com/comment/40506557
score: 0
type: Comment
type: QuestionComment
has text: Are you related to [@KPD](http://stackoverflow.com/users/2077574/kpd)? You seem to have the same XML+XSLT: http://stackoverflow.com/questions/25730940/xslt-dynamically-filter-on-multiple-elements/25731192#25731192
comment on: http://stackoverflow.com/q/25878127

http://stackoverflow.com/q/25981428
has answer: http://stackoverflow.com/a/25981765
type: Question
tagged with: gzipoutputstream
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/25983563
answer count: 3
tagged with: gzipstream
has body: I'm trying to compress the file in java before I upload the file with GZIPOutputStream. Is there a way to just store the gzipped file in memory for the upload and not have it generate a gzipped file on the local computer? Thanks!
downvote count: 0
has title: compressing with GZIPOutputStream to upload without creating a gzip file locally
favorite count: 0
has answer: http://stackoverflow.com/a/25984460
tagged with: apache-httpclient-4.x
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40684498
tagged with: java

http://stackoverflow.com/q/25927885
tagged with: uimanager
tagged with: jmenu
type: Question
has comment: http://stackoverflow.com/comment/40590197
accepted answer: http://stackoverflow.com/a/25930594
has title: How to set JMenu Foreground color using UIManager
score: 2
has comment: http://stackoverflow.com/comment/40595779
answer count: 1
has body: I am trying to set JMenu foreground color in my project. I use UIManager.put("text", Color.RED) it work for all text but in JMenu text color does not change. I want to set JMenu.setForeground("Color.RED") to work but UIManager.put("Menu.foreground", Color.RED) does not fill color. So please help me for this below code. import java.awt.Color; import javax.swing.UIManager; public class Frame extends javax.swing.JFrame { public Frame() { setExtendedState(Frame.MAXIMIZED_BOTH); setTitle("MENU COLOR"); initComponents(); } private void initComponents() { menu_bar = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenu1.setText("File"); jMenu1.setFont(new java.awt.Font("URW Bookman L", 0, 18)); jMenu1.setPreferredSize(new java.awt.Dimension(45, 25)); jMenu1.setForeground(Color.RED); menu_bar.add(jMenu1); setJMenuBar(menu_bar); pack(); } public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager .getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); UIManager.put("Menu.foreground", Color.RED); break; } } } catch (Exception ex) { ex.printStackStrace(); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Frame().setVisible(true); } }); } private javax.swing.JMenu jMenu1; private javax.swing.JMenuBar menu_bar; } Thank You For Reading
downvote count: 0
has comment: http://stackoverflow.com/comment/40591334
favorite count: 0
has comment: http://stackoverflow.com/comment/40591573
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25930594
upvote count: 2
tagged with: java
tagged with: look-and-feel
tagged with: swing

http://stackoverflow.com/comment/41069059
has text: jBPM is 400MB in size and not easy to use with existing classes. Activiti looks simple though.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26142138
type: AnswerComment

http://stackoverflow.com/a/25931271
score: 5
answers question: http://stackoverflow.com/q/25931053
upvote count: 5
type: Answer
has body: The following regex will validate that it is a comma-separated list of either positive natural number or range of number (which consist of 2 positive natural numbers separated by -): ^\d+(-\d+)?(?:,\d+(?:-\d+)?)*+$ In string literal: "^\\d+(-\\d+)?(?:,\\d+(?:-\\d+)?)*+$" If you are wondering about the *+, it is the possessive version of the usual 0-or-more quantifier *. Basically, it reduces backtracking. This syntax is available in Java and PCRE, but for languages without support, drop the + in *+.
downvote count: 0

http://stackoverflow.com/comment/40583327
comment on: http://stackoverflow.com/a/25924967
type: Comment
has text: @Pokechu22 True. Corrected
score: 0
type: AnswerComment

http://stackoverflow.com/q/25874510
tagged with: spring
has comment: http://stackoverflow.com/comment/40492759
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25875669
type: Question
has comment: http://stackoverflow.com/comment/40499698
tagged with: spring-security
has comment: http://stackoverflow.com/comment/40499749
has body: I expose a Spring REST service like this.. @RequestMapping(value = "/{id}", method = RequestMethod.GET, headers = Constant.ACCEPT_APPLICATION_JSON) @ResponseBody public IndividualProviderDto showJson(@PathVariable("id") Long id) { IndividualProviderDto individualProviderDto = individualProviderService.findIndividualProvider(id); if (SecurityUtils.getCurrentLogin().equals(individualProviderDto.getUserName())) { individualProviderDto.setCredential(""); HttpHeaders headers = new HttpHeaders(); headers.add(Constant.CONTENT_TYPE, Constant.APPLICATION_JSON_CHARSET_UTF8); return individualProviderDto; } throw new IllegalArgumentException("User not found"); } In the above code I am explicitly making a check to ensure that the id belongs to the logged in USER. SecurityUtils.getCurrentLogin().equals(individualProviderDto.getUserName() This check has to be applied wherever I need to protect a resource. Of course I can have an Aspect and apply it from one place using pointcut expressions. I have also heard of ESAPI that forges the url but I was wondering if Spring Security Configuration provides something out of the box, so that I don't reinvent the wheel.
answer count: 1
downvote count: 0
favorite count: 0
tagged with: esapi
has answer: http://stackoverflow.com/a/25875669
has title: Spring Security 3.2: Prevent Direct Object Reference
upvote count: 1

http://stackoverflow.com/comment/40880163
type: AnswerComment
type: Comment
has text: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
comment on: http://stackoverflow.com/a/26087835
score: 1

http://stackoverflow.com/q/25897274
upvote count: 1
tagged with: spring
has body: Spring 4 O/X supports several XML unmarshallers behind its abstraction. We use JAXB2. Can Spring validate the incoming XML against a schema? I didn't find anything in the official documentation nor in the spring-oxm schema that describe the configuration. This is my current configuration, pretty standard. com.example.Message1 com.example.Message2
tagged with: xsd
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jaxb
type: Question
downvote count: 0
answer count: 1
has title: Configure Spring 4.1 O/X mapping to validate inbound XML based on a schema?
has answer: http://stackoverflow.com/a/25899758
favorite count: 0
tagged with: spring-oxm
accepted answer: http://stackoverflow.com/a/25899758

http://stackoverflow.com/q/26019575
has answer: http://stackoverflow.com/a/26036958
upvote count: 3
answer count: 3
has title: Trying to UTF-8 encode the Files.write(..) but getting a OutOfMemoryError
possible better answer: http://stackoverflow.com/a/26036230
favorite count: 0
has body: I'm trying to encode my text file with UTF-8. When I do this, it works. protected void writeFile(Path dir, StringBuilder sb) { try { String fileName = dir.toFile().getAbsolutePath() + File.separator + getClass().getSimpleName().toLowerCase() + ".impex"; Path path = Paths.get(fileName); Files.write(path, sb.toString().getBytes(), StandardOpenOption.CREATE); } catch (Exception e) { e.printStackTrace(); } } But when I use the encoding UTF-8 or UTF8 than I get a java.lang.OutOfMemoryError: Java heap space. Why is that and how can I solve this issue? (My memory settings are already 2GB) protected void writeFile(Path dir, StringBuilder sb) { try { String fileName = dir.toFile().getAbsolutePath() + File.separator + getClass().getSimpleName().toLowerCase() + ".impex"; Path path = Paths.get(fileName); Files.write(path, sb.toString().getBytes("UTF8"), StandardOpenOption.CREATE); } catch (Exception e) { e.printStackTrace(); } }
tagged with: out-of-memory
tagged with: utf-8
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/26036958
has answer: http://stackoverflow.com/a/26021676
has answer: http://stackoverflow.com/a/26036230
type: Question
score: 3
has comment: http://stackoverflow.com/comment/40753295
tagged with: java

http://stackoverflow.com/comment/40700663
comment on: http://stackoverflow.com/a/25990367
score: 0
type: AnswerComment
type: Comment
has text: I probably screwed up by asking the question in a very casual manner. I was in a hurry and needed some quick help, and didnt bother elaborating much. Anyways, I have made an edit. Lance Java, your answer was certainly helpful, but I suppose that is not what I was looking for.

http://stackoverflow.com/comment/40746867
has text: And why should that be a responsiblity of Spring Security? Just create a repository that uses a `LdapTemplate` to retrieve the users from the AD.
comment on: http://stackoverflow.com/q/26016193
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40742785
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26013430
has text: You can find it here http://stackoverflow.com/questions/8821240/android-how-to-create-my-own-activity-and-extend-it
score: 0

http://stackoverflow.com/a/26028771
upvote count: 3
has body: The value of the field price in WalkupTicket is not accessible from Ticket, you need to override the getPrice method...for example... public class WalkupTicket extends Ticket{ // Fields private double price; // Constructor public WalkupTicket(int tixNumber){ super(tixNumber); this.price = 50.0; } public double getPrice() { return price; } } A better solution would be to provide a protected method in the Ticket class that allows you to set the price value... public abstract class Ticket{ //... protected void setPrice(double price) { this.price = price; } //... } Then you won't need the price variable in WalkupTicket at all and can simply set the price value via the setter... public class WalkupTicket extends Ticket{ // Constructor public WalkupTicket(int tixNumber){ super(tixNumber); setPrice(50.0); } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40770786
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/26028730
answers question: http://stackoverflow.com/q/26028730

http://stackoverflow.com/comment/41102163
has text: Can you post your pom.xml file
comment on: http://stackoverflow.com/q/25923405
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25997498
tagged with: calendar
has answer: http://stackoverflow.com/a/26001384
has answer: http://stackoverflow.com/a/26002040
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25998351
has comment: http://stackoverflow.com/comment/40712920
score: 1
tagged with: java
type: Question
tagged with: busy-waiting
accepted answer: http://stackoverflow.com/a/26001384
downvote count: 0
has body: I've written a class to continue a started JAVA application if the current second is a multiple of 5 (i.e. Calender.SECOND % 5 == 0) The class code is presented below, what I'm curious about is, am I doing this the right way? It doesn't seem like an elegant solution, blocking the execution like this and getting the instance over and over. public class Synchronizer{ private static Calendar c; public static void timeInSync(){ do{ c = Calendar.getInstance(); } while(c.get(Calendar.SECOND) % 5 != 0); } } Synchronizer.timeInSync() is called in another class's constructor and an instance of that class is created at the start of the main method. Then the application runs forever with a TimerTask that's called every 5 seconds. Is there a cleaner solution for synchronizing the time? Update: I think I did not clearly stated but what I'm looking for here is to synchronization with the system time without doing busy waiting. So I need to be able to get 12:19:00 12:19:05 12:19:10 ...
tagged with: datetime
has title: Wait for system time to continue application
has answer: http://stackoverflow.com/a/25997776
answer count: 4
has comment: http://stackoverflow.com/comment/40720296
favorite count: 0
linked to: http://stackoverflow.com/q/2258066
tagged with: blocking
has comment: http://stackoverflow.com/comment/40741603
possible better answer: http://stackoverflow.com/a/25997776
upvote count: 1

http://stackoverflow.com/comment/40692764
comment on: http://stackoverflow.com/q/25974118
score: 0
type: Comment
type: QuestionComment
has text: It's my bad, :| Forgot to import the classes. Got used to eclipse doing it for me and forgot that I was only using Notepad++ at the moment.

http://stackoverflow.com/comment/40607986
has text: Thanks Serge, that's exactly the kind of tool that I was looking for. :) I will investigate further and come back.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25933432
score: 0

http://stackoverflow.com/comment/40654167
has text: Yes, though as I said, I would likely do it in ways that aren't appropriate for what is likely the homework assignment you are working on. I would either be looking at `List<Person>` (ArrayList if you are doing lots of lookups, LinkedList if you are doing lots of inserts) or `Map<String,Integer>` (a TreeMap if sorted and LinkedHashMap if you are after insertion order, or HashMap if you don't care). If those haven't been introduced to you yet and you are supposed to use some other approach, they are the very wrong answer for what is trying to be taught to you.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25965030

http://stackoverflow.com/comment/40738084
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25988813
has text: Sorry about no line spaces. Seems I'm not able to produce those... I made a few tests now. 1) BigDecimal in from Java. I couldn't pass it from Java. Got "Invalid column type binary_double". I didn't want to mess with this, so dropped this test. 2) Passed in BigDecimal from Java Both "integer" and "number" types worked nicely 3) Tested 16 and 17 digits with Long from Java 16 digits worked nicely. 17 digits got the error.

http://stackoverflow.com/comment/69236809
type: Comment
has text: Duplicate of http://stackoverflow.com/questions/3755230/how-to-convert-html-rtf-in-java?
type: QuestionComment
comment on: http://stackoverflow.com/q/25956775
score: 0

http://stackoverflow.com/q/25916667
has body: Being new to Google Cloud Datastore I would like to make sure that I am on a right track. What I need: many-to-many relationship the relationship itself has to hold data describing the relation strong consistency is required both ways: from user entity to all the data entities that this user has permissions to from data entity to all the users that have permission to it This is what I came up with: @Entity public class User { @Id String userId; } @Entity public class PermissionIndex { @Id long id; @Parent Key&lt;User&gt; user; List&lt;Ref&lt;Permission&gt;&gt; permissions; } @Entity public class Permission { @Id long id; boolean writePermission; boolean managePermission; @Load Ref&lt;Data&gt; data; //So that Data entities can be retrieved with strong //consistency after looking up Permission entities //for a specific User entity @Load Ref&lt;User&gt; user; //So that User entities can be retrieved with strong //consistency after looking up Permission entities //for a specific Data entity } @Entity public class DataIndex { @Id long id; @Parent Key&lt;Data&gt; data; List&lt;Ref&lt;Permission&gt;&gt; permissions; } @Enti. public class Data { @Id String dataId; @Id String actualData; } If I understand right with this implementation the only way to filter Data Entities of a specific user is to get all Permission entities and filter Data entities in memory, am I right? Is there a better way to implement it still fulfilling the requirements? UPDATE: In my understanding this implementation will allow me to implement logic that will retrieve data assuring strong consistency (having user id - ancestor query to retrieve all Permission entities and then using get_by_key to retrieve the Data entities). I am wondering if I should approach it in a different way - since I do not have a lot of expierience with datastore/objectify.
tagged with: consistency
has title: Many-to-many relationship in Objectify with strong consistency
tagged with: many-to-many
has comment: http://stackoverflow.com/comment/40599591
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25920758
score: 0
answer count: 2
favorite count: 0
tagged with: objectify
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/25916765

http://stackoverflow.com/comment/40744989
score: 0
has text: If I don't know how big the array is can i just make it new int[] ?
type: Comment
comment on: http://stackoverflow.com/a/26015247
type: AnswerComment

http://stackoverflow.com/comment/40560028
comment on: http://stackoverflow.com/q/25912144
type: QuestionComment
has text: Try removing the mapping and class elements and a property. The name of the property is `hibernate.archive.autodetection` and put `hbm,class` as a value. Together with adding `<exclude-unlisted-classes>false</exclude-unlisted-classes>` that should scan your path for hbm files and for class files containing `@Entity` annotations.
score: 0
type: Comment

http://stackoverflow.com/a/25983564
type: Answer
upvote count: 4
downvote count: 0
has body: As stated in the javadoc, the index for the getColumnName(i) starts from 1, not from 0.
score: 4
has comment: http://stackoverflow.com/comment/40698623
answers question: http://stackoverflow.com/q/25983508
has comment: http://stackoverflow.com/comment/40688252

http://stackoverflow.com/comment/40727614
type: Comment
comment on: http://stackoverflow.com/q/25993430
type: QuestionComment
has text: I'm not sure where I have to write your suggestion nor understand it.. is this a method ?
score: 0

http://stackoverflow.com/q/25944602
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27531030
tagged with: spring
has title: JSR 352 Java Batch: Partition Plan won't work when inside a split
tagged with: jsr
type: Question
tagged with: java
score: 0
has body: Partition Plan won't work when inside a split The following example is just a: job -> split -> flow -> step -> chunk -> partition The problem is that the parameters set in the partition plan wont work if I put the flow inside a split. If you delete the split and just put the flow inside the job, it works properly. The following example wil print just: null null but if I delete the split, it will print valueTest1 valueTest2 Thanks! Matias Job XML <property name="prop1" value="#{partitionPlan['prop1']}"/> <writer ref="testbatch.MyItemWriter"/> <property name="prop1" value="valueTest1"/> <property name="prop1" value="valueTest2"/> READER package testbatch; import javax.batch.api.BatchProperty; import javax.batch.api.chunk.AbstractItemReader; import javax.inject.Named; @Named public class MyItemReader extends AbstractItemReader { @BatchProperty String prop1; @Override public Object readItem() throws Exception { System.out.println(prop1); return null; } } MAIN package testbatch; import javax.batch.operations.JobOperator; import javax.batch.runtime.BatchRuntime; public class TestBatch { public static void main(String[] args) { JobOperator jobOperator = BatchRuntime.getJobOperator(); jobOperator.start("myJob", null); } }
tagged with: batch-processing
answer count: 1
tagged with: spring-batch

http://stackoverflow.com/a/25890751
type: Answer
has comment: http://stackoverflow.com/comment/40520839
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40520725
answers question: http://stackoverflow.com/q/25890673
has comment: http://stackoverflow.com/comment/40520806
upvote count: 2
has body: Just split str[0] again on " "

http://stackoverflow.com/q/26002455
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26002611
tagged with: regex
has answer: http://stackoverflow.com/a/26003183
type: UnansweredQuestion
score: 0
has title: How do I get detect a pattern including an arbitrary string?
has body: I have a response system, and I'm trying to get it so you can input a String, and it matches it to the most likely String in its database by looping through each one and measuring the Levinshtein Distance with predefined questions and using a few other algorithms. Example: If you input "Hi, how are you?" It will search its database for something identical or very similar (like "Hi, how are you doing?"). But I want it to be able to detect if a specific phrase that depends on the circumstances is being used, such as: "Give me 10 cookies." Now, I don't want to add all possible numbers of cookies in the database. That would be impossible. So, in the database, it would be something like: "Give me [number] cookies." How would I detect the pattern though? Keep in mind I'm also going to be using String patterns for other responses.

keystore
tags question: http://stackoverflow.com/q/25907326
tag name: keystore
tags question: http://stackoverflow.com/q/25898028
type: Tag

http://stackoverflow.com/comment/40521606
comment on: http://stackoverflow.com/a/25891407
has text: A workaround is to replace all `"\r\n"` with `"\n"`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40709993
type: QuestionComment
has text: @UwePlonus: Not quite - this is talking about calling just the super method on an arbitrary object. Put it this way - I can imagine a language where the linked question's request is feasible but this question's request isn't.
type: Comment
comment on: http://stackoverflow.com/q/25995848
score: 0

http://stackoverflow.com/a/25878086
has comment: http://stackoverflow.com/comment/40498777
accepted answer of: http://stackoverflow.com/q/25878017
upvote count: 9
has comment: http://stackoverflow.com/comment/40498370
score: 9
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40499508
has body: Although you are accessing it on HashMap, Entry is actually a (implicitly static) member type declared in Map. TreeMap#entrySet has a return type of Set&lt;Map.Entry&lt;K,V&gt;&gt;. This is the same Entry type.
type: Answer
answers question: http://stackoverflow.com/q/25878017
has comment: http://stackoverflow.com/comment/40498477

http://stackoverflow.com/comment/62431926
comment on: http://stackoverflow.com/a/26036311
type: Comment
score: 0
type: AnswerComment
has text: @Xstian thanks! i figured it out with "jaxb:class name" binding. didn't know how flexible that tool was.

http://stackoverflow.com/comment/40618679
type: QuestionComment
has text: There's not enough information here. My guess is that the function LoadTestData.getData(...) is returning an Object[][] that's not correctly formatted. We need some details about how this function creates that Object[][], could you provide that please?
score: 0
comment on: http://stackoverflow.com/q/25944605
type: Comment

http://stackoverflow.com/comment/40713992
score: 1
has text: While it looks like you've spent good amount of effort on the question it likely will benefit from 2-3 lines TL;DR; section with clear single question.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25997950

http://stackoverflow.com/comment/40729152
comment on: http://stackoverflow.com/q/26006068
score: 0
has text: did you try anything yet?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/62334877
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25878836
has text: Hello Adam, how did you resolve the error?

http://stackoverflow.com/comment/40527459
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25893023
has text: do you mean request.getAttribute("clientBean") returns null?
type: AnswerComment

http://stackoverflow.com/q/25943943
answer count: 4
accepted answer: http://stackoverflow.com/a/25944071
has answer: http://stackoverflow.com/a/25944056
has body: I want to solve the following task: Given a singly linked list, write a function to swap elements pairwise. For example, if the linked list is 1->2->3->4->5->6->7 then the function should change it to 2->1->4->3->6->5->7, and if the linked list is 1->2->3->4->5->6 then the function should change it to 2->1->4->3->6->5 To do so, I use recursive approach taken from here: http://www.geeksforgeeks.org/pairwise-swap-elements-of-a-given-linked-list-by-changing-links/ , namely, swap the first two nodes, and then recurse on the rest of the list. My function is the following: private static ListNode reorder(ListNode l1) { if(l1 == null || l1.next == null) return l1; ListNode rest = l1.next.next; //change head ListNode newHead = l1.next; //change next of second node newHead.next = l1; l1.next = reorder(rest); return newHead; } However on the input 1 2 3 4 5 6 I have output 1 4 3 6 5?! I debugged it but still can't see where is the problem. Can anyone explain me why this is the case? Here is the whole class: public class Swap { public static class ListNode { int val; ListNode next; ListNode(int x) { val = x; next = null; } } public static void main(String[] args) { ListNode l1 = new ListNode(1); ListNode l2 = new ListNode(2); ListNode l3 = new ListNode(3); ListNode l4 = new ListNode(4); ListNode l5 = new ListNode(5); ListNode l6 = new ListNode(6); ListNode l7 = new ListNode(7); ListNode l8 = new ListNode(8); ListNode l9 = new ListNode(9); ListNode l10 = new ListNode(10); l1.next = l2; l2.next = l3; l3.next = l4; l4.next = l5; l5.next = l6; l7.next = l8; l9.next = l10; print(l1); reorder(l1); System.out.println(); print(l1); } private static void print(ListNode l1) { ListNode current = l1; while(current != null){ System.out.print(current.val + " "); current = current.next; } } private static ListNode reorder(ListNode l1) { if(l1 == null || l1.next == null) return l1; ListNode rest = l1.next.next; //change head ListNode newHead = l1.next; //change next of second node newHead.nex…
tagged with: linked-list
possible better answer: http://stackoverflow.com/a/26725682
upvote count: 1
has answer: http://stackoverflow.com/a/26725682
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40617612
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/25944071
has answer: http://stackoverflow.com/a/54883497
favorite count: 0
has title: Pairwise swap elements of a given linked list (Java solution)
has comment: http://stackoverflow.com/comment/40620575
has comment: http://stackoverflow.com/comment/40617594

http://stackoverflow.com/a/25881800
has body: While a second variable is not needed here (and it is a bit silly because of the relationship), it is perfectly valid to "loop multiple variables", including declaring and incrementing them together: for (int i = 0, j = 1; i &lt; ary1.length; i++, j++) { // .. } Note that j is also scope to the loop (albeit with an initial value of 1), and is also incremented in the loop independently of (but at the same time as) i.
score: 0
answers question: http://stackoverflow.com/q/25881597
type: Answer

http://stackoverflow.com/q/25908680
answer count: 3
has answer: http://stackoverflow.com/a/25908710
has comment: http://stackoverflow.com/comment/40552930
has comment: http://stackoverflow.com/comment/40552994
favorite count: 0
has answer: http://stackoverflow.com/a/25908714
type: AnsweredQuestion
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/40553508
tagged with: java
upvote count: 1
tagged with: unreachable-code
accepted answer: http://stackoverflow.com/a/25908714
has title: Java:Unreachable statement error
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/25908728
has body: for the following code mentioned below ,I have been obtaining the Error " Unreachable statement error " at " Return Cols " statement The code computes the position of Maximum Dose in a generated Output CSV file public int getPosition() { double dose = 0.0; double position = 0.0; int rows = 0; int cols = 0; String s; for (int j = 1; j &lt; nz; j++) { s = ""; for (int i = 1; i &lt; nx; i++) { for (DetEl det_el : det_els) { if (det_els.get(j + i * nz).getDose() == getMaxDose()) { i=rows; j=cols; } // comma separated or Semicolon separated mentioned here } // prints out the stream of values in Doses table separated by Semicolon } } return rows; return cols;//unreachable statement error obtained at this position. } Any help is greatly appreciated
has answer: http://stackoverflow.com/a/25908728
score: 0

http://stackoverflow.com/comment/40591850
comment on: http://stackoverflow.com/a/25906425
score: 0
type: AnswerComment
has text: So, what we have is: Bidirectional association will never work without cascading?
type: Comment

http://stackoverflow.com/q/25969773
has answer: http://stackoverflow.com/a/25970815
accepted answer: http://stackoverflow.com/a/25970815
answer count: 1
tagged with: osgi
has title: How does the Lifecycle of DS Components work?
type: AnsweredQuestion
tagged with: java
type: Question
has body: In which order are the annotated methods called on bundle start and stop? I use the annotations of aQute.bnd.annotation. Is there any documentation on this? My guess is that it is: on bundle start: SetA onStartUp (@Activate) on bundle stop: unsetA onShutdown (@Deactivate) I need a method which is called after all Service-references to the component are unset. Can I use the @Deactivate method for this? @Component(immediate=true) public class AImpl implements A { @Activate public void onStartUp() { } @Deactivate public void onShutDown() { } } public class B { private A a; @Reference(name = "a", service = A.class, optional = false, multiple = false, dynamic = true, unbind = "unsetA") public void setA(A a) { this.a = a; } public void unsetA(A a) { this.a = null; } }
tagged with: bnd
score: 0

http://stackoverflow.com/a/26031097
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40774616
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40774732
accepted answer of: http://stackoverflow.com/q/26030788
answers question: http://stackoverflow.com/q/26030788
score: 1
has body: Try the below code import java.io.*; import java.util.*; /** * * @author Selva */ public class Readfile { public static void main(String[] args) throws FileNotFoundException, IOException{ if (args.length==0) { System.out.println("Error: Bad command or filename."); System.exit(0); }else { InputStream in = new FileInputStream(new File(args[0])); OutputStream out = new FileOutputStream(new File(args[1])); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) &gt; 0) { out.write(buf, 0, len); } in.close(); out.close(); } } } Run this code using If your text file and java code is same folder run the program like below. java Readfile input.txt output.txt If your text file and java code is different folder run the program like below. java Readfile c:\input.txt c:\output.txt If you read input form keyboard using scanner.Try the below code import java.io.*; import java.util.*; /** * * @author Selva */ public class Readfile { public static void main(String[] args) throws FileNotFoundException, IOException{ Scanner s=new Scanner(System.in); if (args.length==0) { System.out.println("Error: Bad command or filename."); System.exit(0); }else { System.out.println("Enter Input FileName"); String a=s.nextLine(); System.out.println("Enter Output FileName"); String b=s.nextLine(); InputStream in = new FileInputStream(new File(a)); OutputStream out = new FileOutputStream(new File(b)); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) &gt; 0) { out.write(buf, 0, len); } in.close(); out.close(); } } }

http://stackoverflow.com/a/25907681
has body: Yes, you can use pocketsphinx in keyword spotting mode. There is no keyword spotting mode in sphinx4 yet. You can find Android demo here http://cmusphinx.sourceforge.net/wiki/tutorialandroid
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25905057

http://stackoverflow.com/q/25893798
tagged with: jax-ws
upvote count: 1
tagged with: jaxb
has comment: http://stackoverflow.com/comment/40527859
type: Question
has title: JAXB wsimport binding files is it possible (Implements interface). Told it was
answer count: 1
downvote count: 0
has body: I have a wsdl that I am generating classes from using wsimport. I have a need for some of the classes to implement an interface that is defined in another framework. I was told by a Java developer that this was possible using a wsimport option. I assume that option is -b. Could not find documentation on how to create a binding file to do what I need. All examples show how to change the packagename. Below is an example of what I need Example WSDL &lt;xsd:complexType name="GetAandBRequest"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="A" type="xsd:int" /&gt; &lt;xsd:element name="B" type="xsd:int" /&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; WSImport generates public class GetAandBRequest { protected int a; protected int b; public int getA() { return a; } public void setA(int value) { this.a = value; } public int getB() { return storeNum; } public void setB(int value) { this.b = value; } } What I need from wsimport is: public class GetAandBRequest implements IMessage { protected int a; protected int b; public int getA() { return a; } public void setA(int value) { this.a = value; } public int getB() { return storeNum; } public void setB(int value) { this.b = value; } } Notice the implements IMessage. Is this possible with wsimport? If not possible how do you get around something like this. There are many messages. I don't want to have to manually add an implements IMessage everytime I need to regenerate the wsdl and schemas. Much thanks in advance...
favorite count: 0
linked to: http://stackoverflow.com/q/39640430
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40526920
has answer: http://stackoverflow.com/a/25894588
has comment: http://stackoverflow.com/comment/40534455
score: 1
tagged with: java
tagged with: wsimport
tagged with: jax-ws-customization

http://stackoverflow.com/q/26023804
downvote count: 0
favorite count: 0
tagged with: apache-poi
upvote count: 2
has answer: http://stackoverflow.com/a/26023840
has comment: http://stackoverflow.com/comment/40761361
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has title: Using `Replace()` method does not replace text in Apache POI
tagged with: apache
has answer: http://stackoverflow.com/a/26026945
accepted answer: http://stackoverflow.com/a/26026945
has comment: http://stackoverflow.com/comment/40761430
possible better answer: http://stackoverflow.com/a/26023840
tagged with: replace
has body: Here is my code: import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.usermodel.Range; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; public class POI { public POI() throws IOException, InvalidFormatException { XWPFDocument doc = new XWPFDocument(OPCPackage.open("input.docx")); for (XWPFParagraph p : doc.getParagraphs()) { for (XWPFRun r : p.getRuns()) { String text = r.getText(0); System.out.println(text); if (text.contains("needle")) { text = text.replace("needle", "haystack"); r.setText(text); System.out.println(text); } } } doc.write(new FileOutputStream("output.docx")); } } This code is meant to replace text in .docx document. My input to the program is input.docx and it contains below data needle game system My output was output.docx and it contained the below data needlehaystack game system You can see the difference. Instead of "replacing" the word needle with haystack it has simply added haystack right next to needle. I have no idea about what I am doing wrong here. How can I properly replace text in .docx files?
answer count: 2
tagged with: io

http://stackoverflow.com/a/26020687
has comment: http://stackoverflow.com/comment/40767894
score: 1
has comment: http://stackoverflow.com/comment/40767043
has body: You can get full-range angle (-Pi..Pi for the most of math libraries) using both scalar product and cross product: radian = Math.atan2(v1.x*v2.y-v1.y*v2.x, v1.x*v2.x+v1.y*v2.y)
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40789341
type: Answer
answers question: http://stackoverflow.com/q/26020090
accepted answer of: http://stackoverflow.com/q/26020090
upvote count: 1
has comment: http://stackoverflow.com/comment/40777251

http://stackoverflow.com/q/25984586
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40690300
has comment: http://stackoverflow.com/comment/40690166
tagged with: performance
has title: Java want to improve a code snip
has comment: http://stackoverflow.com/comment/40690294
tagged with: java
has comment: http://stackoverflow.com/comment/40690272
has answer: http://stackoverflow.com/a/25984657
type: Question
has comment: http://stackoverflow.com/comment/40690365
tagged with: arrays
score: 0
tagged with: char
has comment: http://stackoverflow.com/comment/40690216
answer count: 1
has comment: http://stackoverflow.com/comment/40690176
has body: I wish to improve this code: for (int i = 0; i &lt; a.length(); i++) { for (int j = 0; j &lt; b.length(); j++) { if (arrayA[i] == arrayB[j]) { arrayA[i] = ' '; arrayB[j] = ' '; } } } The costly operation is arrayA[i] = ' '; arrayB[j] = ' '; If I comment that out the code runs from 180ms to 12ms... Need something similar so I can count the empty array.
tagged with: string
has comment: http://stackoverflow.com/comment/40693792
has comment: http://stackoverflow.com/comment/40690187
has comment: http://stackoverflow.com/comment/40690322

http://stackoverflow.com/comment/40723054
type: Comment
score: 1
type: AnswerComment
has text: @djb nice solution is use Jolokia, you can check activemq for example invoking `http://localhost:8161/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost` if you are using version 5.8 or higher
comment on: http://stackoverflow.com/a/25940587

http://stackoverflow.com/q/25922178
has comment: http://stackoverflow.com/comment/40578749
has comment: http://stackoverflow.com/comment/40578704
has title: understanding how to rotate a matrix 90 degrees
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40578636
tagged with: java
has comment: http://stackoverflow.com/comment/40578579
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25922357
type: Question
has body: I am try to understand the basic logic here, for example, what does 'n' represent ? If you could give a brief explanation of how this works, that would be great. here is the code: public static void rotate(int[][] matrix, int n) { for (int layer = 0; layer &lt; n / 2; ++layer) { int first = layer; int last = n - 1 - layer; for(int i = first; i &lt; last; ++i) { int offset = i - first; int top = matrix[first][i]; // save top // left -&gt; top matrix[first][i] = matrix[last-offset][first]; // bottom -&gt; left matrix[last-offset][first] = matrix[last][last - offset]; // right -&gt; bottom matrix[last][last - offset] = matrix[i][last]; // top -&gt; right matrix[i][last] = top; // right &lt;- saved top } } }

http://stackoverflow.com/comment/40768559
comment on: http://stackoverflow.com/a/26027606
has text: Thank you! :) ... But i am still getting the "error"
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26023145
score: 1
answers question: http://stackoverflow.com/q/26023049
downvote count: 0
type: Answer
has body: your element2 is being generated from nodes instead of nodes1. change to this: Element element2 = (Element) nodes1.item(var2);
upvote count: 1

http://stackoverflow.com/q/26005494
has answer: http://stackoverflow.com/a/26007339
has answer: http://stackoverflow.com/a/26007578
tagged with: java
has comment: http://stackoverflow.com/comment/40728355
has comment: http://stackoverflow.com/comment/49784342
type: Question
score: 5
has title: How to pass data from server to android app: REST vs Sockets
has comment: http://stackoverflow.com/comment/40728181
answer count: 2
possible better answer: http://stackoverflow.com/a/26007578
downvote count: 0
has body: I'am writing an android app that needs some data from the server. I am also writing the server side in Java. What is the best way to pass data from the server to the android device: with REST or Sockets (like Kryonet)? In what format: XML/JSON (for REST) or plain Java objects? Thanks in advance.
has comment: http://stackoverflow.com/comment/40728389
favorite count: 0
upvote count: 5
tagged with: rest
accepted answer: http://stackoverflow.com/a/26007339
tagged with: sockets
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/31706973
downvote count: 0
type: Answer
upvote count: 2
has body: The groupingBy and toMap might work slower on big datasets compared to groupingByConcurrent and toConcurrentMap. The best way to check whether groupingByConcurrent or toConcurrentMap is faster is to benchmark them by yourself on your own data sets. I think the results would be pretty much the same. Note however that if you use the file as the source, you may probably have less speedup from parallelism as in Java 8 the Files.lines() and BufferedReader.lines() are reading files sequentially and parallelism is achieved by prebuffering blocks of lines into arrays and spawning new tasks. This not always works efficiently, so probably the bottleneck would be in this procedure. In JDK 9 Files.lines() is optimized (for regular files less than 2Gb long), thus you may get much better performance there. As for generated sources it depends on how you generate them. It would be better if you supply the good splitting strategy for your source. If you use Stream.iterate or Spliterators.spliterator(iterator, ...) or extend AbstractSpliterator class, the default splitting strategy would be the same: prebuffer some elements into array to spawn a subtask.
answers question: http://stackoverflow.com/q/26002383
score: 2

http://stackoverflow.com/comment/40549895
type: Comment
comment on: http://stackoverflow.com/q/25905445
score: 0
has text: @StuartMarks was it on tree map?
type: QuestionComment

http://stackoverflow.com/comment/40714443
type: Comment
has text: Are you wanting an inner loop a loop inside a loop?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25998286

http://stackoverflow.com/q/26032103
has comment: http://stackoverflow.com/comment/40776613
has comment: http://stackoverflow.com/comment/40776419
has body: I done a coding to get the output 20,40,60,80 and 100. Multiple.java: public class Multiple { static int n=20; static int m; public static void main(String[] args) { for(int i=1;i&lt;=5;i++){ m=n*i; System.out.println(m); } } } Output: 20 40 60 80 100 I didn't have any issue in this coding.I got an output successfully.But loop running 5 times.Let me know is there any other way to get these output(20,40,60,80 and 100) in simplest way.
has comment: http://stackoverflow.com/comment/40776312
accepted answer: http://stackoverflow.com/a/26032574
has comment: http://stackoverflow.com/comment/40776212
score: -4
has comment: http://stackoverflow.com/comment/40776483
has comment: http://stackoverflow.com/comment/40776235
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40776417
tagged with: java
type: Question
downvote count: 4
upvote count: 0
has title: Multiples of 20 in java
answer count: 1
has answer: http://stackoverflow.com/a/26032574
has comment: http://stackoverflow.com/comment/40776244
favorite count: 0
has comment: http://stackoverflow.com/comment/40776204
has comment: http://stackoverflow.com/comment/40776304

specifications
type: Tag
tags question: http://stackoverflow.com/q/25912037
tag name: specifications

http://stackoverflow.com/comment/40594331
type: QuestionComment
comment on: http://stackoverflow.com/q/25930781
has text: @hajaji have you tried to send an UDP packet to a local IP address of your PC, instead of the broadcast address? Do you run wireshark in promiscuous mode?
score: 0
type: Comment

http://stackoverflow.com/q/25877832
has title: printDialog PageSize on Linux
type: UnansweredQuestion
tagged with: printdialog
has body: While working on Windows on Linux the print process doesn't use the page size that is shown in the printDialog. It always uses the size that is set in the OS printer settings. Has anybody also observed this behaviour. I consider writing a bug report about it.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27540331
answer count: 1
score: 0

http://stackoverflow.com/a/25923100
upvote count: 1
answers question: http://stackoverflow.com/q/25922932
downvote count: 0
score: 1
has body: StringBuilder sb = new StringBuilder("{"); for(String element: list){ sb.append(element); sb.append(","); } return sb.subSequence(0, sb.length()-1) + "}";
type: Answer

extjs
tags question: http://stackoverflow.com/q/25914112
tags question: http://stackoverflow.com/q/25873621
type: Tag
tag name: extjs
tags question: http://stackoverflow.com/q/25891618

http://stackoverflow.com/q/26004570
answer count: 1
accepted answer: http://stackoverflow.com/a/26008451
has body: I'm trying to use @DeclareMixin for the first time, and either I am doing something incorrect, or there is a bug somewhere. I've published my sample code to github: https://github.com/benze/AspectJError.git. I'm pasting the little bits here as well. If I look at the compiled code of ApplyAspect.class using a decompiler, I can see that ajc has properly added in the implemented interface. However, the compiler complains in Test that ApplyAspect does not have the setCreated() or the getCreated() methods. Additionally, if I try to compile the project from the command line, I get the same compilation errors as well. I'm not sure what I am doing wrong, or if there is a bug somewhere else with @DeclareMixin directive. Interface CreatedBean.java: public interface CreatedBean { public Object getCreated(); public void setCreated(final Object created); } Implementation CreatedBeanImpl.java: public class CreatedBeanImpl implements CreatedBean{ private Object created; public Object getCreated(){ return this.created; } public void setCreated(final Object created ){ this.created = created; } } Aspect definition: @Aspect public class DeclareMixinAspect { @DeclareMixin("com.benze.bo.ApplyAspect") public CreatedBean auditableBeanMixin(){ return new CreatedBeanImpl(); } } Class being advised (com.benze.bo pkg): public class ApplyAspect { private String name = "test class"; } Class trying to use ApplyAspect: public class Test { public static void main(String[] args) { ApplyAspect aa = new ApplyAspect(); aa.setCreated(new Date()); System.out.println( aa.getCreated().toString()); System.out.println(aa.toString()); System.out.println("all done"); } } The pom is very basic with only the aspectj plugin (and dependencies) added. I'm using AJ 1.8.2.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26008451
type: Question
tagged with: aspectj
has title: @DeclareMixin added methods not visible by other classes
tagged with: ajdt
score: 0

http://stackoverflow.com/comment/40710358
type: QuestionComment
has text: Provide full system path of the image
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25995754

http://stackoverflow.com/comment/40665785
comment on: http://stackoverflow.com/q/25970817
has text: @AbhijeetPanwar does [this](http://stackoverflow.com/questions/438146/hibernate-hbm2ddl-auto-possible-values-and-what-they-do) helps you
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25953634
has body: I will go with 1 with one change: if (condition1) { //... } else if (condition2) { //... } return; I'm using this solution because I have few lines of code. For example there are code styles which are not allowing more then N lines of code in methods.
accepted answer of: http://stackoverflow.com/q/25953585
answers question: http://stackoverflow.com/q/25953585
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/q/25992709
upvote count: 2
has body: I have a class extending BufferedImage which should display as a string provided to it's constructor. The reason I wish to do this is to allow the anti-aliasing functionality of graphics2D (see my previous question for more details, and if you have any better suggestions then by all means suggest them!). I now have the BufferedImage class working, however I cannot figure out how to determine the required width and height in order to display the input string before actually setting the font. I also cannot find a way to resize the BufferedImage parent once its initial size has been set. Here is my code: import java.awt.*; import java.awt.image.BufferedImage; import javax.swing.*; public class Test extends JFrame{ public Test(){ this.add(new JLabel(new ImageIcon(new IconImage("Test", new Font("Sans-Serif", Font.PLAIN, 16))))); this.setVisible(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.pack(); } class IconImage extends BufferedImage{ public IconImage(String text, Font font){ super(..., ..., BufferedImage.TYPE_INT_ARGB);//*****Unknown dimensions***** Graphics2D g2d = (Graphics2D) this.getGraphics(); g2d.setFont(font); g2d.setColor(Color.BLACK); int stringHeight = (int) g2d.getFontMetrics().getStringBounds(text, g2d).getHeight(); g2d.drawString(text, 0 , stringHeight); g2d.dispose(); } } public static void main(String[] args){ new Test(); } } Any advice? Thanks.
answer count: 2
has title: Create BufferedImage with unknown dimensions
favorite count: 0
has answer: http://stackoverflow.com/a/25994413
has answer: http://stackoverflow.com/a/25993400
accepted answer: http://stackoverflow.com/a/25993400
score: 2
tagged with: font-size
type: AnsweredQuestion
downvote count: 0
tagged with: fonts
has comment: http://stackoverflow.com/comment/40705412
tagged with: java
tagged with: swing
tagged with: bufferedimage
type: Question
has comment: http://stackoverflow.com/comment/40705652
possible better answer: http://stackoverflow.com/a/25994413
linked to: http://stackoverflow.com/q/25976299

http://stackoverflow.com/q/25887950
type: UnansweredQuestion
tagged with: maven
score: 2
downvote count: 0
tagged with: java
has title: 'Failed to generate reports view' error in JBehave
type: Question
upvote count: 2
tagged with: bdd
has body: While running JBehave BDD scenarios I get this error: Generating reports view to 'C:\Users\dev\.hudson\jobs\JavaProject\workspace\behavioural-test\target\jbehave' using formats '[stats, console, ide_console]' and view properties '{viewDirectory=view, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports-with-totals.ftl, decorateNonHtml=true, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, defaultFormats=stats, maps=ftl/jbehave-maps.ftl}' Failed to generate reports view to 'C:\Users\dev\.hudson\jobs\JavaProject\workspace\behavioural-test\target\jbehave' using formats '[stats, console, ide_console]' and view properties '{viewDirectory=view, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports-with-totals.ftl, decorateNonHtml=true, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, defaultFormats=stats, maps=ftl/jbehave-maps.ftl}' Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.531 sec &lt;&lt;&lt; FAILURE! All the scenarios pass, but for afew it shows 'Failed to generate reports.... Errors: 1' (not failures) How to fix this? Or what changes do I have to do in configuration to suppress these errors?
tagged with: jbehave
favorite count: 0
answer count: 0

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/25969320

http://stackoverflow.com/comment/40561076
has text: @vikingsteve Yes it's well known solution. When you have a bunch of builders and one factory.
score: 0
comment on: http://stackoverflow.com/q/25912679
type: Comment
type: QuestionComment

environment
tags question: http://stackoverflow.com/q/25995027
type: Tag
tags question: http://stackoverflow.com/q/25965595
tag name: environment

http://stackoverflow.com/q/25936890
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25937015
score: 5
has body: My project consists of a little icon moving over a grid with dimensions 25 by 20. I know I can do this easily with a few if/else blocks, but I want to learn more about error handling. What I was thinking was using a try catch, but it doesn't catch the array index out of bounds exception or any Exception at all: it does not return "error" or the positions, so it never goes to the catch block. I was thinking something like this pseudocode: try { // Code } catch(The exception) { x - 1 or + 1 } Actual code: public void tick() { Random rand = new Random(); try { int x, y; x = rand.nextInt(3) + (-1); //Slumpar fram en siffra (-1, 0, 1) y = rand.nextInt(3) + (-1); setPosition(new Point((int)getPosition().getX()+x,(int)getPosition().getY() + y)); } catch(Exception e) { System.out.println("error"); } System.out.println("x: " + getPosition().getX()); System.out.println("y: " + getPosition().getY()); } public String type() { return "Dummy"; }
has comment: http://stackoverflow.com/comment/40604572
has title: try catch ArrayIndexOutOfBoundsException?
has comment: http://stackoverflow.com/comment/40604553
has comment: http://stackoverflow.com/comment/40604484
possible better answer: http://stackoverflow.com/a/25937015
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/40604508
answer count: 3
has comment: http://stackoverflow.com/comment/40604414
tagged with: error-handling
has answer: http://stackoverflow.com/a/25937059
upvote count: 7
has comment: http://stackoverflow.com/comment/40604474
has answer: http://stackoverflow.com/a/43423039
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25937059

http://stackoverflow.com/comment/40582461
has text: I've sometimes run into trouble by importing the `java.awt` and `java.util` packages with the asterisk and then attempting to use the `List` interface of the `java.util` package, forgetting that the `List` class exists in the `java.awt` package. The compiler won't be able to tell if you want to use the class/interface from one package or the other.
type: AnswerComment
comment on: http://stackoverflow.com/a/25924554
score: 0
type: Comment

http://stackoverflow.com/q/25912503
upvote count: 1
has title: DBUnit throwing NoSuchColumnException while deleting the dataset
tagged with: dbunit
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26055889
possible better answer: http://stackoverflow.com/a/46081628
has answer: http://stackoverflow.com/a/46081628
tagged with: junit
favorite count: 0
has body: I am doing some unit testing using DBUnit. I am able to insert the dataset properly from the xml file but I am not able to clear the dataset after every thing is completed. Below is my table schema for the ID column (I have ommitted other columns here): FIELD TYPE COLLATION NULL KEY DEFAULT Extra PRIVILEGES ----------- ---------------- ----------------- ------ ------ ------------ -------------- ------------------------------- ID INT(11) UNSIGNED (NULL) NO PRI (NULL) AUTO_INCREMENT SELECT,INSERT,UPDATE,REFERENCES Below is the XML sataset: &lt;dataset&gt; &lt;MY_TABLE NAME="NISAY" /&gt; &lt;/dataset&gt; I am using FlatXmlDataSetBuilder for building the dataset. While creating, I am using InsertIdentityOperation.INSERT.execute(iConnection, dataSet); and for deleting I am using InsertIdentityOperation.DELETE.execute(iConnection, dataSet); The dataset is inserted properly into the database but while deleting, it throws the below exception: org.dbunit.dataset.NoSuchColumnException: MY_TABLE.ID - (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive. at org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:117) at org.dbunit.dataset.AbstractTable.getColumnIndex(AbstractTable.java:78) at org.dbunit.dataset.DefaultTable.getValue(DefaultTable.java:197) at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:189) Just to test that every thing is proper, I had removed the unsigned constraint from ID column and used the below dataset: &lt;dataset&gt; &lt;MY_TABLE ID="-99" NAME="NISAY" /&gt; &lt;/dataset&gt; Using the above, everything worked fine. However, the ID has to be unsigned. How do I tell DBUnit to ignore the Primary Key while deleting? I tried using Filters but not sure if they were configured properly.
accepted answer: http://stackoverflow.com/a/26055889

http://stackoverflow.com/q/25980575
tagged with: mapreduce
type: Question
tagged with: hadoop
downvote count: 0
has body: I get the below error when running the program. Any idea? Caused by: java.lang.NoClassDefFoundError: com/google/common/base/Charsets at org.apache.mahout.text.wikipedia.XmlInputFormat$XmlRecordReader.&lt;init&gt;(XmlInputFormat.java:76) at org.apache.mahout.text.wikipedia.XmlInputFormat.createRecordReader(XmlInputFormat.java:52) at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.&lt;init&gt;(MapTask.java:488) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:731) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:364) at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:223) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: com.google.common.base.Charsets at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source)*
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: On integrating mahout with map reduce program, I get this error while parsing XML
tagged with: mahout
tagged with: bigdata
has comment: http://stackoverflow.com/comment/40682374
has answer: http://stackoverflow.com/a/26036641
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/25994340
answers question: http://stackoverflow.com/q/25994123
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: I took a look there (but maybe there's a better place to look for java sources) and here's what I see : The constructor public SimpleDateFormat(String pattern, Locale locale) you're using calls initializeCalendar(locale); In the initializeCalendar method implementation we can see : calendar = Calendar.getInstance(TimeZone.getDefault(), loc); What the setTimezone method does : calendar.setTimeZone(zone); So I guess the default implementation uses Timezone.getDefault(), at least in this version of the OpenJDK, so yes, the both methods you mentioned result in the same.

http://stackoverflow.com/q/25956775
has comment: http://stackoverflow.com/comment/69236809
score: 3
tagged with: converters
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40641345
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/26087835
has body: I need to convert HTML to RTF, and I am using this code: private static String convertToRTF(String htmlStr) { OutputStream os = new ByteArrayOutputStream(); HTMLEditorKit htmlEditorKit = new HTMLEditorKit(); RTFEditorKit rtfEditorKit = new RTFEditorKit(); String rtfStr = null; htmlStr = htmlStr.replaceAll("<br.*?>", "#NEW_LINE#"); htmlStr = htmlStr.replaceAll(" ", "#NEW_LINE#"); htmlStr = htmlStr.replaceAll("<p.*?>", ""); InputStream is = new ByteArrayInputStream(htmlStr.getBytes()); try { Document doc = htmlEditorKit.createDefaultDocument(); htmlEditorKit.read(is, doc, 0); rtfEditorKit.write(os, doc, 0, doc.getLength()); rtfStr = os.toString(); rtfStr = rtfStr.replaceAll("#NEW_LINE#", "\\\\par "); } catch (IOException e) { e.printStackTrace(); } catch (BadLocationException e) { e.printStackTrace(); } return rtfStr; } The problem is when I try to convert HTML that had bullets or numbers like this: one two This is the HTML: one two And this the convert result: onetwo RTF: {\rtf1\ansi {\fonttbl\f0\fnil Monospaced;\f1\fnil 'Segoe UI';} \par \f1 one\f1 two\par \par } How can I convert the numbers and bullets?
tagged with: java
has title: Convert HTML to RTF in java?
downvote count: 1
tagged with: rtf
type: Question
has comment: http://stackoverflow.com/comment/40641297
has comment: http://stackoverflow.com/comment/40638774
has comment: http://stackoverflow.com/comment/40640835
linked to: http://stackoverflow.com/q/3755230
has comment: http://stackoverflow.com/comment/40640639
has comment: http://stackoverflow.com/comment/40901941
upvote count: 4

http://stackoverflow.com/a/25903342
has body: Simple for iteration can do this. Notably, however, this requires that the array is non-jagged (array[i].length == array[0].length for all i in range). If this isn't the case it could still be valid, but the problem becomes a bit more interesting.... fixing... public static boolean isAmazingArray(int[][] array) { final int VALID_VAL = 15; //Check Rows - handle jagged rows without issue for (int[] row : array) { int a = 0; for(int i : row) {a += i;} if(a != VALID_VAL) return false; //Found a bad row } //Check Cols - handle jagged-ness by finding max length row first. int maxRowLength = 0; for(int[] i : array){ maxRowLength = Math.max(maxRowLength, i.length); } //Init array to hold running sum for each column int[] colSums = new int[maxRowLength]; for(int r = 0; r &lt; array.length; r++){ for(int c = 0; c &lt; array[r].length; c++){ //Add value to its corresponding column sum colSums[c] += array[r][c]; } } for(int i : colSums){ //Found bad column if(i != VALID_VAL) return false; } //No invalid rows/cols found return true; }
has comment: http://stackoverflow.com/comment/40543733
score: 0
answers question: http://stackoverflow.com/q/25903261
type: Answer

http://stackoverflow.com/comment/40521878
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25891361
type: Comment
has text: The communication is happening locally on one device or over internet? That's important to know before making security considerations.

loops
tags question: http://stackoverflow.com/q/25987918
tags question: http://stackoverflow.com/q/25905063
tags question: http://stackoverflow.com/q/25984349
tags question: http://stackoverflow.com/q/26000418
tags question: http://stackoverflow.com/q/25919774
tags question: http://stackoverflow.com/q/25901442
tags question: http://stackoverflow.com/q/25881597
tags question: http://stackoverflow.com/q/25969010
tags question: http://stackoverflow.com/q/25937705
tags question: http://stackoverflow.com/q/25881008
tags question: http://stackoverflow.com/q/25904970
tags question: http://stackoverflow.com/q/25994191
tags question: http://stackoverflow.com/q/26008293
tags question: http://stackoverflow.com/q/25895119
tags question: http://stackoverflow.com/q/25926598
type: Tag
tags question: http://stackoverflow.com/q/26008882
tags question: http://stackoverflow.com/q/26022150
tags question: http://stackoverflow.com/q/25949495
tags question: http://stackoverflow.com/q/25986904
tags question: http://stackoverflow.com/q/25998286
tag name: loops
tags question: http://stackoverflow.com/q/26032461
tags question: http://stackoverflow.com/q/25965294
tags question: http://stackoverflow.com/q/25954176
tags question: http://stackoverflow.com/q/25968933
tags question: http://stackoverflow.com/q/26006543
tags question: http://stackoverflow.com/q/25973061
tags question: http://stackoverflow.com/q/25922932
tags question: http://stackoverflow.com/q/25940999
tags question: http://stackoverflow.com/q/26021030
tags question: http://stackoverflow.com/q/25923229
tags question: http://stackoverflow.com/q/25967177
tags question: http://stackoverflow.com/q/25956756
tags question: http://stackoverflow.com/q/25994766
tags question: http://stackoverflow.com/q/25956222

http://stackoverflow.com/q/25954495
has answer: http://stackoverflow.com/a/45196448
has answer: http://stackoverflow.com/a/43302663
has answer: http://stackoverflow.com/a/25954556
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/61190638
has answer: http://stackoverflow.com/a/25954638
has answer: http://stackoverflow.com/a/25954629
has comment: http://stackoverflow.com/comment/40634441
tagged with: java
has answer: http://stackoverflow.com/a/55189784
type: Question
has answer: http://stackoverflow.com/a/42827668
has answer: http://stackoverflow.com/a/25954600
has comment: http://stackoverflow.com/comment/40634459
has comment: http://stackoverflow.com/comment/40636457
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/64287825
downvote count: 1
answer count: 10
favorite count: 0
has body: I want to take two strings and alternate the characters into a new string using a for method. Example: "two" and "one" Result: "townoe" This is what I have so far, and I really don't know how to finish it. public class Alternator { String alternate(String a, String b) { String s = ""; for (int i = 0; i &lt; a.length(); i++) { s += i; System.out.println(s); } return null; } }
has title: Alternating characters of two different inputs

http://stackoverflow.com/comment/40710233
has text: at the time of conversion AidStr is empty ... AsyncTask.execute() is not blocking call it will **not** wait until doInBackground is finished ...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25995806
score: 1

http://stackoverflow.com/a/26015986
has comment: http://stackoverflow.com/comment/40750706
has comment: http://stackoverflow.com/comment/40746461
score: 2
answers question: http://stackoverflow.com/q/26015953
downvote count: 0
has comment: http://stackoverflow.com/comment/40746540
has comment: http://stackoverflow.com/comment/40746646
has comment: http://stackoverflow.com/comment/40746521
has comment: http://stackoverflow.com/comment/40753132
has comment: http://stackoverflow.com/comment/40746763
upvote count: 2
has body: Short answer: you have to rewrite the long-running method so that it checks, for instance, some global boolean or the interrupted flag. As per assylias suggestion in the comments below, you could for instance do while (!isInterrupted()) { ... }. If your long-running method is in the middle of some (well behaved) blocking call, then you will want to interrupt the thread, to make it return early from the blocking call, so that you can check the condition to see if it's time to terminate.
has comment: http://stackoverflow.com/comment/40746735
has comment: http://stackoverflow.com/comment/40750399
type: Answer

oracle11g
tags question: http://stackoverflow.com/q/25881353
type: Tag
tags question: http://stackoverflow.com/q/25974982
tags question: http://stackoverflow.com/q/26021400
tag name: oracle11g
tags question: http://stackoverflow.com/q/26007464
tags question: http://stackoverflow.com/q/26019214
tags question: http://stackoverflow.com/q/25931426

http://stackoverflow.com/q/25990886
has answer: http://stackoverflow.com/a/26098507
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/71544037
has answer: http://stackoverflow.com/a/64314559
tagged with: flying-saucer
tagged with: css
has comment: http://stackoverflow.com/comment/40816553
has answer: http://stackoverflow.com/a/26157256
has title: External CSS in Flying Saucer
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/65192174
upvote count: 7
type: Question
has comment: http://stackoverflow.com/comment/40820987
has comment: http://stackoverflow.com/comment/40701894
has comment: http://stackoverflow.com/comment/40701344
has answer: http://stackoverflow.com/a/53198036
answer count: 6
has body: I would like to know how to include the External CSS in Flying-Saucer.Before that THB I checked with all the available links in StackOverflow but they are not helpful.That's the reason why made this one my self. TestCSS.xhtml renamed version of TestCSS.html.So content of them are same. Below (Image 1 ) is the Structure of my Project in Eclipse IDE.If I run the TestCSS.html it will give the page result as Image 2 in Browser. Below are Code which are not working as External CSS : This one Working : This one NOT Working : This one NOT Working : This one NOT Working : I tried with all the ways including absolute path of css inside of the xhtml also.but css is not getting applied.Please help me to fix the problem. Image 1 Image 2 RedCSS.css .fontClass { color : red; } TestCSS.html This Should come assss Red Java Code : public static void main(String[] args) throws Exception{ // Path of Input File String inputFile = "C:\\Users\\Joseph.M\\WorkPlace_Struts2\\Fly-Sauccer-Web\\WebContent\\TestCSS.xhtml"; // Path of Output File String outputFile = "C:\\Users\\Joseph.M\\WorkPlace_Struts2\\Fly-Sauccer-Web\\output.pdf"; OutputStream os = new FileOutputStream(outputFile); ITextRenderer renderer = new ITextRenderer(); DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputStream is = new ByteArrayInputStream(FileUtils.readFileToByteArray(new File(inputFile))); Document doc = builder.parse(is); is.close(); renderer.setDocument(doc,null); renderer.layout(); renderer.createPDF(os); os.close(); }
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40915811
comment on: http://stackoverflow.com/q/26031924
has text: So, parse the JSON into Lists/Maps, update as needed, serialize back to JSON. There are easily a dozen JSON kits to choose from at json.org. (You are correct that Jackson is probably not the best choice for this job. Something simple like org.json is probably better.)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40572853
comment on: http://stackoverflow.com/a/25919020
type: AnswerComment
has text: Thank you for the swift response. Now I understood. But how I can recognize the outcome of the switch statement?
type: Comment
score: 1

http://stackoverflow.com/a/25878784
has body: You need to use brackets to delimite the ambit of IF and IF ELSE import java.util.Scanner; public class P4 { public static void main(String[] args) { // TODO Auto-generated method stub double grossSalary, interestIncome, capitalGains, totalIncome, adjustedIncome, totalTax, stateTax; int exemptions; Scanner input = new Scanner(System.in); System.out.print("Gross Salary: "); grossSalary = input.nextDouble(); System.out.print("Number of Exemptions: "); exemptions = input.nextInt(); System.out.print("Interest Income: "); interestIncome = input.nextDouble(); System.out.print("Capital Gains: "); capitalGains = input.nextDouble(); totalIncome = grossSalary + interestIncome + capitalGains; adjustedIncome = totalIncome - (exemptions * 1800.0); if ((adjustedIncome &gt;= 0.0 &amp;&amp; adjustedIncome &lt; 10000.0)) { stateTax = adjustedIncome * .06; totalTax = 0.0 + stateTax; } else if (adjustedIncome &gt;= 10000.0 &amp;&amp; adjustedIncome &lt; 25000.0) { stateTax = adjustedIncome * .06; totalTax = (adjustedIncome * .15) + stateTax; } else if (adjustedIncome &gt;= 25000.0 &amp;&amp; adjustedIncome &lt; 36000) { stateTax = adjustedIncome * .06; totalTax = (adjustedIncome * .25) + stateTax; } else if (adjustedIncome &gt;= 36000.0) { stateTax = adjustedIncome * .06; totalTax = (adjustedIncome * .28) + stateTax; } System.out.printf("Total Income: $ %.2f", totalIncome); System.out.println(); System.out.printf("Adjusted Income: $ %.2f", adjustedIncome); System.out.println(); System.out.printf("Total Tax: $ %.2f", totalTax); System.out.println(); System.out.printf("State Tax: $ %.2f", stateTax); } }
answers question: http://stackoverflow.com/q/25878744
type: Answer
score: 0

http://stackoverflow.com/q/25937820
linked to: http://stackoverflow.com/q/7374363
has body: I am facing this exception while doing some database handling. I am getting this error when i am calling the loadCouSpinnerData function. I tried running the app after commenting the db.loadCouSpinnerData, it runs perfectly then .If someone could help me out that would be great! Thanks! Cheers! This is my log. 09-19 11:16:46.830: E/AndroidRuntime(1234): FATAL EXCEPTION: main 09-19 11:16:46.830: E/AndroidRuntime(1234): Process: com.project.attendancemanager, PID: 1234 09-19 11:16:46.830: E/AndroidRuntime(1234): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.project.attendancemanager/com.project.attendancemanager.TakeAttendance}: java.lang.NullPointerException 09-19 11:16:46.830: E/AndroidRuntime(1234): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 09-19 11:16:46.830: E/AndroidRuntime(1234): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 09-19 11:16:46.830: E/AndroidRuntime(1234): at android.app.ActivityThread.access$800(ActivityThread.java:135) 09-19 11:16:46.830: E/AndroidRuntime(1234): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 09-19 11:16:46.830: E/AndroidRuntime(1234): at android.os.Handler.dispatchMessage(Handler.java:102) 09-19 11:16:46.830: E/AndroidRuntime(1234): at android.os.Looper.loop(Looper.java:136) 09-19 11:16:46.830: E/AndroidRuntime(1234): at android.app.ActivityThread.main(ActivityThread.java:5017) 09-19 11:16:46.830: E/AndroidRuntime(1234): at java.lang.reflect.Method.invokeNative(Native Method) 09-19 11:16:46.830: E/AndroidRuntime(1234): at java.lang.reflect.Method.invoke(Method.java:515) 09-19 11:16:46.830: E/AndroidRuntime(1234): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 09-19 11:16:46.830: E/AndroidRuntime(1234): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 09-19 11:16:46.830: E/AndroidRuntime(1234): at dalvik.system.NativeStart.main(Native Method) 09-19 11:16:46.830: E/An…
has title: Unable to start activity ComponentInfo{ } java.lang.NullPointerException
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/40606197
tagged with: android
has comment: http://stackoverflow.com/comment/40606258
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40606251

http://stackoverflow.com/a/25899281
score: 2
accepted answer of: http://stackoverflow.com/q/25899219
upvote count: 2
answers question: http://stackoverflow.com/q/25899219
has comment: http://stackoverflow.com/comment/40536402
has body: You can set both texts to a single string and then set it, like this: mUserAgeRetrieved.setText(Html.fromHtml("&lt;b&gt;" + "Age:" + "&lt;/b&gt;" + String.valueOf(objects.get(i).getInt("UserAge"))));
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40536464
type: Answer
has comment: http://stackoverflow.com/comment/40536210

http://stackoverflow.com/comment/40609708
has text: @LeonardoJines Where did you define the connection access data (username+passowrd)? If you did it in the ear archive, have you tried to move it in Glassfish and use the DataSource via JNDI?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25935889

http://stackoverflow.com/comment/40633789
comment on: http://stackoverflow.com/q/25953376
type: QuestionComment
type: Comment
score: 0
has text: You should probably make a class `Animal` and add attributes for name, current population, growth rate, and so forth. Then put all of them into a `List` or `Map` and conveniently iterate over them or look them up.

http://stackoverflow.com/q/25993682
type: UnansweredQuestion
has body: I have the following code: for (int i = 0; i &lt; dataStrings.length; i++) { TextView tv1 = new TextView(this); tv1.setTextSize(TEXT_SIZE); tv1.setTypeface(Typeface.MONOSPACE); tv1.setText(dataStrings[i]); dynamicLL.addView(tv1); } Basically, i am creating some amount of TextView's dynamically (the amount is unknown). I want each TextView to have its own OnLongClickListener. My question is how do I give each TextView its own unique OnLongClickListener when the TextViews are generated in this way, and how do I handle the clicks once the listener has been created?
has answer: http://stackoverflow.com/a/25993798
tagged with: android
favorite count: 0
type: Question
answer count: 1
score: 0
tagged with: java
upvote count: 1
downvote count: 1
has title: Handling many dynamically created TextView's

http://stackoverflow.com/comment/51329645
type: QuestionComment
comment on: http://stackoverflow.com/q/25946044
has text: You need to rework the indentation :|
score: 0
type: Comment

http://stackoverflow.com/q/26016838
accepted answer: http://stackoverflow.com/a/26097822
has title: How do I make the grid lines in a JavaFX TableView stay sharp?
type: Question
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/26097822
answer count: 1
score: 0
tagged with: javafx-8
has body: The code below creates a TableView with enough columns to require a horizontal scroll bar. Initially the grid lines in the TableView have a width of one pixel and because of this are sharp. Scroll to the far right of the TableView and all of a sudden the grid lines have a width of two pixels, one lighter than the other. This makes the grid lines look blurry. It is probably caused by JavaFX thinking the grid lines are at a fractional point (after the scrolling) rather than exactly on the pixel and so blending the grid line with it's surroundings. How do I tell JavaFX not to do this? Can I change the scroll so that it only ever chooses exact pixel boundaries? Thanks. In the code below I change the grid line colour to red (using css) to make it obvious, however the same problem occurs if the default colour is used. import javafx.application.Application; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class TableTest4 extends Application { @Override public void start(Stage stage) throws Exception { BorderPane borderPane = new BorderPane(); Scene scene = new Scene(borderPane, 500, 500); String cssFile = getClass().getResource("tabletest4.css").toExternalForm(); scene.getStylesheets().add(cssFile); stage.setScene(scene); TableView&lt;Integer&gt; table = new TableView&lt;&gt;(); ObservableList&lt;Integer&gt; data = FXCollections.observableArrayList(); for (int i = 0; i &lt; 20; i++) { data.add(i); } table.setItems(data); for (int i = 0; i &lt; 20; i++) { String text = ""; if (i % 2 == 0) { text = "sdfd"; } else if (i % 3 == 0) { text = "dghg hghj"; } else if (i == 17) { text = "This Hopppsdssss"; } TableColumn&lt;Integer,String&gt; column = new TableColumn&lt;&gt;(Integer.toString(i) + " " + text); column.setCe…
tagged with: javafx-2
type: AnsweredQuestion

http://stackoverflow.com/q/25911906
possible better answer: http://stackoverflow.com/a/25915294
tagged with: google-bigquery
type: Question
has answer: http://stackoverflow.com/a/25915294
answer count: 2
downvote count: 0
has body: We are working with Google BigQuery (using Java) for one of our cloud solution and facing lot of issues in development. Our observations and issues as follows - We are using Query Jobs (Example: jobs().insert()/jobs().query() method first and then tablesdata().list() for data) for data retrieval. The Job execution taking 2-3 seconds (we had data in MBs only right now). We looked into sample codes on code.google.com and github.com and tried to implement them. However, we are not able to achieve fast execution than 2-3 seconds. What is the fast way to retrieve data from BigQuery tables? Is there a way to improvise Job execution speed? If yes, Can you provide links for sample codes? In our screens, we need to fetch data from different tables (different queries) and display them. So, we inserted multiple query jobs and total execution time getting summed-up (Example: if we had two jobs (i.e. two queries), it takes 6-7 seconds). In Google documentation it has been mentioned that, we can run concurrent Jobs. Is there any sample code available for this? Waiting for your valuable responses.
favorite count: 0
has title: BigQuery performance and Running concurrent jobs
tagged with: google-app-engine
upvote count: 1
has answer: http://stackoverflow.com/a/25912585
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25912585

http://stackoverflow.com/a/26027740
has body: Have you thought about running against a Selenium Grid instead? See https://code.google.com/p/selenium/wiki/Grid2
type: Answer
answers question: http://stackoverflow.com/q/26018790
score: 0

http://stackoverflow.com/q/25989823
has answer: http://stackoverflow.com/a/25989951
has comment: http://stackoverflow.com/comment/40699448
answer count: 4
accepted answer: http://stackoverflow.com/a/25990215
type: AnsweredQuestion
upvote count: 2
has title: How hashmap works with Integer as keys
type: Question
has comment: http://stackoverflow.com/comment/40699213
possible better answer: http://stackoverflow.com/a/25989950
tagged with: java
has answer: http://stackoverflow.com/a/25989950
linked to: http://stackoverflow.com/q/17910377
has answer: http://stackoverflow.com/a/25990215
score: 2
linked to: http://stackoverflow.com/q/2817695
linked to: http://stackoverflow.com/q/20762912
downvote count: 0
has answer: http://stackoverflow.com/a/25990013
has body: Map&lt;Integer,String&gt; m1 = new HashMap&lt;&gt;(); m1.put(5, "gfd"); m1.put(1,"sandy"); m1.put(3, "abc"); m1.put(2, "def"); m1.put(1, "ijk"); m1.put(10, "bcd"); m1.put(0, "ssdfsd"); When I Print the map, the output is {0=ssdfsd, 1=ijk, 2=def, 3=abc, 5=gfd, 10=bcd}. But, how the output is in sorted order even though I have used HashMap()??
has comment: http://stackoverflow.com/comment/40699477
favorite count: 0
duplicate of: http://stackoverflow.com/q/20762912

http://stackoverflow.com/comment/40686273
type: AnswerComment
has text: wiki.eclipse.org is for Jetty 7 and 8. not jetty 9. (as it says at the top of the wiki)
type: Comment
comment on: http://stackoverflow.com/a/25943743
score: 0

http://stackoverflow.com/comment/40751434
type: Comment
has text: Yes, you should build this on top of OSGi and not by trying to re-invent the wheel
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26017836

http://stackoverflow.com/comment/40576968
type: QuestionComment
comment on: http://stackoverflow.com/q/25920962
score: 0
type: Comment
has text: I edited my post, also I'm using spring boot framework.

http://stackoverflow.com/q/25912574
downvote count: 0
has comment: http://stackoverflow.com/comment/40783281
favorite count: 0
has title: How to validate the url action mapping of Struts 1 in Filter
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41044837
upvote count: 1
has comment: http://stackoverflow.com/comment/40661630
has comment: http://stackoverflow.com/comment/41012630
has comment: http://stackoverflow.com/comment/41042825
has answer: http://stackoverflow.com/a/26178699
score: 1
tagged with: java
has body: Please can somebody help me out,I need to verify the url action mapping of struts 1 on Filter level.If the provided url action mapping exist in Struts1 then it is ok otherwise show 404 error. This code show 404 page but i need to validate url before showing it: p_hsResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
has comment: http://stackoverflow.com/comment/40793301
tagged with: struts-1
type: Question
tagged with: jakarta-ee
answer count: 1
tagged with: struts
has comment: http://stackoverflow.com/comment/41008044
has comment: http://stackoverflow.com/comment/41042846
tagged with: struts-config
has comment: http://stackoverflow.com/comment/40790439
has comment: http://stackoverflow.com/comment/41215948

http://stackoverflow.com/comment/40560925
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25912850
type: AnswerComment
has text: it's `Double.parseDouble`, not `double.parseDouble`. It's part of the default Java framework `java.lang.Double`

http://stackoverflow.com/comment/40720398
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26001398
has text: the file is within: src/Code/testing.txt,
score: 0

http://stackoverflow.com/a/25997134
has comment: http://stackoverflow.com/comment/40714575
score: 0
accepted answer of: http://stackoverflow.com/q/25995969
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40714297
has body: I had to use try/catch to avoid the exception from interrupting the program: public void read() { try { Scanner scanner = new Scanner (new File("data.in")); while (scanner.hasNextLine()) { System.out.println(scanner.nextLine()); } } catch(IOException ex) { ex.printStackTrace(); } } In this case, this works also with: "C:\\Users\\...\\Desktop\\data.in" "/Users/.../Desktop/data.in" "data.in"(if it's in the root folder)
type: Answer
has comment: http://stackoverflow.com/comment/40713744
answers question: http://stackoverflow.com/q/25995969

http://stackoverflow.com/q/26022150
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/26022181
has body: I want to show progress in progress bar in java GUI, but the progress don't show anything until the process is done. this is my try: public void selectTweet(){ Connection conn = null; Statement stmt = null; try{ Class.forName("com.mysql.jdbc.Driver"); conn = Drive rManager.getConnection(DB_URL, USER, PASS); stmt = conn.createStatement(); //menghitung jumlah query pada table tweet String sql = "SELECT COUNT(*) FROM tweet"; ResultSet rs=stmt.executeQuery(sql); int row = 0; while(rs.next()){ row = rs.getInt("COUNT(*)"); } int initial_number = Integer.parseInt(jTextField4.getText()); for(int i=initial_number;i&lt;row;i++){ System.out.println("tweet ke-"+i); String sql1 = "SELECT tweet,date,location FROM tweet WHERE tweet_id='"+i+"'"; ResultSet rs2 = stmt.executeQuery(sql1); while(rs2.next()){ tweet = rs2.getString("tweet"); date = rs2.getString("date"); location = rs2.getString("location"); } System.out.println("Tweet: " + tweet); removeStopWords(tweet, i, date, location); final int currentValue = i; try{ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jProgressBar1.setValue(currentValue); } }); java.lang.Thread.sleep(100); }catch (InterruptedException e) { //JOptionPane.showMessageDialog(frame, e.getMessage()); } } }catch(SQLException se){ //Handle errors for JDBC se.printStackTrace(); }catch(Exception e){ //Handle errors for Class.forName e.printStackTrace(); }finally{ //finally block used to close resources try{ if(stmt!=null) conn.close(); }catch(SQLException se){}// do nothing try{ if(conn!=null) conn.close(); }catch(SQLException se){ se.printStackTrace(); }//end finally try }//end try } what i want to do is remove stopwords in string records from database, there are 5000 records, then i want to use progressbar to show the process, but it's not working. what i missed?, help me please.
score: 0
answer count: 2
tagged with: progress
type: UnansweredQuestion
tagged with: process
has title: How to use progress bar in java?
has answer: http://stackoverflow.com/a/26026425
tagged with: java

http://stackoverflow.com/q/25945613
has answer: http://stackoverflow.com/a/58361190
type: Question
upvote count: 7
has answer: http://stackoverflow.com/a/34391318
has answer: http://stackoverflow.com/a/25945639
has comment: http://stackoverflow.com/comment/40619971
favorite count: 0
has answer: http://stackoverflow.com/a/25945732
accepted answer: http://stackoverflow.com/a/25945732
has body: I am using a viewpager control to host three fragments.I have placed a button in each fragment to go to the next fragment.So i wanted to know as how to go from one fragment to another using intent? The main purpose is to create a sign up form which has been divided into three fragments.The code is shown below: The main activity: package pl.looksok.viewpagerdemo; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; public class MainActivity extends FragmentActivity { ViewPager pager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MyPagerAdapter pageAdapter = new MyPagerAdapter(getSupportFragmentManager()); pager = (ViewPager)findViewById(R.id.myViewPager); pager.setAdapter(pageAdapter); } } The first fragment: package pl.looksok.viewpagerdemo; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.support.v4.app.Fragment; public class FragmentBlue extends Fragment { Button btnnext1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_blue, container, false); btnnext1=(Button) view.findViewById(R.id.btnnext1); btnnext1.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(), FragmentGreen.class); view.getContext().startActivity(intent); getActivity().finish(); } }); return view; } } The second fragment: package pl.looksok.viewpagerdemo; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import a…
tagged with: android
answer count: 4
downvote count: 0
has title: Using intent to call a fragment from another fragment
possible better answer: http://stackoverflow.com/a/25945639
tagged with: android-intent
type: AnsweredQuestion
tagged with: android-fragments
score: 7
tagged with: java

http://stackoverflow.com/comment/40524646
comment on: http://stackoverflow.com/q/25891221
has text: @AndreiI, feel free to add it as an answer, I'll upvote any useful hint ;)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40515476
type: Comment
type: QuestionComment
has text: [This answer](http://stackoverflow.com/a/25041329/113848) might help.
comment on: http://stackoverflow.com/q/25887993
score: 0

http://stackoverflow.com/comment/40574798
type: Comment
has text: Sorry my java skill is very bad. If you want to aswer the question, you can upload your code too.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25920223

http://stackoverflow.com/q/26031724
has comment: http://stackoverflow.com/comment/40775843
favorite count: 0
has body: As my understanding, if I am thread then: When I call notify()/notifyAll() it means means I am sending a signal to other thread which are waiting on this object monitor. Am I right? But What the wait() means? Am I sending signal to other thread to wait so that I can complete my work on it? Or I am declaring that I will wait, You do your work and tell me when you are done.? I have a little concept about threads
has comment: http://stackoverflow.com/comment/40775553
has comment: http://stackoverflow.com/comment/40775650
downvote count: 1
has answer: http://stackoverflow.com/a/26031739
has comment: http://stackoverflow.com/comment/40775536
has comment: http://stackoverflow.com/comment/40775506
tagged with: multithreading
type: AnsweredQuestion
score: 1
has title: What Wait() Actually means in Java ? I will Wait or You Wait?
tagged with: java
tagged with: notify
possible better answer: http://stackoverflow.com/a/26031786
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/26031786
accepted answer: http://stackoverflow.com/a/26031739
tagged with: wait

http://stackoverflow.com/comment/40772829
has text: I tried this... On the fourth line (intent.putExtra("sms_body", TextView.getText().toString());) I could not find the getText() method. All I see related is getTextColor() and getTextColors().
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26010285

http://stackoverflow.com/a/29153189
type: AcceptedAnswer
type: Answer
has body: See this article javaee-api You maybe have transitive dependency of javaee-api in your project.
accepted answer of: http://stackoverflow.com/q/25874896
answers question: http://stackoverflow.com/q/25874896
score: 0

http://stackoverflow.com/comment/40739635
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26011802
score: 0
has text: @StephaneM, why don't make it an answer?

http://stackoverflow.com/q/26030222
has answer: http://stackoverflow.com/a/26030362
upvote count: 0
has comment: http://stackoverflow.com/comment/40773045
has body: I have an activity with a listview of installed apps and other items, but i have created layout programmatically, the adapter needs to be used in a ListActivity &amp; it is necessary to give listview this id "@android:id/list in xml but i have no xml used. When i add a listview to layout, it force closes the app. Any ideas what to do?
tagged with: listactivity
favorite count: 0
has answer: http://stackoverflow.com/a/26030345
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/26030276
type: UnansweredQuestion
downvote count: 3
score: -3
has title: Android : Need help in an Activity extending ListActivity
type: Question
tagged with: java

http://stackoverflow.com/comment/40771975
comment on: http://stackoverflow.com/a/26029661
has text: Well making it static gives the following error on the return line: Cannot make a static reference to the non-static field vowels How would you write the instance?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26031896
has comment: http://stackoverflow.com/comment/40780376
type: AcceptedAnswer
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/40785582
answers question: http://stackoverflow.com/q/26031383
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26031383
has comment: http://stackoverflow.com/comment/40782577
downvote count: 0
has body: Without a runnable example, I can't be 100% sure, but I would guess that setting the RowSorter each time you change the filter text is causing the table to be re-sorted. Instead, set a TableRowSorter when you create the JTable and simply update the filter, for example... import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.RowFilter; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; public class TableFilter { public static void main(String[] args) { new TableFilter(); } private JTable table; private JComboBox filterBy; private JTextField filterText; public TableFilter() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } DefaultTableModel model = new DefaultTableModel(new Object[]{"Code", "Description"}, 0); model.addRow(new Object[]{"A001", "Holidays"}); model.addRow(new Object[]{"B001", "Sick"}); model.addRow(new Object[]{"A002", "Zombitse"}); model.addRow(new Object[]{"C001", "Crazy bin"}); model.addRow(new Object[]{"C002", "Postal"}); model.addRow(new Object[]{"D002", "Job Interview"}); model.addRow(new Object[]{"D004", "it's sunny outside"}); table = new JTable(model); table.setRowSorter(new TableRowSorter&lt;TableModel&gt;(model)); JPanel filterPane = new JPanel(new GridBagLayout()); filterBy = …

http://stackoverflow.com/comment/40567822
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25916638
has text: Have you added your preferences from resources, prior to calling `findPreference()`? Like this: http://stackoverflow.com/questions/14339550/preferencefragment-findpreference-always-returns-null
type: Comment

http://stackoverflow.com/q/25908988
has comment: http://stackoverflow.com/comment/40556349
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40555702
tagged with: java
has body: My goal is to use hadoop for task distribution of an embarrassingly parallel problem, but with computationally expensive tasks. Each task is typically a sequence of dependent byte code to be executed on a specific VM. The idea is to run this byte code in parallel where each mapper will behave as an independent VM. The reduce phase will be used for communication and merging purposes -- always through a VM --. Data will be shared among different nodes using a distributed-cache. Hope I was clear til now. Here comes the problem: The input to my Map-Reduce problem is a byte code file with at most 1Mb of size, As far as I know Hadoop is not well suited for that. It is up to me to split my ( super small ) file in order to guarantee load balancing. The splits are not supposed to have the same size, but +/- the same complexity. The complexity of my tasks comes from the amount of data it is processing, which might be of order of several Gbs. Here comes the questions Might hadoop (Map-reduce in general) be configured to run well in such circumstances ? Is it possible to configure the way we define Splits to be more workload-centric and not size-centric ? Thank you guys in advance. Kind regards
tagged with: task
type: Question
tagged with: hadoop
has title: task distribution in hadoop
score: 0
answer count: 0

http://stackoverflow.com/comment/40620060
has text: listFragment is a id for Fragment container. So you have to add one FrameLayout in one xml file with id of listFragment for add fragment in that layout.
type: AnswerComment
comment on: http://stackoverflow.com/a/25945639
type: Comment
score: 2

http://stackoverflow.com/a/43630451
has comment: http://stackoverflow.com/comment/125757212
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25990920
has comment: http://stackoverflow.com/comment/129018534
has body: As Nine said "getValuesAs() method only supports classes that extends JsonValue" Here it is my work around (and the only possible) for this problem: private static List&lt;String&gt; toList(JsonArray json){ List&lt;String&gt; list = new ArrayList&lt;String&gt;(); if (json != null){ for (JsonString elm: json.getValuesAs(JsonString.class)){ list.add(elm.getString()); } } return list; }

http://stackoverflow.com/comment/40690255
comment on: http://stackoverflow.com/a/25922802
type: AnswerComment
score: 0
has text: None of my tests have this problem, see update, it MUST be something in you code that you're not showing us
type: Comment

http://stackoverflow.com/q/25928893
upvote count: 6
accepted answer: http://stackoverflow.com/a/25929367
score: 4
tagged with: multithreading
downvote count: 2
linked to: http://stackoverflow.com/q/40480
possible better answer: http://stackoverflow.com/a/25929322
has answer: http://stackoverflow.com/a/25929322
tagged with: java
has answer: http://stackoverflow.com/a/25929153
answer count: 5
has answer: http://stackoverflow.com/a/25929345
has answer: http://stackoverflow.com/a/25929367
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25928971
favorite count: 0
has title: How to return value from thread (java)
type: Question
has body: I made a thread like this one bellow: public class MyThread implements Runnable { private int temp; public MyThread(int temp){ this.temp=temp; } @Override public void run() { temp+=10; return; } public int getTemp() { return temp; } } but when i try to use temp by getTemp i get 0 class Main { MyThread foo = new MyThread(10); Thread a = new Thread(foo); a.start(); int aa = foo.getTemp(); System.out.println(aa); } i just want to use the calculation i did in thread to be stored in some variables for later use.

http://stackoverflow.com/q/26004708
tagged with: mysql
tagged with: label
score: 0
has comment: http://stackoverflow.com/comment/40736993
has comment: http://stackoverflow.com/comment/40727741
tagged with: rpc
has comment: http://stackoverflow.com/comment/40735366
has body: So I have this Label "books" that has all books names, and every book has chapters... so I have another label for the chapters. I want that when a book and a chapter are chosen, an RPC call will launch and get from the data base the chapter of the book the user wanted ! books.addChangeHandler(new ChangeHandler(){ @Override public void onChange(ChangeEvent event) { int i; int selectedChapter = books.getSelectedIndex(); if(selectedChapter != -1) { chapters.clear(); for(i=0;i&lt;bookChapters[selectedChapter];i++) { chapters.addItem("Chapter" + (i+1)); } } } }); RPC: Here I call for Book 1 Chapter 1 and it works. //Book //Chapter rpcService.getChapterTxt(1, 1, new AsyncCallback&lt;List&lt;BibleTxt&gt;&gt;(){ public void onFailure(Throwable caught) { Window.alert("Failed getting Chapter"); } public void onSuccess(List&lt;BibleTxt&gt; result) { int i = 0 ; String verseText =""; //Label verseLabel = new Label(); PPanel chapterPar = new PPanel(); HTML page= new HTML(verseText); for(i=0;i&lt;result.size();i++) { verseText = result.get(i).getVerseText(); //verseLabel.setText(verseText); page.setText(page.getText() + verseText); } chapterPar.add(page); p.add(chapterPar); } }); How do I use the RPC call in the Handler above ?
has title: Gwt and MySql with RPC calls
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/40728830
has comment: http://stackoverflow.com/comment/40736011
tagged with: java

http://stackoverflow.com/q/25885737
has body: I have a label in JavaFX application that i need to apply a double underline too. I know this aint possible to do with a basic property, but instead i have applied the following css to the label, which gives it a "effect" of a double underline .double-underline { -fx-border-color: #FFFFFF; -fx-border-width: 0 0 1 0; -fx-underline: true; } Now this does give me the effect i want, but i need to if possible, increase the spacing between the text and the actual underline. How can i do this? This would be easier if there was a "double" border style that i could apply, but there isnt that i know of Here is what it looks like now and i would like it too look more like this Thanks in advance
has comment: http://stackoverflow.com/comment/40513249
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25887558
accepted answer: http://stackoverflow.com/a/25887558
tagged with: css
tagged with: javafx-2
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: javafx
has title: JavaFX Text Double Underline Spacing
type: Question
tagged with: java
upvote count: 2

http://stackoverflow.com/a/26098438
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26014807
has body: Without any sample code, it would just be guesses. If it's a container div and contains more elements inside, you may want to use any element located at the bottom to check if its visible.

http://stackoverflow.com/comment/40659619
type: Comment
has text: Thanks Simo, Output: "Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: In-use connections equal max-pool-size and expired max-wait-time. Cannot allocate more connections". ds variable is referenced from pool by "@Resource(name="BP", type = javax.sql.DataSource.class)"
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25966839

http://stackoverflow.com/comment/41003405
has text: @AndreaLigios could you share your experience with this problem? So that other people with the same question get more details?
comment on: http://stackoverflow.com/q/25891221
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40660894
type: QuestionComment
score: 0
has text: *Read :* [Updating an Android Activity from a Background Thread](http://cogitolearning.co.uk/?p=793)
comment on: http://stackoverflow.com/q/25967744
type: Comment

http://stackoverflow.com/q/26007030
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/31107000
has comment: http://stackoverflow.com/comment/40730819
tagged with: visual-studio-cordova
type: UnansweredQuestion
tagged with: oracle-database
has body: Opening a sample Javascript project created by Microsoft, I get the error message: "Oracle Java SDK A more recent version of this software is required" I click on requirements link, then I accept Oracles download requirements. I download the x86 version (per Microsoft), though I have the newest 64-bit machine. I run it but no change, same error message. What am I missing in this process? Thanks for your help.
has comment: http://stackoverflow.com/comment/40731759
has comment: http://stackoverflow.com/comment/40730993
tagged with: visual-studio-2013
tagged with: java
type: Question
has title: Visual Studio 2013 Enterprise: Oracle Java SDK A more recent version of this software is required
tagged with: javascript
has answer: http://stackoverflow.com/a/27113659
has answer: http://stackoverflow.com/a/30673124

http://stackoverflow.com/comment/40747479
comment on: http://stackoverflow.com/q/26005706
type: Comment
has text: You can look at log cat. Just install the app and run it while the phone's connected, and you should be able to see log cat messages.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40506333
score: 2
comment on: http://stackoverflow.com/q/25882697
has text: Assuming they work (and they look fine), it almost certainly doesn't matter. They'll both be `O(n log n)` and (generally) perform worse then a Quicksort for most purposes. And once you see how much worse you'll wonder why you spent so much time perfecting your merge sort.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25940384
tagged with: spring-data-elasticsearch
type: Question
tagged with: elasticsearch
has answer: http://stackoverflow.com/a/25996050
score: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25996050
has title: Elasticsearch grab all but limit to a certain number with Java API
type: AnsweredQuestion
has body: There isnt an example online with the Java API to show how to limit the rows that come back from a search with ElasticSearch for all items. I tried the Filter Limit but it just wouldnt work because it would bring back more then the limit. I know its per shard to, but is there no way around this. I cant find the from/size query/filter either in the Java API SearchQuery searchQuery = startQuery(limit, null).build(); Iterable&lt;Statement&gt; iterableStatements = esSpringDataRepository.search(searchQuery); if (iterableStatements != null) { return IteratorUtils.toList(iterableStatements.iterator()); } private NativeSearchQueryBuilder startQuery(int limit, QueryBuilder query) { NativeSearchQueryBuilder searchQueryBuilder = new NativeSearchQueryBuilder(); if(query != null) { searchQueryBuilder = searchQueryBuilder.withQuery(query); } if(limit &gt; 0) { searchQueryBuilder = searchQueryBuilder.withFilter(FilterBuilders.limitFilter(limit)); } return searchQueryBuilder; }

http://stackoverflow.com/q/25948512
score: 0
accepted answer: http://stackoverflow.com/a/25959478
answer count: 3
tagged with: button
has title: Android: Change a Button's text in a Dialog
tagged with: nullpointerexception
tagged with: android
has body: I have in my Android App a Dialog which contains beside other things a Button. Now I want to change the text of that Button, but I get a NullPointer Exception. The Button opens up a new Dialog (Datepicker) which gives the MainActivity a date (as a String) which I want then to use for the Button. Obviously I can declare the button and define him, but not interact. Within the try-statement (not sure whether it is a statement) the first line worked, but if I have the second line not commented and call it it crashes (or calls an exception, I added the try part later). I hope this is specific enough. Here is the code from the button, the MainActivity and the Dialog the button lives in: Dialog (.java) public class CreateDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstance) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater layoutInflater = getActivity().getLayoutInflater(); builder.setView(layoutInflater.inflate(R.layout.dialog_create, null)) .setMessage(R.string.create) .setPositiveButton(R.string.create, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); return builder.create(); } } Dialog (.xml) &lt;?xml version="1.0" encoding = "utf-8"?&gt; &lt;RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android" xmlns:tools = "http://schemas.android.com/tools" android:id = "@+id/dialog_create" android:layout_width = "match_parent" android:layout_height = "match_parent" android:background="@color/create_bg_1" tools:context = ".CreateDialogFragment"&gt; &lt;EditText android:id = "@+id/dialog_create_name" android:layout_width = "match_parent" android:layout_height = "@dimen/textFieldHight" android:text = "@string/create_name" android:background="@color/white" android…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25959478
tagged with: java
has answer: http://stackoverflow.com/a/25948577
type: Question
tagged with: dialog
possible better answer: http://stackoverflow.com/a/25948607
has answer: http://stackoverflow.com/a/25948607

http://stackoverflow.com/a/25937704
accepted answer of: http://stackoverflow.com/q/25936712
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/94641870
has comment: http://stackoverflow.com/comment/94641702
answers question: http://stackoverflow.com/q/25936712
has comment: http://stackoverflow.com/comment/94641306
type: Answer
score: 34
has comment: http://stackoverflow.com/comment/90870385
upvote count: 35
has comment: http://stackoverflow.com/comment/94641571
has comment: http://stackoverflow.com/comment/79981900
has comment: http://stackoverflow.com/comment/54828180
has body: Yes, open JDK8 is reference implementation for JAVA SE8. The official Reference Implementations for Java SE 8 (JSR 337) are based solely upon open-source code available from the JDK 8 Project in the OpenJDK Community. Binaries are provided for both the Linux x64 and Windows i586 platforms and Compact Profiles for Linux i586. The binaries are available under two different licenses: The GNU General Public License version 2, with the Classpath Exception and the Oracle Binary Code License . For a given platform the binaries under different licenses are built from exactly the same source code and are functionally equivalent; the only real difference is the license itself. Which license you choose will depend upon your particular business and legal requirements. Source: http://jdk.java.net/java-se-ri/8

http://stackoverflow.com/a/25955318
score: 0
type: Answer
has body: from the JavaDocs of the javax.mail.Authenticator http://docs.oracle.com/javaee/6/api/javax/mail/Authenticator.html#getPasswordAuthentication%28%29 Called when password authentication is needed. Subclasses should override the default implementation, which returns null. When the provider needs to know a username or password, it calls back to the getPasswordAuthentication() method in your SMTPAuthenticator subclass of Authenticator. This returns a PasswordAuthentication object: @Override protected PasswordAuthentication getPasswordAuthentication(){....}
has comment: http://stackoverflow.com/comment/40636015
answers question: http://stackoverflow.com/q/25955149

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

http://stackoverflow.com/a/25893218
type: Answer
answers question: http://stackoverflow.com/q/25893078
score: 0
has body: This is because the default modifier of a class is package-private, meaning it is visible only by classes in the same package. You can simply make CantFly a public class defined in its own Java file. CantFly is not nested inside the Fly interface, so you would need to call its constructor using new CantFly() instead of new Fly.CantFly().
has comment: http://stackoverflow.com/comment/40533550

http://stackoverflow.com/q/25883403
type: UnansweredQuestion
upvote count: 4
downvote count: 0
has title: java.sql.SQLException: No operations allowed after connection closed
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/42593858
type: Question
has answer: http://stackoverflow.com/a/25890203
has comment: http://stackoverflow.com/comment/40520074
tagged with: jsp
has body: I have build an application, maintained with session. It uses JDBC &amp; mysql. When the application is deployed on server (Apache Tomcat 6). I can log in and log out of the session. Works totally fine. Now I keep the server running for next 24 hrs. And now on the next day I try to log in into the system after entering the credentials, on clicking the Login button I get the error on web page as below: (what is the cause for this?) Http status 500 exception org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 11 9: Connection con =ConnectionProvider.getConnection(); 10: System.out.println("con "+con); 11: con.setAutoCommit(false); 12: Statement st = con.createStatement(); 13: ResultSet rs; 14: rs = st.executeQuery("select * from ejduge_login where uname='" + userid + "' and pass='" + pwd +"'"); Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) root cause javax.servlet.ServletException: java.sql.SQLException: No operations allowed after connection closed. org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779) org.apache.jsp.login_jsp._jspService(login_jsp.java:97) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) root cause jav…
score: 4
has comment: http://stackoverflow.com/comment/40507377
answer count: 3
tagged with: jdbc
favorite count: 0
has answer: http://stackoverflow.com/a/25883521

http://stackoverflow.com/q/25895530
upvote count: 1
type: AnsweredQuestion
has title: How let Derby Network Server show detailed log?
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: derby
has answer: http://stackoverflow.com/a/25991439
favorite count: 0
tagged with: javadb
has body: I use the Derby in client/server way and I start the server, and there is a derby.log shows in my directory. But I want to know the details about the server's process, there is any way to let the Derby to show the detail log？ In the derby.log, there just have a litter information about the Derby start and shut down. The Derby is implemented entirely in Java, so I think there must have print the log like log.info|log.debug|log.error, if there is some way?
accepted answer: http://stackoverflow.com/a/25991439

http://stackoverflow.com/comment/40542167
has text: I have made it an answer.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25902481

http://stackoverflow.com/a/25972084
has body: SimpleDateFormat.format expects a Date, not an int. The method you're using, which is the overloaded version that accepts a long, is actually expecting milliseconds from the epoch, not an hour a minute or a second as you're doing. The right way of using it should be : SimpleDateFormat sdfHour = new SimpleDateFormat("HH:mm:ss"); String timeString = sdfHour.format(new Date()); Using "new Date()" as in this example, will give you the current time. If you need to format some other time (like one hour ago, or something from a database etc..) pass to "format" the right Date instance. If you need the separated, for some reason, then you can still use it, but this other way : SimpleDateFormat sdfHour = new SimpleDateFormat("HH"); SimpleDateFormat sdfMinute = new SimpleDateFormat("mm"); SimpleDateFormat sdfSecond = new SimpleDateFormat("ss"); Date now = new Date(); String string_hours = sdfHour.format(now); String string_minutes = sdfMinute.format(now); String string_seconds = sdfSecond.format(now);
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25972040
type: Answer
answers question: http://stackoverflow.com/q/25972040

http://stackoverflow.com/a/25898935
has body: The command means, inside the Poker.jar there are directories for games/cards/Poker.java... Don't confuse this with the paths needed to include the jar itself. java games.cards.Poker A. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java does not work because setting the classpath as /stuff/java sets the path to your directories/files but it will not go a step further to include your jar (and the classes inside it). B. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/*.jar does not work because it is not the correct syntax for including all the jar files in one directory. (Java 6 and higher) It should be /stuff/java/* D. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java same as A, including a higher level path does not include all the paths inside of it. E. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/*.jar same as B and A, incorrect syntax + won't include all the paths F. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/Poker.jar classpath here is pointing to the wrong directory for the jar C. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/Poker.jar This is finally finding the jar, which is in the correct directory. Resources http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html http://en.wikipedia.org/wiki/Classpath_(Java)
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25898117
answers question: http://stackoverflow.com/q/25898117
upvote count: 3
score: 3

http://stackoverflow.com/a/26055716
has body: add this to parent pom: <build> ... maven-javadoc-plugin 2.9.1 ... <build> solve problem
score: 0
answers question: http://stackoverflow.com/q/25971832
type: Answer

http://stackoverflow.com/comment/40661443
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25908715
type: AnswerComment
has text: `you will be able to import classes written in ProjectB which are defined in ProjectA`. Now that i look more to that i do not understand. "written in projectB" ? What would that be? Didn't you mean: "you will be able to import and use classes in ProjectB which are defined in ProjectA" ?

http://stackoverflow.com/q/25961735
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40650003
has comment: http://stackoverflow.com/comment/40649078
type: Question
has title: I got an error when using setOnClickListener
has comment: http://stackoverflow.com/comment/40647959
has comment: http://stackoverflow.com/comment/40649226
has comment: http://stackoverflow.com/comment/40649287
has answer: http://stackoverflow.com/a/25964445
has body: I got the program to crash when using the simple code below as it is closed automatically after installing it package com.zaki.thenewboston; 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.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; public class MainActivity extends ActionBarActivity { int counter; Button add,sub; //used to reference to xml view ids TextView display; //used to reference to xml view ids @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(); } //zaki: this is to wait the R.layout.activity_main to load first other wise the program may crash counter =0; add = (Button) findViewById(R.id.bAdd); // sub = (Button) findViewById(R.id.bSub); display = (TextView) findViewById(R.id.tvDisplay); add.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter ++; display.setText("Your total is" + counter); } }); /* sub.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter --; display.setText("Your total is" + counter); } });*/ } @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 An…
possible better answer: http://stackoverflow.com/a/25962553
has comment: http://stackoverflow.com/comment/40649479
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40650129
has answer: http://stackoverflow.com/a/25962553
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40651937
has comment: http://stackoverflow.com/comment/40647976
has comment: http://stackoverflow.com/comment/40649250
has comment: http://stackoverflow.com/comment/40647838
linked to: http://stackoverflow.com/q/23653778
accepted answer: http://stackoverflow.com/a/25964445
has comment: http://stackoverflow.com/comment/40648332
tagged with: android
duplicate of: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/40649389

http://stackoverflow.com/a/26007722
type: Answer
has body: We have the same problem and we temporarily solved this issue by explicitly specify Maven Javadoc Plugin version to 2.9.1
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/25971832
downvote count: 0

http://stackoverflow.com/comment/40744755
comment on: http://stackoverflow.com/q/26015078
type: Comment
type: QuestionComment
score: 2
has text: `this.add(t);` should probably be `this.add(new JScrollPane(t));`..

http://stackoverflow.com/q/25917828
accepted answer: http://stackoverflow.com/a/26108114
has title: dcm4che: occasional unexpected message ID in DIMSE RSP?
type: AnsweredQuestion
tagged with: java
tagged with: dcm4che
type: Question
score: 0
tagged with: dicom
answer count: 1
has answer: http://stackoverflow.com/a/26108114
has body: I'm a newbie in programming with dcm4che2 libraries and I'm writing a simple program to query a PACS server, by setting Query/Retrieve Level to Patient/Series/Image. The code is very simple and, in some cases, it works fine: dcmqr.setCalledAET("AET_REMOTE", true); dcmqr.setRemoteHost("aa.bb.cc.dd"); dcmqr.setRemotePort(xxxx); dcmqr.getKeys(); dcmqr.setDateTimeMatching(true); dcmqr.setCFind(true); dcmqr.setCGet(false); dcmqr.configureTransferCapability(true); dcmqr.setQueryLevel(DcmQR.QueryRetrieveLevel.IMAGE); dcmqr.addMatchingKey(new int[]{Tag.PatientName},sPatientName); dcmqr.addMatchingKey(new int[]{Tag.Modality},sModality); dcmqr.addMatchingKey(new int[]{Tag.AccessionNumber},sAccession); dcmqr.addMatchingKey(new int[]{Tag.SeriesNumber},sSeriesNumber); dcmqr.addReturnKey(new int[]{Tag.SeriesDescription}); dcmqr.addReturnKey(new int[]{Tag.StudyDescription}); dcmqr.addReturnKey(new int[]{Tag.PatientBirthDate}); dcmqr.addReturnKey(new int[]{Tag.PatientSex}); List&lt;DicomObject&gt; result = null; try{ dcmqr.start(); dcmqr.open(); result = dcmqr.query(); dcmqr.stop(); dcmqr.close(); } catch(Exception e){ ... } However in some cases (and whenever I set Query/Retrieve Level to "Image"), the query() method fails ("unexpected message ID in DIMSE RSP") and an A-Abort command is thrown, as reported below: ... [main] INFO org.dcm4che2.net.PDUEncoder - AET_REMOTE(1) &lt;&lt; 3:C-FIND-RQ[pcid=1, prior=0 cuid=xyz/Study Root Query/Retrieve Information Model - FIND ts=xyz/Implicit VR Little Endian] [AE_TITLE_X] INFO org.dcm4che2.net.PDUDecoder - AET_REMOTE(1) &gt;&gt; 2:C-FIND-RSP[ pcid=1, status=0H cuid=xyz/Study Root Query/Retrieve Information Model - FIND] [main] INFO org.dcm4che2.tool.dcmqr.DcmQR - Send Query Request #3/15 using .../Study Root Query/Retrieve Information Model - FIND: (0008,0052) CS #6 [IMAGE] Query/Retrieve Level (0008,0060) CS #2 [CT] Modality (0010,0010) PN #12 [xxx^yyyy] PatientÆs Name (0020,000D) UI #42 [x.y.z.zyx...] Study Instance UID (0020,000E) UI #5…

http://stackoverflow.com/a/25937933
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40609216
has comment: http://stackoverflow.com/comment/40660959
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25937046
has body: Basically, ρяσѕρєя K answered your question. Some extra details: you should never call doInBackground yourself. The whole point of AsyncTask is that it manages passing the work to the background worker thread and returning the results to the UI thread. What doInBackground returns is what onPostExecute receives as a parameter. Your onPostExecute should look like this: @Override protected void onPostExecute(String result) { MyBus.getInstance().post(new AsyncTaskResultEvent(result)); }
answers question: http://stackoverflow.com/q/25937046
has comment: http://stackoverflow.com/comment/40609324
has comment: http://stackoverflow.com/comment/40609720

http://stackoverflow.com/comment/40685898
type: Comment
has text: @user2040251 Thanks for the help, I found your answer useful.
type: AnswerComment
comment on: http://stackoverflow.com/a/25980344
score: 0

http://stackoverflow.com/comment/40570964
type: AnswerComment
comment on: http://stackoverflow.com/a/25918262
has text: is the syntax: type variable; BigInteger computeSaving ?
score: 0
type: Comment

http://stackoverflow.com/comment/40699253
type: AnswerComment
comment on: http://stackoverflow.com/a/25989857
type: Comment
has text: Beautiful, that's exactly what I thought. However, I get this error when trying to do so: "Cannot make a static reference to a non-static method blabla from super". Why must the method be static if it's being accessed by an object of its own type?
score: 0

http://stackoverflow.com/a/26003906
type: Answer
answers question: http://stackoverflow.com/q/26003801
score: 1
upvote count: 1
downvote count: 0
has body: Try changing your inflate method to this: public void inflate(String text) { LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View reminder = inflator.inflate(R.layout.reminder_layout, null); TextView reminderListTextView = (TextView)reminder.findViewById(R.id.reminderListTextView); reminderListTextView.setText(text); reminderTableScrollView.addView(reminder); } Without seeing your reminder_layout, I'm not certain, but I'm guessing the view with id reminderListTextView is in your reminder_layout.xml and not your activity_main.xml

http://stackoverflow.com/comment/40682563
type: QuestionComment
has text: Why do you set the `Host` header? This should be done by `HUC` AFAIK.
comment on: http://stackoverflow.com/q/25978928
score: 0
type: Comment

http://stackoverflow.com/q/25875114
favorite count: 0
has answer: http://stackoverflow.com/a/25875304
has comment: http://stackoverflow.com/comment/40492266
tagged with: regex
has body: I'm trying to write a regex that will identify whether a string has 2 or more consecutive commas. For example: hello,,457 ,,,,, dog,,,elephant,,,,, Can anyone help on what a valid regex would be?
type: AnsweredQuestion
tagged with: java
has title: Regex to match 2 or more commas
linked to: http://stackoverflow.com/q/275944
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25875304
possible better answer: http://stackoverflow.com/a/25875196
has answer: http://stackoverflow.com/a/25875185
has comment: http://stackoverflow.com/comment/40492285
has answer: http://stackoverflow.com/a/25875196
upvote count: 4
answer count: 3
score: 3
has comment: http://stackoverflow.com/comment/40537588
tagged with: string

custom-adapter
tags question: http://stackoverflow.com/q/26024974
tag name: custom-adapter
type: Tag

instantiation
type: Tag
tags question: http://stackoverflow.com/q/26005924
tags question: http://stackoverflow.com/q/25900547
tags question: http://stackoverflow.com/q/25945397
tag name: instantiation

http://stackoverflow.com/comment/40735055
comment on: http://stackoverflow.com/q/26008986
has text: @Rp, Is any chances of time zone issues?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25989395
tagged with: client-server
has body: Using org.restlet framework (with camel-restlet 2.12.3 but without camel) on the server side - everything works fine, but while waiting for requests which take longer than 60s the server seems to just return after 60s even though the request is still being worked on. Here is how the server is started: Restlet router = (Restlet) oSpring.getBean("ImportHandlerRouter"); Component component = new Component(); component.getServers().add(Protocol.HTTP, iPort); Context context = component.getContext().createChildContext(); FilterJsonp jsonp = new FilterJsonp(context); jsonp.setNext(router); component.getDefaultHost().attach(jsonp); component.start(); Debugging shows that the handle Restlet method is called again after 60s and the stack seems to show that it was a normal request, but I'm quite sure that the client doesn't actually re-request after 60s (testing client with completely different servers with longer requests works fine). Is seems like some system property or socket property or something similar, but I'm struggling with finding out where exactly to set those. Any idea on how to prevent the forced server's response after 60s? UPDATE: This seems to only happen while starting from Eclipse - starting in TOMCAT as separate WAR the calls are blocking.
tagged with: httpclient
has title: Java Restlet framework: long going requests return after 60s
has comment: http://stackoverflow.com/comment/40808417
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40829778
tagged with: timeout
tagged with: restlet

http://stackoverflow.com/comment/40597208
comment on: http://stackoverflow.com/q/25932578
score: 0
type: Comment
type: QuestionComment
has text: Just a tip: you can remove the "bindingFiles" configuration section entirely if you place all your binding files in src/jaxws! They will then be picked up by the jaxws-maven-plugin automatically.

http://stackoverflow.com/comment/40573661
type: QuestionComment
comment on: http://stackoverflow.com/q/25919428
has text: Is that better? I'm trying to generate the class's own super class. In particular see the code snippet's comment.
score: 0
type: Comment

regex
tags question: http://stackoverflow.com/q/25931053
tags question: http://stackoverflow.com/q/26010013
tags question: http://stackoverflow.com/q/25960888
tags question: http://stackoverflow.com/q/25875114
tags question: http://stackoverflow.com/q/25927047
tags question: http://stackoverflow.com/q/25927242
tags question: http://stackoverflow.com/q/25885095
tags question: http://stackoverflow.com/q/25986002
tags question: http://stackoverflow.com/q/25955445
tags question: http://stackoverflow.com/q/25950888
tags question: http://stackoverflow.com/q/25997559
tags question: http://stackoverflow.com/q/26009591
tags question: http://stackoverflow.com/q/25989198
tags question: http://stackoverflow.com/q/25944831
tags question: http://stackoverflow.com/q/25996495
tag name: regex
tags question: http://stackoverflow.com/q/25926404
tags question: http://stackoverflow.com/q/25912439
tags question: http://stackoverflow.com/q/25876420
tags question: http://stackoverflow.com/q/25934715
tags question: http://stackoverflow.com/q/26023073
tags question: http://stackoverflow.com/q/25987623
tags question: http://stackoverflow.com/q/25998991
tags question: http://stackoverflow.com/q/26027423
tags question: http://stackoverflow.com/q/26010846
tags question: http://stackoverflow.com/q/25926961
tags question: http://stackoverflow.com/q/25956629
tags question: http://stackoverflow.com/q/26001856
tags question: http://stackoverflow.com/q/25977160
tags question: http://stackoverflow.com/q/25975263
tags question: http://stackoverflow.com/q/25976315
tags question: http://stackoverflow.com/q/25931091
tags question: http://stackoverflow.com/q/25976777
tags question: http://stackoverflow.com/q/25911106
tags question: http://stackoverflow.com/q/25873636
tags question: http://stackoverflow.com/q/25941087
tags question: http://stackoverflow.com/q/25931309
tags question: http://stackoverflow.com/q/25904346
tags question: http://stackoverflow.com/q/25882689
tags question: http://stackoverflow.com/q/25911090
tags question: http://stackoverflow.com/q/25935749
tags question: http://stackoverflow.com/q/25972946
tags question: http://stackoverflow.com/q/26026913
tags question: http://stackoverflow.com/q/26026561
tags question: http://stackoverflow.com/q/26010162
tags question: http://stackoverflow.com/q/25925785
tags question: http://stackoverflow.com/q/26011619
tags question: http://stackoverflow.com/q/25901550
tags question: http://stackoverflow.com/q/25894820
tags question: http://stackoverflow.com/q/25978643
tags question: http://stackoverflow.com/q/25990222
tags question: http://stackoverflow.com/q/25926115
tags question: http://stackoverflow.com/q/25997876
tags question: http://stackoverflow.com/q/25962934
tags question: http://stackoverflow.com/q/26019422
tags question: http://stackoverflow.com/q/26010410
tags question: http://stackoverflow.com/q/25881697
tags question: http://stackoverflow.com/q/26032100
tags question: http://stackoverflow.com/q/25968211
tags question: http://stackoverflow.com/q/25972829
tags question: http://stackoverflow.com/q/25937226
tags question: http://stackoverflow.com/q/25956448
tags question: http://stackoverflow.com/q/25875359
tags question: http://stackoverflow.com/q/26005150
tags question: http://stackoverflow.com/q/25944371
tags question: http://stackoverflow.com/q/25941989
tags question: http://stackoverflow.com/q/25892323
tags question: http://stackoverflow.com/q/25995817
tags question: http://stackoverflow.com/q/25883306
tags question: http://stackoverflow.com/q/25926740
tags question: http://stackoverflow.com/q/25944782
tags question: http://stackoverflow.com/q/25890144
tags question: http://stackoverflow.com/q/25914113
tags question: http://stackoverflow.com/q/25903489
tags question: http://stackoverflow.com/q/26023902
tags question: http://stackoverflow.com/q/25996144
tags question: http://stackoverflow.com/q/25947134
tags question: http://stackoverflow.com/q/25937609
tags question: http://stackoverflow.com/q/25884647
tags question: http://stackoverflow.com/q/26002455

http://stackoverflow.com/comment/40601703
type: QuestionComment
comment on: http://stackoverflow.com/q/25935308
has text: Since we have no idea which date-picker you're using (there are many and you haven't specified), your best bet is to look it up in their documentation. If you can't find anything, then contact support on the website from which you downloaded your date-picker.
score: 0
type: Comment

eclipse-luna
tags question: http://stackoverflow.com/q/25910341
tags question: http://stackoverflow.com/q/26017793
tag name: eclipse-luna
tags question: http://stackoverflow.com/q/25900319
tags question: http://stackoverflow.com/q/25952482
tags question: http://stackoverflow.com/q/26012244
type: Tag

http://stackoverflow.com/a/25959746
type: AcceptedAnswer
score: 0
has body: String is an Object. In order to compare its value, not its memory address, use String.equals(String); How do I compare strings in Java?
type: Answer
accepted answer of: http://stackoverflow.com/q/25959537
answers question: http://stackoverflow.com/q/25959537

http://stackoverflow.com/q/25931640
upvote count: 1
accepted answer: http://stackoverflow.com/a/25932096
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: servlets
type: Question
tagged with: jstl
downvote count: 0
tagged with: jsp
has body: I have a in my jsp which has a <spring:bind> tag. <spring:bind path="mailListRequest.offSeason"> <select name="<c:out value="${status.expression}" />" id="<c:out value="${status.expression}" />"> Select <c:forEach var="t" begin="2" step="1" end="5"> <option value="<c:out value="${t} star"/>" <c:if test="${status.value eq t}"> selected</c:if>><c:out value="${t} star"/> </c:forEach> boutique hotels </spring:bind> "mailListRequest.offSeason" is a string on the server side (Java). The goal here is to iterate in the <c:forEach..> loop variable "t". Therefore the iteration will be 2,3,4,5;and in the I've made each iteration return a value with the string/word star in front of it therefore the output would be 2 star, 3 star, 4 star.... The Issue: The issue is that whenever I choose one of the options in the <c:forEach> loop or the option "botique hotels " I keep getting an error in my JSP: Error javax.servlet.jsp.JspTagException: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${status.value eq t}": An exception occured trying to convert String "2 star" to type "java.lang.Long" (null). Which puzzles me because "mailListRequest.offSeason" is set as a string and the values in my options are String values(I PRESUME). Perhaps it's the <option value="<c:out value="${t} star"/> I'm formatting wrong.
has answer: http://stackoverflow.com/a/25932096
answer count: 1
favorite count: 0
has title: JSP trying to convert String to Long

inheritance
tags question: http://stackoverflow.com/q/25897876
tags question: http://stackoverflow.com/q/25891022
tags question: http://stackoverflow.com/q/25995948
tags question: http://stackoverflow.com/q/25931472
tag name: inheritance
tags question: http://stackoverflow.com/q/25969519
tags question: http://stackoverflow.com/q/26024350
tags question: http://stackoverflow.com/q/25880426
tags question: http://stackoverflow.com/q/25979405
tags question: http://stackoverflow.com/q/26011964
tags question: http://stackoverflow.com/q/25901393
type: Tag
tags question: http://stackoverflow.com/q/25989744
tags question: http://stackoverflow.com/q/25922423
tags question: http://stackoverflow.com/q/25916796
tags question: http://stackoverflow.com/q/25991377
tags question: http://stackoverflow.com/q/25922205
tags question: http://stackoverflow.com/q/25932076
tags question: http://stackoverflow.com/q/25960818
tags question: http://stackoverflow.com/q/25926518
tags question: http://stackoverflow.com/q/25882180
tags question: http://stackoverflow.com/q/25944310
tags question: http://stackoverflow.com/q/25926671
tags question: http://stackoverflow.com/q/25961653
tags question: http://stackoverflow.com/q/25938519
tags question: http://stackoverflow.com/q/25941744
tags question: http://stackoverflow.com/q/25979102
tags question: http://stackoverflow.com/q/25876085
tags question: http://stackoverflow.com/q/25972299
tags question: http://stackoverflow.com/q/25964475
tags question: http://stackoverflow.com/q/25974526
tags question: http://stackoverflow.com/q/25908905

http://stackoverflow.com/comment/40574759
comment on: http://stackoverflow.com/q/25920223
score: 0
type: Comment
type: QuestionComment
has text: read [this](http://stackoverflow.com/q/6115896/773623)

http://stackoverflow.com/a/25923259
has body: Your logic is incorrect; any choice will always be either not equal to "p" or not equal to "n". You want to loop only if it's not "p" and it's not "n". Use &amp;&amp;: while(choice.equalsIgnoreCase("p") == false &amp;&amp; choice.equalsIgnoreCase("n") == false);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40580274
type: Answer
accepted answer of: http://stackoverflow.com/q/25923229
has comment: http://stackoverflow.com/comment/40580303
upvote count: 4
has comment: http://stackoverflow.com/comment/40580331
score: 4
answers question: http://stackoverflow.com/q/25923229

http://stackoverflow.com/a/25907108
has comment: http://stackoverflow.com/comment/40550281
has comment: http://stackoverflow.com/comment/40550181
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25907081
upvote count: 2
has body: Your main method is empty. So nothing happens: public static void main(String args[]){ } Probably you want to create a method but you just created a code block here: private double sum = 0.0;{ for(int i=0;i&lt;1001;i++){ Num = i; if(i % 3 == 0.0){ sum += i; if(i % 5 == 0.0){ if(i % 3 != 0.0){ sum += i; } } } } Now even this code may work once you create an object of your class in main method. Because this code block will execute on object creation. I can't explain all the basics in this answer about code structure. But this is maybe what you want: public class PrimeSum { public static void main(String args[]){ PrimeSum obj = new PrimeSum(); // creating an instance of your class will trigger the instance code block } private double Num= 0.0; private double sum = 0.0;{ for(int i=0;i&lt;1001;i++){ Num = i; if(i % 3 == 0.0){ sum += i; if(i % 5 == 0.0){ if(i % 3 != 0.0){ sum += i; } } } } System.out.println("The total is "+ sum); } }
score: 2

http://stackoverflow.com/q/25921275
has comment: http://stackoverflow.com/comment/40576963
tagged with: sql
downvote count: 1
has answer: http://stackoverflow.com/a/25921373
has answer: http://stackoverflow.com/a/25921346
accepted answer: http://stackoverflow.com/a/25921424
has title: Loading MySQL table into a text file?
favorite count: 0
has comment: http://stackoverflow.com/comment/40576995
possible better answer: http://stackoverflow.com/a/25921373
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40576934
has answer: http://stackoverflow.com/a/25921424
type: AnsweredQuestion
upvote count: 0
has body: It has been answered that how to load data from text file into SQL databases. However, I did not find any question regarding how to load table into text file. I am using JDBC and MySQL on my own PC. How can I load a table into a text file ? The data should be neatly organized like a matrix in the text file, including column names. Best regards to the people reading this question.
tagged with: java
tagged with: mysql
type: Question
tagged with: database
has comment: http://stackoverflow.com/comment/40576890
score: -1
answer count: 3

http://stackoverflow.com/comment/40533283
type: Comment
has text: Spring `4.1.0.RELEASE` and Spring-Data-mongodb `1.4.0.RELEASE`
type: QuestionComment
comment on: http://stackoverflow.com/q/25896605
score: 0

http://stackoverflow.com/comment/42381773
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25881674
type: AnswerComment
has text: Hey, did it work for you perfectly? I guess it worked since you accept this answer. I need some help on this similar issue.

http://stackoverflow.com/comment/40710964
score: 0
type: Comment
has text: increase the connection pools? glassfish is default 32
type: QuestionComment
comment on: http://stackoverflow.com/q/25996460

http://stackoverflow.com/comment/40594226
comment on: http://stackoverflow.com/a/25931069
type: AnswerComment
type: Comment
score: 0
has text: @JanØyvind you can edit your question and put what are you looking for(expected out put)

http://stackoverflow.com/q/25945942
type: Question
tagged with: google-maps
has answer: http://stackoverflow.com/a/25946459
has body: I'd like to "black out" certain locations on a google map in an android app. I'd like to be able to pull location information that would be loaded onto the screen, and just determine whether or not I want to load that segment of the map, or replace it with a black block. Is this supported by the maps api? Is there any way to make this work?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/25946459
type: AnsweredQuestion
has title: Black out area of Google Maps activity
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/41847780
type: AnswerComment
comment on: http://stackoverflow.com/a/26616708
score: 0
type: Comment
has text: PDFBox doesn't work with android anyway. There's a derived project from a guy, but that one is mostly to create PDFs, you can't render PDFs with that one.

http://stackoverflow.com/q/25934134
tagged with: static
has comment: http://stackoverflow.com/comment/40599932
type: Question
has comment: http://stackoverflow.com/comment/40599960
has comment: http://stackoverflow.com/comment/40599440
has answer: http://stackoverflow.com/a/25934265
has comment: http://stackoverflow.com/comment/40599237
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/40599431
has comment: http://stackoverflow.com/comment/40599556
answer count: 2
tagged with: language-features
has comment: http://stackoverflow.com/comment/40599858
tagged with: java
has body: As we know that in java 1.8 static methods are allowed in interfaces , I have seen some answers like static methods defined in interface from jdk 1 8 why did they need to do so but I am not satisfied. Furthermore I think it may cause problems like : public interface MyInterface{ public static void myMethod(); } class MyClass{ MyInterface.myMethod(); // since myMethod is static but a huge error is waiting for us here ? } But I still think there is a way out of this since this is added by professionals , so can anyone please explain how oracle solves this issue and what is the need to add this ? Thank you in adavance. I have not used java 1.8 so I never knew that static methods in java needs to be defined not just declared , I always thought of the Interfaces as a Pure Abstract Class I think that's why the idea of defining a method seemed strange to me . Thank you for your help ! .
has comment: http://stackoverflow.com/comment/40599360
accepted answer: http://stackoverflow.com/a/25934265
linked to: http://stackoverflow.com/q/25549208
possible better answer: http://stackoverflow.com/a/25934272
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25934272
has title: Static methods added in interfaces in java 1.8
favorite count: 0
has comment: http://stackoverflow.com/comment/40599299

http://stackoverflow.com/a/26014492
score: 21
upvote count: 21
has comment: http://stackoverflow.com/comment/63029936
has comment: http://stackoverflow.com/comment/40767917
has body: For that reason, I frequently use integers instead of enum type. Please don't do that. You can often choose a name for the parent class and the enum that actually helps the clarity of the code. class Page { enum Order { DOWN_THEN_OVER, OVER_THEN_DOWN; } } // Accessing: A little verbose but clear and efficient. Page.Order order = Page.Order.DOWN_THEN_OVER; You can also static import each enum you use but I prefer the verbosity above. import static com.oldcurmudgeon.test.Test.Order.DOWN_THEN_OVER; import static com.oldcurmudgeon.test.Test.Order.OVER_THEN_DOWN; public class Test { enum Order { DOWN_THEN_OVER, OVER_THEN_DOWN; } public void test() { Order pageOrder = DOWN_THEN_OVER; } } Obviously you cannot take this approach if the enum is private.
type: Answer
has comment: http://stackoverflow.com/comment/40766953
downvote count: 0
answers question: http://stackoverflow.com/q/26013755
has comment: http://stackoverflow.com/comment/40767762

jar
tags question: http://stackoverflow.com/q/25887431
tags question: http://stackoverflow.com/q/25999265
tags question: http://stackoverflow.com/q/25940975
tags question: http://stackoverflow.com/q/25941783
tags question: http://stackoverflow.com/q/25989068
tags question: http://stackoverflow.com/q/26033999
tags question: http://stackoverflow.com/q/25972910
tags question: http://stackoverflow.com/q/25875916
tags question: http://stackoverflow.com/q/25985091
tags question: http://stackoverflow.com/q/25994660
tags question: http://stackoverflow.com/q/25975893
tags question: http://stackoverflow.com/q/25921597
tags question: http://stackoverflow.com/q/25913946
tags question: http://stackoverflow.com/q/25893524
tags question: http://stackoverflow.com/q/25975988
tags question: http://stackoverflow.com/q/25985182
type: Tag
tags question: http://stackoverflow.com/q/25987088
tags question: http://stackoverflow.com/q/25898001
tags question: http://stackoverflow.com/q/25996464
tags question: http://stackoverflow.com/q/26014840
tags question: http://stackoverflow.com/q/25988538
tags question: http://stackoverflow.com/q/25995521
tags question: http://stackoverflow.com/q/26011607
tags question: http://stackoverflow.com/q/25994145
tags question: http://stackoverflow.com/q/25883483
tags question: http://stackoverflow.com/q/25960860
tags question: http://stackoverflow.com/q/25898254
tag name: jar
tags question: http://stackoverflow.com/q/25965177
tags question: http://stackoverflow.com/q/26031664
tags question: http://stackoverflow.com/q/26002682
tags question: http://stackoverflow.com/q/25983756
tags question: http://stackoverflow.com/q/25951295
tags question: http://stackoverflow.com/q/25934304
tags question: http://stackoverflow.com/q/26032739
tags question: http://stackoverflow.com/q/25882934
tags question: http://stackoverflow.com/q/25925228
tags question: http://stackoverflow.com/q/25981032
tags question: http://stackoverflow.com/q/25980547
tags question: http://stackoverflow.com/q/25992567
tags question: http://stackoverflow.com/q/25917448
tags question: http://stackoverflow.com/q/25893312
tags question: http://stackoverflow.com/q/25958030
tags question: http://stackoverflow.com/q/25911649
tags question: http://stackoverflow.com/q/25999277
tags question: http://stackoverflow.com/q/25899149
tags question: http://stackoverflow.com/q/26008447
tags question: http://stackoverflow.com/q/26001398

http://stackoverflow.com/a/52592326
has comment: http://stackoverflow.com/comment/92125655
answers question: http://stackoverflow.com/q/25938560
has body: Native solution in Java8 Date.from(ZonedDateTime.parse("1994-11-05T08:15:30+05:30").toInstant()) Date.from(ZonedDateTime.parse("1994-11-05T13:15:30Z").toInstant())
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/92175144
type: Answer
has comment: http://stackoverflow.com/comment/92175559
upvote count: 2

http://stackoverflow.com/comment/40619929
comment on: http://stackoverflow.com/q/25945474
score: 0
type: QuestionComment
type: Comment
has text: plz check double btw you have added any java library to your project?

http://stackoverflow.com/comment/40657446
comment on: http://stackoverflow.com/q/25966734
has text: what i should add up in the code to get that kind of output
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40511614
comment on: http://stackoverflow.com/q/25885634
score: 0
type: Comment
type: QuestionComment
has text: Is that really what you need? Not what the list contains?

http://stackoverflow.com/comment/40702069
type: Comment
comment on: http://stackoverflow.com/q/25977082
has text: Well.. was a bit too soon with my answer. The NamedNativeQuery approach resulted in this bug: http://jdevelopment.nl/hibernates-pure-native-scalar-queries-supported/ So I'm going for an @Embeddable class named Category.
score: 0
type: QuestionComment

http://stackoverflow.com/q/25976969
upvote count: 2
type: UnansweredQuestion
has title: How to turn on DDL transactional support?
tagged with: java
type: Question
has body: I just started using flywaydb and just for a test tried with create and insert queries and fired the migrate but it ignored all my create table scripts :( I used -X option for debug and found a strange line DEBUG: DDL Transactions Supported: false Seems if i made it true, it will work. Does anyone faced this issue, if yes how to get rid of this? i have did this on new schema, with clean-init-migrate Full stacktrace below: [ec2-user@ec2 flyway]$ ./flyway -X clean /usr/bin/tput Flyway (Command-line Tool) v.3.0 DEBUG: Adding location to classpath: /home/ec2-user/installables/flyway-3.0/bin/../jars/mysql-connector-java-5.1.26.jar Database: jdbc:mysql://0.0.0.0:3306/test (MySQL 5.5) DEBUG: DDL Transactions Supported: false DEBUG: Schema: test DEBUG: Cleaning schema `test` ... Cleaned schema `test` (execution time 00:00.025s) [ec2-user@ec2 flyway]$ [ec2-user@ec2 flyway]$ ./flyway -X init /usr/bin/tput Flyway (Command-line Tool) v.3.0 DEBUG: Adding location to classpath: /home/ec2-user/installables/flyway-3.0/bin/../jars/mysql-connector-java-5.1.26.jar Database: jdbc:mysql://0.0.0.0:3306/test (MySQL 5.5) DEBUG: DDL Transactions Supported: false DEBUG: Schema: test DEBUG: Schema `test` already exists. Skipping schema creation. Creating Metadata table: `test`.`schema_version` DEBUG: Found statement at line 17: CREATE TABLE `test`.`schema_version` ( `version_rank` INT NOT NULL, `installed_rank` INT NOT NULL, `version` VARCHAR(50) NOT NULL, `description` VARCHAR(200) NOT NULL, `type` VARCHAR(20) NOT NULL, `script` VARCHAR(1000) NOT NULL, `checksum` INT, `installed_by` VARCHAR(100) NOT NULL, `installed_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `execution_time` INT NOT NULL, `success` BOOL NOT NULL ) ENGINE=InnoDB DEBUG: Found statement at line 30: ALTER TABLE `test`.`schema_version` ADD CONSTRAINT `schema_version_pk` PRIMARY KEY (`version`) DEBUG: Found statement at line 32: CREATE INDEX `schema_version_vr_idx` ON `test`.`schema_version` (`version_rank`) DEBUG: Found st…
tagged with: version-control
downvote count: 0
tagged with: flyway
score: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25977686

http://stackoverflow.com/comment/40614824
comment on: http://stackoverflow.com/q/25942198
has text: `but something else is printed` - and what might that something else be?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25982370
favorite count: 0
has title: Easier way to assign numbers to letters
has answer: http://stackoverflow.com/a/25982405
answer count: 4
type: AnsweredQuestion
upvote count: 2
linked to: http://stackoverflow.com/q/10813154
has comment: http://stackoverflow.com/comment/40685790
downvote count: 1
has answer: http://stackoverflow.com/a/25982493
type: Question
has answer: http://stackoverflow.com/a/25982421
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25982469
accepted answer: http://stackoverflow.com/a/25982405
possible better answer: http://stackoverflow.com/a/25982493
has body: I am new to programming in java (and programming in general), and was wondering if there was an easier way to say this. Basically, I'm just trying to assign numbers to letters. This is the only way I know of how to do this, but I'm sure there's a much simpler way to do this in java. Thank you for any help the community can give me. Note: codeLetter is a char, and remainder is an int. if (remainder &lt;= 0) { codeLetter = 'A'; } else if (remainder &lt;= 1) { codeLetter = 'B'; } else if (remainder &lt;= 2) { codeLetter = 'C'; } else if (remainder &lt;= 3) { codeLetter = 'D'; } else if (remainder &lt;= 4) { codeLetter = 'E'; } etc...

http://stackoverflow.com/comment/40717865
type: Comment
type: QuestionComment
has text: What code do you have so far, where are the problems in it. And maybe a screenshot with it to see what is wrong could be helpfull
comment on: http://stackoverflow.com/q/26000070
score: 0

http://stackoverflow.com/comment/40777465
comment on: http://stackoverflow.com/q/26032634
score: 0
type: Comment
type: QuestionComment
has text: You can try to do this in several ways, example You can try to download user-defined picture, if its null you're downloading default picture ;)

http://stackoverflow.com/q/25996614
has comment: http://stackoverflow.com/comment/40711604
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/25997982
has body: I have a list of strings in the list assetList. How can I send the list in the http response in java servlet ? I am very new to java.
has answer: http://stackoverflow.com/a/25997794
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40711229
has comment: http://stackoverflow.com/comment/40711477
score: 3
has title: How to send a list of strings in http response?
has comment: http://stackoverflow.com/comment/40711384
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40711527
has answer: http://stackoverflow.com/a/25997206
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/10154477
linked to: http://stackoverflow.com/q/599161
has answer: http://stackoverflow.com/a/25996896
tagged with: httpresponse

http://stackoverflow.com/q/26022818
has title: How to prevent GWT from obfuscating code/Where to find the GWT Compiler
tagged with: google-chrome
type: Question
tagged with: gwt
accepted answer: http://stackoverflow.com/a/26024090
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40761056
tagged with: java
has comment: http://stackoverflow.com/comment/40761179
has body: I am currently working to find a bug in my code, and upon inspecting element on my browser (FF and GC), I found that the java source code is obfuscated by GWT in order to increase parse speed. From researching online, i found that: If you prefer not to have GWT obfuscate its output, then you can use the -style flag on the GWT Compiler. This flag has one of three possible values: OBF (for obfuscated), the default PRETTY, which makes the output readable to a human DETAILED, which improves on PRETTY with even more detail (such as very verbose variable names) I am wondering where I can find the GWT compiler.
answer count: 1
tagged with: javascript
score: 0
has answer: http://stackoverflow.com/a/26024090
has comment: http://stackoverflow.com/comment/40759499

http://stackoverflow.com/comment/40681779
score: 5
comment on: http://stackoverflow.com/q/25979974
type: Comment
type: QuestionComment
has text: `catch (NullPointerException ex) { System.out.println("Null Pointer Exception: Not enough data this time through"); }` ===> Never do that, you lose all the valuable information by ignoring the exception. Remove that catch block, let your code throw a NullPointerException, read the stack trace and fix the problem.

http://stackoverflow.com/q/26004108
downvote count: 1
has comment: http://stackoverflow.com/comment/40727339
upvote count: 0
has answer: http://stackoverflow.com/a/26004584
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/26013518
has comment: http://stackoverflow.com/comment/40725709
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40726848
type: Question
has body: I have a JTextField and inside the frame, I have setup some shortcuts for some buttons and menu items. Once I start typing in the JTextField, when I press any of the shortcuts, it is not working as the current focus is on the text field. How can i remove this. Below is my code so far. I have done it in netbeans. public class NewJFrame extends javax.swing.JFrame { public NewJFrame() { initComponents(); testTextField.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (!(Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE) || c == '.' || (c == KeyEvent.VK_PERIOD) || (c == KeyEvent.VK_DECIMAL))) { //JOptionPane.showMessageDialog(new JFrame(), "Only Numeric allowed"); e.consume(); } } }); testButton.setMnemonic(KeyEvent.VK_E); String keyCombination = "alt E"; KeyStroke keyStroke = KeyStroke.getKeyStroke(keyCombination); testTextField.getInputMap().put(keyStroke, keyCombination); testTextField.getActionMap().put(keyCombination, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { testButton.doClick(); } }); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jPanel1 = new javax.swing.JPanel(); testButton = new javax.swing.JButton(); testTextField = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setFocusTraversalPolicyProvider(true); getContentPane().setLayout(new java.awt.GridLayout()); jPanel1.setFocusCycleRoot(true); jPanel1.setLayout(new java.awt.GridBagLayout()); testButton.setText("Click"); testButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { testButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.g…
has comment: http://stackoverflow.com/comment/40725482
favorite count: 0
has title: Enable shortcuts in JTextField
has comment: http://stackoverflow.com/comment/40725689
answer count: 3
has answer: http://stackoverflow.com/a/26004359

http://stackoverflow.com/comment/40510775
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25885310
has text: I think when you do a lazy load hibernate do not even fetch that column. So if you want that to appear without fetching you should use native query.

http://stackoverflow.com/comment/40625719
type: QuestionComment
has text: `Skip` returns an `IEnumerable<char>` not a `string`
comment on: http://stackoverflow.com/q/25949478
score: 0
type: Comment

http://stackoverflow.com/a/26031490
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25958251
has body: As it turns out there was nothing wrong with the code or the library, but was an issue with android support lib. I finally found the solution here

http://stackoverflow.com/comment/40675666
type: Comment
type: QuestionComment
has text: Unfortunately I personally don't see a better alternative in the given situation, although there might be a better solution, I don't know what it is, sorry.
comment on: http://stackoverflow.com/q/25976590
score: 0

wifi
tag name: wifi
tags question: http://stackoverflow.com/q/26023866
type: Tag
tags question: http://stackoverflow.com/q/26032364

http://stackoverflow.com/q/25951742
accepted answer: http://stackoverflow.com/a/25951773
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40629204
tagged with: exception
answer count: 1
has answer: http://stackoverflow.com/a/25951773
has body: When the JVM throws and compilation error it prints out something like this in the console Error on line 3 in /Main.java:3: error: ';' expected System.out.print("Hello") ^ When throwing an Exception I am aware that I can get the line number from e.getStackTrace()[0].getLineNumber()); inside a try catch where e is an Exception but is there a way to get the column, so far I parse Errors with a regex looking for index of ^ on the third line. but have no way of figuring it out in case of an Exception.
has comment: http://stackoverflow.com/comment/40629195
has comment: http://stackoverflow.com/comment/40629383
type: AnsweredQuestion
has title: How can I extract column number from java exception

http://stackoverflow.com/q/25974338
tagged with: stanford-nlp
tagged with: pos-tagger
answer count: 1
has answer: http://stackoverflow.com/a/25992630
tagged with: arabic
has comment: http://stackoverflow.com/comment/68415743
favorite count: 0
has title: Arabic tagging using stanford pos tagger
has body: I am totally new to the world of NLP ,i need your help to get started in tagging arabic sentences using pretty Stanford pos tagger . I have installed a full version which contains two arabic trained taggers. please, guid me to apply this tagger in arabic using java and eclipse , what should i import? what should i add to models which functions and libraries to deal with arabic can this tagger give correct tags even if it is not in trained set. Actually , i have navigated the Stanford official website but it was not so helpful Thank you in advance
type: UnansweredQuestion
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/comment/40674352
comment on: http://stackoverflow.com/a/25976077
has text: Im using java -cp buz_messenger.jar com.svs.trade.server.buz_messenger
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25933793
downvote count: 4
has title: Regular expression in java how do I getting the below output
upvote count: 0
has comment: http://stackoverflow.com/comment/40598985
has comment: http://stackoverflow.com/comment/40598744
tagged with: java
type: Question
has body: I need a regular expression to extract content starts with href= to the end of bracket ].How do I do that in java. String s= [a href="http://myimagefactorycollection.files.wordpress.com/2014/09/ 2db83fcf95c5fc036a00abfb412f50e4.jpg"][a href="https://myimagefactorycollection.files.wordpress.com/2014/09/0e397a47f88e18f8fb91d17db18c7edd-copy.jpg"] The output should be "http://myimagefactorycollection.files.wordpress.com/2014/09/ 2db83fcf95c5fc036a00abfb412f50e4.jpg" "https://myimagefactorycollection.files.w ordpress.com/2014/09/0e397a47f88e18f8fb91d17db18c7edd-copy.jpg"
has comment: http://stackoverflow.com/comment/40598721
answer count: 1
has answer: http://stackoverflow.com/a/25933916
favorite count: 0
type: UnansweredQuestion
score: -4

http://stackoverflow.com/comment/40745735
has text: You are looking for a [BPEL Engine](http://en.wikipedia.org/wiki/Business_Process_Execution_Language).
comment on: http://stackoverflow.com/q/26015524
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40683569
type: Comment
comment on: http://stackoverflow.com/q/25980299
has text: I have edited it and it now shows the highlighted part,please help now
score: 0
type: QuestionComment

http://stackoverflow.com/q/25921799
tagged with: java
has body: i am new to swing in java. i am trying to add the drawing made by the paintComponent() method in my a frame through layeredPane but it is not showing in the JFrame However if i place the code frame.getContentPane().add(drawing) and comment the Layered part the code works.. what i am doing wrong? here is the code: frame class public class FrameTest extends JFrame { static JFrame frame= new JFrame("Frame"); public static void main(String[] args) { FrameTest test= new FrameTest (); } public FrameTest (){ this.openfrane(); frame.setVisible(true); frame.setLocationRelativeTo(null); } public void openframe(){ //window properties frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setSize(1000,600); frame.setResizable(false); //changing icon of window ImageIcon image = new ImageIcon("assets/icon.png"); card.setIconImage(image.getImage()); //label picture background JLabel background = new JLabel(); ImageIcon back = new ImageIcon("assets/background.jpg"); background.setIcon(back); background.setLocation(0,-125); background.setSize(1000,700); //label for first JLabel first = new JLabel("Sample text"); first.setForeground(Color.RED); first.setSize(500,200); first.setLocation(31, 150); Draw drawing = new Draw(); JLayeredPane layers = new JLayeredPane(); layers.add(drawing, new Integer(3)); layers.add(first, new Integer(2)); layers.add(background,new Integer(1)); frame.setLayeredPane(layers); } } draw class: public class Draw extends JPanel { public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); int startX = 00; int startY = 00; // First circle Ellipse2D circle1 = new Ellipse2D.Double(startX, startY, 30, 30); g2.setColor(Color.Black); g2.draw(circle1); g2.fill(circle1); // Second circle Ellipse2D circle2 = new Ellipse2D.Double(startX+20, startY, 30, 30); g2.setColor(Color.Black); g2.draw(circle2); g2.fill(circle2); } }
accepted answer: http://stackoverflow.com/a/25921937
type: Question
has title: Add drawing in layered plane java
score: 0
answer count: 1
tagged with: paintcomponent
has answer: http://stackoverflow.com/a/25921937
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/comment/40596656
has text: Yeah I was just driving up to 30 km/h and so the gps speed was not correct. But yesterday I drive 120 and the gps speed was 112 which is okay, I think. Anybody has an idea to handle slower speeds? In my Opinion I need to trigger the Location Manager to get the Location more often. But how can I do that?
comment on: http://stackoverflow.com/a/25893672
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40778641
type: Comment
type: QuestionComment
has text: Readfile is a custom class that loads a .txt into a string[] one line per string. That does work, I made sure of it.
comment on: http://stackoverflow.com/q/26033234
score: 0

http://stackoverflow.com/a/26042042
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26023866
score: 1
upvote count: 1
has body: Okay, I finally found the problem thanks to the suggestion from greenapps. Basically, it turns out that firewall was blocking any incoming connections to the java platform on my computer. To fix this: Open up control panel and search for windows firewall In the Windows Firewall with Advanced Security dialog box on the left, click "Inbound Rules" Browse through and see which applications are being blocked from receiving connections Select the application that you want to allow inbound connections for and right click it Select properties and press "Allow the connection" or "Allow the connection if secure"

http://stackoverflow.com/q/25920223
answer count: 2
linked to: http://stackoverflow.com/q/6115896
favorite count: 0
has comment: http://stackoverflow.com/comment/40574729
has title: Unchecked exception
has body: I try to Create a custom unchecked exception class called InvalidDateException. This exception class must include a constructor that takes a String as an argument. But I wonder is my code is custom unchecked exception or not. class InvalidDateException extends RuntimeException { //Parameterless Constructor public WordContainsException() {} //Constructor that accepts a message public InvalidDateException(String message) { super(message); } }
tagged with: exception
has comment: http://stackoverflow.com/comment/40574798
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/40574759
upvote count: 1
has comment: http://stackoverflow.com/comment/40574743
has comment: http://stackoverflow.com/comment/40574771
type: Question
has answer: http://stackoverflow.com/a/25920350
tagged with: java
has answer: http://stackoverflow.com/a/25920252
score: -1
tagged with: unchecked

http://stackoverflow.com/a/25967096
type: Answer
upvote count: 4
has body: Transport and encoding are two very different things and it's entirely up to you to choose which transport to use and what data encoding to use, depending on the needs of your application. Sending msgpack data over HTTP is a perfectly valid use case and it is possible, but keep in mind the following two points: msgpack is a binary encoding, which means it needs to be serialized into bytes before sending, and deserialized from the received bytes on the other end. It also means that it is not human-readable (or writable, for that matters) so it's really hard to inspect (or generate by hand) the HTTP traffic. unless you intend to stream msgpack-encoded data over HTTP, you'll incur a fairly high overhead cost since the HTTP header size will most likely greatly overshadow the size of the data you're sending. Note that this also applies to JSON, but to a lesser extent since JSON is not as efficient in its encoding. As far as implementation goes, the sending side would have to serialize your msgpack object into a byte[] before sending it as the request body in your HTTP request. You'll need to set the HTTP Content-Type to application/x-msgpack as well. On the receiving end, read the request body from the input stream (you probably can get your hands on a ByteArrayInputStream and deserialize into your msgpack object).
downvote count: 0
has comment: http://stackoverflow.com/comment/40662410
score: 4
answers question: http://stackoverflow.com/q/25966794

http://stackoverflow.com/comment/40777082
has text: I didn't get what you need - can you provide all your input and what you expect to happen? If it's just putting break - the answer is below, if it's other thing could you be more exact?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26032380

http://stackoverflow.com/comment/40534812
type: QuestionComment
comment on: http://stackoverflow.com/q/25898612
score: 4
type: Comment
has text: What does `byte...` mean? What does `byte[]...` mean?

http://stackoverflow.com/comment/40572179
score: 0
type: Comment
has text: I'm at school and can't program right now so I was just doing my best looking for that magic function. I'll learn more about swing so I can create functions like yours :-)
comment on: http://stackoverflow.com/a/25918436
type: AnswerComment

http://stackoverflow.com/q/25904954
has answer: http://stackoverflow.com/a/25905215
has comment: http://stackoverflow.com/comment/40546415
linked to: http://stackoverflow.com/q/8894258
tagged with: java
score: -1
type: Question
answer count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/40546618
has comment: http://stackoverflow.com/comment/40546466
favorite count: 0
has answer: http://stackoverflow.com/a/25905166
has title: ignore punctuation marks in string
upvote count: 0
type: UnansweredQuestion
has body: I am reading words from a file. I want to ignore punctuation marks with the words (for eg. if Nay, then i want to read only Nay). I have written code right now to ignore only "," from the word but my requirement is to ignore all the punctuation marks and numbers. My approach is tedious and unintelligent. Please suggest how can I ignore all the punctuation marks and numbers. Please donot decrease my rep and block my account if you think this post is irrelevant. Let me know what else you want and I will share it with you. One of the text files I am trying to read is as follows: Text File I have written the code like below line to ignore "," if(wordArray[j].charAt(k)!=',') Please find the relevant code below for(int k=0;k&lt;wordArray[j].length();k++) { if(wordArray[j].charAt(k)!=',' ) { arrayFinal.add(wordArray[j].charAt(k)); } } Updated post

http://stackoverflow.com/comment/40743668
comment on: http://stackoverflow.com/q/26014281
has text: Please include atleast the steps you have tried and Java exception.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40753132
comment on: http://stackoverflow.com/a/26015986
type: AnswerComment
type: Comment
score: 1
has text: @assylias, Interruption scares me because I don't know what will happen if the interrupt occurs while my code is calling in to a third party library. I have not yet seen a library with explicit documentation about how it handles interrupts. I _hope_ that any interrupted library call would throw InterruptedException, and leave everything in the same state it was in before the call--that's how I would write it--but in my business, hope does not cut it with the QA department.

http://stackoverflow.com/comment/40510375
has text: @BrunoLowagie yes i have tried by calling getCropBox() but the watermark was adding at the center for some pages and i found the same response with getPageSize() as well.... yes what u r saying is correct crop box was smaller than mediabox (I found it when i debug the code) but the end result was the same for those two cases
score: 0
comment on: http://stackoverflow.com/q/25882842
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25967277
has title: How to replace the value of the index of a string in an array
tagged with: arrays
has answer: http://stackoverflow.com/a/25968566
upvote count: 1
has answer: http://stackoverflow.com/a/25967306
favorite count: 0
answer count: 5
has body: i am making a project about turing machine and i am having a problem about the how do i replace a character in an certain index of a string Example: if i input in the initial tape: stackoverflow then code in the inputArea like write 1 the output should be 1tackoverflow but sadly the output of my code is 11111111111111 I'm trying to get rid of the loop because i know my loop is the problem but how should i do it ? Here's my code runButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ActE){ String[] iniTape = iTapeArea.getText().split(""); String[] input = inputArea.getText().split("\n"); for(int i=0;i&lt;input.length;i++) { if(input[i].contains("write")==true){ sub = input[i].substring(6, input[i].length()); for(int j=0;j&lt;iniTape.length;j++){ System.out.print(""+iniTape[j].replace(iniTape[j], sub)); } } } } });
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26761216
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25969126
has answer: http://stackoverflow.com/a/25967301
type: Question
tagged with: split
tagged with: for-loop

http://stackoverflow.com/a/25915244
has comment: http://stackoverflow.com/comment/40593456
type: Answer
answers question: http://stackoverflow.com/q/25913946
upvote count: 1
has comment: http://stackoverflow.com/comment/40600850
has body: modules must have their own dependencies explicitly declared in the modules.xml. A Module cannot access jars that are part of a deployment.
score: 1
accepted answer of: http://stackoverflow.com/q/25913946
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40708542
comment on: http://stackoverflow.com/q/25995063
has text: Always give the COMPLETE and EXACT error message when you ask a question.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25957196
score: 0
type: Answer
has body: It is a little to less. Try trim() on your string or contains instead of equals. streamChat = (String) inputdata.readObject(); streamChat = streamChat.trim(); if(streamChat.equals("date")) { ... or streamChat = (String) inputdata.readObject(); if(streamChat.contains("date")) { ... but as I said you provided to less information. Could you write something about how are you getting input from user?
has comment: http://stackoverflow.com/comment/40639556
answers question: http://stackoverflow.com/q/25957175
upvote count: 1
downvote count: 1

double
tags question: http://stackoverflow.com/q/25924167
tags question: http://stackoverflow.com/q/26026561
tags question: http://stackoverflow.com/q/25986568
tags question: http://stackoverflow.com/q/25899324
tags question: http://stackoverflow.com/q/25914151
tags question: http://stackoverflow.com/q/25914758
tags question: http://stackoverflow.com/q/25901198
tags question: http://stackoverflow.com/q/25957976
tags question: http://stackoverflow.com/q/25991373
tag name: double
type: Tag
tags question: http://stackoverflow.com/q/26002304
tags question: http://stackoverflow.com/q/25905519
tags question: http://stackoverflow.com/q/26006257

http://stackoverflow.com/a/25912420
has body: 1 - About the "dependency-finder" tool: In theory, each *.class file has a constant pool where the name of dependencies can be found. However, the code could use reflection and make up the name of classes/interfaces dynamically, so finding out if one jar depends on another to work properly is not an easy task at all. 2 - About your particular case: It seems like, indeed, you don't need such dependency; but if you really want to double check the only way would be to analyse the code of your project by hand. Even if you found a dependency-finder its result wouldn't be 100% reliable because of what I've explained in my first point.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25911649
upvote count: 2
type: Answer

http://stackoverflow.com/a/25960069
has comment: http://stackoverflow.com/comment/40644847
has comment: http://stackoverflow.com/comment/40648368
has body: I can't think of an easy method to zoom a JPanel out, but you can do it via double-buffering: private void paintPanel (Graphics2D g) { // here goes the code of your paint() or paintComponent() method } /** Draw content into an Image, shrink it, and display it. */ protected void paintComponent (Graphics g) { // paint image BufferedImage img = new BufferedImage(MAX_WIDTH, MAX_HEIGHT, BufferedImage.TYPE_INT_ARGB); paintPanel(img.createGraphics()); // shrink image and paint it g.drawImage(img, 0,0, WIDTH,HEIGHT, 0,0, MAX_WIDTH,MAX_HEIGHT, null); } This will paint everything on a BufferedImage with the size MAX_WIDTH x MAX_HEIGHT. Then, the Image will be shrinked into the size WIDTH x HEIGHT and then displayed.
score: 0
has comment: http://stackoverflow.com/comment/40649021
has comment: http://stackoverflow.com/comment/40648397
has comment: http://stackoverflow.com/comment/40644905
has comment: http://stackoverflow.com/comment/40648928
has comment: http://stackoverflow.com/comment/40668998
answers question: http://stackoverflow.com/q/25959860
type: Answer
has comment: http://stackoverflow.com/comment/40648787
has comment: http://stackoverflow.com/comment/40659036
has comment: http://stackoverflow.com/comment/40648831
has comment: http://stackoverflow.com/comment/40648886

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/25943556

http://stackoverflow.com/q/25963852
tagged with: unit-testing
type: Question
accepted answer: http://stackoverflow.com/a/26233169
has title: Robolectric Test an activity launched from a widget
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40850807
favorite count: 0
has comment: http://stackoverflow.com/comment/40881126
tagged with: android
upvote count: 1
type: AnsweredQuestion
has body: I've a simple widget which consists of an image and a button, the button should launch an activity. I'm trying to write a Robolectric test to test that the activity is launched when the button is clicked I've two problems, firstly I'm getting an NPE when attempting to click the button: java.lang.NullPointerException: can't get a shadow for null at org.robolectric.bytecode.ShadowWrangler.shadowOf(ShadowWrangler.java:415) at org.robolectric.Robolectric.shadowOf_(Robolectric.java:1020) at org.robolectric.Robolectric.shadowOf(Robolectric.java:671) at org.robolectric.shadows.ShadowIntent.fillIn(ShadowIntent.java:454) at android.content.Intent.fillIn(Intent.java) at org.robolectric.shadows.ShadowPendingIntent.send(ShadowPendingIntent.java:48) at android.app.PendingIntent.send(PendingIntent.java) at org.robolectric.shadows.ShadowRemoteViews$2$1.onClick(ShadowRemoteViews.java:61) at android.view.View.performClick(View.java:4084) Also I'm not sure how to get a reference to the activity launched via the button click. Code for test: @Test public void buttonShouldLaunchActivity() throws Exception { int widgetId = shadowAppWidgetManager.createWidget(HelloWidgetProvider.class, R.layout.hellowidget_layout); View helloWidgetView = shadowAppWidgetManager.getViewFor(widgetId); Button quickButton = (Button) helloWidgetView.findViewById(R.id.quick_add_button); quickButton.performClick(); // Not sure how to get a handle of the activity started from a widget, this is what I have for an activity launched from another activity. Intent intent = Robolectric.shadowOf(activity).peekNextStartedActivity(); assertEquals(QuickAddActivity.class.getCanonicalName(), intent.getComponent().getClassName()); } Any thoughts would be apreciated, the actual widget is working (the activity is launched) but I'd just like to have a test for it.
has answer: http://stackoverflow.com/a/26233169
score: 1
tagged with: java
tagged with: robolectric

google-cloud-storage
tags question: http://stackoverflow.com/q/25888537
type: Tag
tag name: google-cloud-storage

http://stackoverflow.com/q/25874590
type: Question
tagged with: java
has title: Phonegap Java call to Javascript
score: 0
has body: I'm using Phonegap to develop an app. I've downloaded a camera plugin, however, I'd like to make a Javascript call from within the plugin. In the Java file for the camera plugin I have done the following; private class sendJS extends CordovaActivity { public void sendcommand() { this.sendJavascript("alert('1337')"); } } @Override public void onClick(View v) { sendJS test = new sendJS(); test.sendcommand(); } However, when the onclick is triggered nothing happens... I've also tried super.sendJavascript() and super.loadUrl() but it didn't work. Thanks.
answer count: 1
tagged with: javascript
tagged with: phonegap-plugins
has answer: http://stackoverflow.com/a/25894243
has comment: http://stackoverflow.com/comment/40498794
tagged with: cordova-plugins
tagged with: cordova
has comment: http://stackoverflow.com/comment/40491428
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40491508

http://stackoverflow.com/q/25982279
upvote count: 1
downvote count: 1
tagged with: recursion
type: AnsweredQuestion
tagged with: java
has body: so I'm scratching my head on how to flip the output which is a ruler....upside down any idea ? if you run the code you'll see the output I can't/don't how to post a sample here public class Ruler { private static void drawMinorTicks(int line, int ticks) { if (ticks &gt; 1) { drawMinorTicks(line, ticks - 1); } if (line &lt;= ticks) { System.out.print('|'); } else { System.out.print(' '); } if (ticks &gt; 1) { drawMinorTicks(line, ticks - 1); } } private static void drawSingleMajorTick(int line, int ticks, int label) { if (line &lt;= ticks) { System.out.print('|'); } else { System.out.print(label); } } private static void drawMajorTicks(int inches, int line, int ticks) { drawSingleMajorTick(line, ticks, 0); for (int i = 1; i &lt;= inches; i++) { drawMinorTicks(line, ticks - 1); drawSingleMajorTick(line, ticks, i); } } private static void drawRuler(int inches, int ticks) { for (int i = 1; i &lt;= ticks + 1; ++i) { drawMajorTicks(inches, i, ticks); System.out.println(); } } public static void main(String[] args) { drawRuler(5, 5); } }
type: Question
has comment: http://stackoverflow.com/comment/40687293
has answer: http://stackoverflow.com/a/25982635
linked to: http://stackoverflow.com/q/25954584
score: 0
linked to: http://stackoverflow.com/q/25942592
answer count: 1
accepted answer: http://stackoverflow.com/a/25982635
favorite count: 0
has comment: http://stackoverflow.com/comment/40688261
duplicate of: http://stackoverflow.com/q/25942592
has title: how do I flip this ruler up side down?

http://stackoverflow.com/q/26003785
has answer: http://stackoverflow.com/a/52124436
has answer: http://stackoverflow.com/a/35404774
answer count: 4
upvote count: 11
accepted answer: http://stackoverflow.com/a/29296606
tagged with: jax-ws
tagged with: web-services
score: 11
has answer: http://stackoverflow.com/a/26795466
type: AnsweredQuestion
tagged with: weblogic
has title: File metro-default.xml not found on Weblogic 12.1.3
tagged with: java
type: Question
has body: We're currently running on WebLogic 12.1.2. And in this environment our application runs fine. What we want now is to homologate our applications to WebLogic 12.1.3 environments. But we are facing a problem with the Web Services we use. In the new version the server throws a exception saying that the "Default configuration file [ metro-default.xml ] was not found". I'm trying to find something on this file but there is nothing. PS: We do not use Metro, we use the WebLogic default JAX-WS stack. And the application is deployed as a WAR file. Here is the stack of the exception java.lang.IllegalStateException: MASM0001: Default configuration file [ metro-default.xml ] was not found at com.sun.xml.ws.assembler.MetroConfigLoader.init(MetroConfigLoader.java:142) at com.sun.xml.ws.assembler.MetroConfigLoader.&lt;init&gt;(MetroConfigLoader.java:119) at com.sun.xml.ws.assembler.TubelineAssemblyController.getTubeCreators(TubelineAssemblyController.java:122) at com.sun.xml.ws.assembler.MetroTubelineAssembler.createServer(MetroTubelineAssembler.java:173) at com.sun.xml.ws.server.WSEndpointImpl.&lt;init&gt;(WSEndpointImpl.java:193) at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:337) at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:332) at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:164) at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:577) at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:303) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:179) at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:131) at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:152) at weblogic.servlet.internal.Eve…
has answer: http://stackoverflow.com/a/29296606
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/35404774

http://stackoverflow.com/comment/41455839
has text: My correct answer got deleted twice, without any explanation or any reaction to my request for clarification, so yes, I am seriously pissed and that shows in the repost of my answer. If anybody had the decency to treat me like a human being instead of just deleting my answers (I had neither quoted anybody nor argued at that point), this thread wouldn't exist.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26403150
type: AnswerComment

http://stackoverflow.com/q/25910101
score: 1
linked to: http://stackoverflow.com/q/3464229
has answer: http://stackoverflow.com/a/25910972
favorite count: 0
type: Question
tagged with: mysqli
tagged with: windows
tagged with: php
linked to: http://stackoverflow.com/q/14881997
linked to: http://stackoverflow.com/q/1126684
tagged with: java
accepted answer: http://stackoverflow.com/a/25910972
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/4084554
has body: An php application which required an authentication details as same as windows system. i.e windows login credential and application credentials are same. I need to develop a php application that should automatically logged in with php after a windows successfully logged-in
has title: Windows system login credential
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/25912184
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40564819
score: 2
downvote count: 0
has title: Java Security class and Providers
favorite count: 0
tagged with: security
has answer: http://stackoverflow.com/a/25921852
type: Question
tagged with: android
tagged with: cryptography
upvote count: 2
answer count: 2
has body: I'm having trouble understanding how certain parts of the Security class work. I understand that calling getProviders() will return all of the providers available on the current Android device. What I'm having trouble understanding is how to make use of these providers' algorithms for encryption/decryption. The Security class also has a setProperty() function. The documentation doesn't go into much detail about how this works, but it seems like I can set any made up property here with any value that I like. How would I actually check that a change took place on my device after setting a specific property? If anybody could point me to a resource online that goes into detail on this topic I would appreciate it. EDIT: I'll be more specific. I'm trying to take advantage of a FIPS-compliant device. There is a specific property that needs to be set using the setProperty() method to enable "FIPS mode" on the device. I'd like to figure out how I can confirm that the device is running in this mode after the property is set, and how I can utilize the available FIPS validated algorithms.
has answer: http://stackoverflow.com/a/25913102

http://stackoverflow.com/a/25894818
answers question: http://stackoverflow.com/q/25893374
type: AcceptedAnswer
has body: It’s not clear what you are trying to do as you are creating collections inside a loop without using them. So I can’t tell you whether there’s a better solution for this. Regarding the error, the error message is pretty clear. You can’t use a mutable local variable inside a lambda. However, the solution is quite simple: you can assign the content of the mutable variable to an immutable variable: for (int j = 1; j &lt;= metadata.getColumnCount(); j++) { // … int currentJ = j; Object currentColValue = colValue; Object o = jrs2Collection.stream() .filter(u -&gt; { try { return (u.getColumnObject(currentJ).equals(currentColValue)); } catch (Exception e) { e.printStackTrace(); return false; } } ) .collect(Collectors.toCollection(TreeSet::new)); } Note that currentJ and currentColValue are effectively final which means you could add a final modifier to them without changing the program. It’s a requirement that local variables you use inside a lambda expression are either final or effectively final. By the way, don’t think about “re-using lambda between iterations”. In most cases, the JRE will take care of reusing the instances created for lambda expressions where possible. And the JDBC operations outweigh any overhead imposed by temporary objects created for lambda expressions anyway.
accepted answer of: http://stackoverflow.com/q/25893374
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40530187
downvote count: 0

http://stackoverflow.com/comment/40756109
comment on: http://stackoverflow.com/a/26021022
type: AnswerComment
has text: What is it interpreting?
score: 0
type: Comment

spring-security
tags question: http://stackoverflow.com/q/25931861
tags question: http://stackoverflow.com/q/25887792
tags question: http://stackoverflow.com/q/25990452
tags question: http://stackoverflow.com/q/25946044
tags question: http://stackoverflow.com/q/26013251
type: Tag
tags question: http://stackoverflow.com/q/26018653
tags question: http://stackoverflow.com/q/25932068
tags question: http://stackoverflow.com/q/26016193
tags question: http://stackoverflow.com/q/25884727
tags question: http://stackoverflow.com/q/25948090
tags question: http://stackoverflow.com/q/26010992
tags question: http://stackoverflow.com/q/26004443
tags question: http://stackoverflow.com/q/25911265
tags question: http://stackoverflow.com/q/26026521
tags question: http://stackoverflow.com/q/25888367
tags question: http://stackoverflow.com/q/25885297
tags question: http://stackoverflow.com/q/25945902
tags question: http://stackoverflow.com/q/26001414
tags question: http://stackoverflow.com/q/25874510
tag name: spring-security
tags question: http://stackoverflow.com/q/25984840
tags question: http://stackoverflow.com/q/26027511

http://stackoverflow.com/comment/40690721
comment on: http://stackoverflow.com/q/25984822
has text: i added the rest of the code into the question
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25994425
favorite count: 0
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26429747
upvote count: 2
tagged with: maven
tagged with: git
has comment: http://stackoverflow.com/comment/40707992
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40734954
tagged with: eclipse
tagged with: m2eclipse
has body: I have a maven project in Github and I want to work with that in Eclipse. In eclipse, there is an option for File>New>Other>Maven>Check out Maven Projects from SCM. But the dropdown select option near SCM URL is inactive. On clicking "m2e Marketplace", I cannot find git in the list. Though I did find egit, so I tried to install it. But I got the below error message. An error occurred while collecting items to be installed session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). No repository found containing: osgi.bundle,org.eclipse.egit,3.4.1.201406201815-r No repository found containing: osgi.bundle,org.eclipse.egit.core,3.4.1.201406201815-r No repository found containing: osgi.bundle,org.eclipse.egit.doc,3.4.1.201406201815-r No repository found containing: osgi.bundle,org.eclipse.egit.ui,3.4.1.201406201815-r No repository found containing: osgi.bundle,org.eclipse.jgit,3.4.1.201406201815-r No repository found containing: osgi.bundle,org.eclipse.jgit.archive,3.4.1.201406201815-r No repository found containing: org.eclipse.update.feature,org.eclipse.egit,3.4.1.201406201815-r No repository found containing: org.eclipse.update.feature,org.eclipse.jgit,3.4.1.201406201815-r What went wrong? Can I use egit instead of Git? Why did I get the error message? Sorry to diviate, is "m4e" the next generation of "m2e"?
answer count: 1
downvote count: 0
has title: Issue while trying to open a Maven project via Git in Eclipse Luna

http://stackoverflow.com/a/25997586
has body: A couple things: You're getting a java.net.ConnectionException (see below) because the connection is being refused. This could be because the server you are trying to connect to is not running, the server is not accepting client connections, the server is not accessible by the client, or you are connecting to the wrong port number. It is generally bad coding practice to catch Exception directly. You want to either catch the most specific exception that ranges across the variety of exceptions that can be thrown (in this case, IOException) or catch each possible one individually, which is the preferred method. Catch the most specific exceptions before the more general ones so that they are not masked by them. Furthermore it is a good idea to use the Throwable class's getMessage() method so that you can figure out the reason for the exception being thrown. For example: } catch (java.net.ConnectException ex) { System.err.println("ConnectException: " + ex.getMessage()); // May return "Connection refused", "Connection timed out", "Connection reset", etc. } catch (java.rmi.UnknownHostException ex) { System.err.println("UnknownHostException: " + ex.getMessage()); // Returns the name of the host you were attempting to connect to } catch (...) { // code here } catch (java.io.IOException ex) { System.err.println("IOException: " + ex.getMessage()); // May return a problem with the BufferedReader or InputStreamReader or PrintWriter } Of course, the statements in the catch clause can be modified to your liking.
type: Answer
answers question: http://stackoverflow.com/q/25980299
score: 0

http://stackoverflow.com/a/39780992
has body: Slight improvement on the above. Avoids hardcoding offset. Also, takes care of daylight savings. public static LocalDateTime convertTo(LocalDateTime dateTime, String timeZone) { ZoneId zone = ZoneId.of(timeZone); ZonedDateTime zdt = dateTime.atZone(zone); ZoneOffset offset = zdt.getOffset(); return dateTime.plus(offset.getTotalSeconds(), ChronoUnit.SECONDS); }
answers question: http://stackoverflow.com/q/25885591
has comment: http://stackoverflow.com/comment/81916249
type: Answer
upvote count: 2
score: 1
downvote count: 1

http://stackoverflow.com/a/26001871
score: 1
has comment: http://stackoverflow.com/comment/40724575
answers question: http://stackoverflow.com/q/26001713
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/40722415
has comment: http://stackoverflow.com/comment/40724692
type: Answer
has comment: http://stackoverflow.com/comment/40721400
has body: This is a problem of poor design. You can always take in the param from a package private constructor. Your code should be doing something like this: public class Service { DependentClass object; public Service(){ this.object = new DependentClass(); } Service(DependentClass object){ // use your mock implentation here. Note this is package private only. object = object; } public void method() { object.someMethod(); } }
has comment: http://stackoverflow.com/comment/40723819
has comment: http://stackoverflow.com/comment/40721421

http://stackoverflow.com/comment/40625086
comment on: http://stackoverflow.com/a/25949008
has text: This produces the same result. The chars in the EditText remain the same by pressing backspace, if the maxLength exceeds.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25873852
has comment: http://stackoverflow.com/comment/40490631
has comment: http://stackoverflow.com/comment/40490800
has comment: http://stackoverflow.com/comment/40490220
has title: android-asycn-http: Never send the http request
tagged with: java
tagged with: android-async-http
has comment: http://stackoverflow.com/comment/40491254
type: Question
has comment: http://stackoverflow.com/comment/40491160
tagged with: httpclient
has answer: http://stackoverflow.com/a/25875365
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40490988
has comment: http://stackoverflow.com/comment/40490092
has body: I'm using android-async-http 1.4.5, but I found it never calls my server, here's my code : public class HttpUtils { private static AsyncHttpClient client = new AsyncHttpClient(); public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) { params.setUseJsonStreamer(true); client.get(url, params, responseHandler); } public static void post(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) { params.setUseJsonStreamer(true); Log.i("URL", url); client.post(url, params, responseHandler); } } Here's how I define my handler: public abstract class JsonResponseHandler extends AsyncHttpResponseHandler { private static final String TAG = "JSON_RESPONSE_HANDLER"; public abstract void onSuccess(int statusCode, Header[] headers, JSONObject jsonObject); public abstract void onFailure(int statusCode, Header[] headers, JSONObject jsonObject); @Override public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { Log.i(TAG, "on success"); onSuccess(statusCode, headers, parseObject(responseBody)); } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { Log.i(TAG, "on failure"); onFailure(statusCode, headers, parseObject(responseBody)); } private JSONObject parseObject(byte[] response) { JSONObject jsonObj = null; try { String json = new String(response, "UTF-8"); jsonObj = new JSONObject(json); } catch (Exception e) { e.printStackTrace(); } return jsonObj; } } After some debug work, I found my code actually execute client.post(...), but my server didn't receive any call from it. EDIT Here's how I use it in my test case : public class VerifyCodeTest extends TestCase { private static final String TAG ="VERIFY_CODE_TEST"; public void testGetVerifyCode(){ Log.i(TAG, "Hello World"); VerifyCodeTransaction vc= new VerifyCodeTransaction("167xxxx137"); vc.execute(new JsonResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSON…
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/25924108
downvote count: 0
tagged with: gradle
type: Question
has title: Gradle compiling .java inside jar files?
score: 1
tagged with: java
has body: I'm having a strange scenario where Gradle seems like it is attempting to compile ".java" files located inside of jar files I set as dependencies. I do something like this: dependencies { testCompile fileTree(dir: './libs', include: ['*JarResources/Java/*.jar']) testCompile group: 'junit', name: 'junit', version: '4.11' } ...and I have a rather large list of jar dependencies. When I try to run my tests it fails in the compile stage where it cannot find symbols for the Java files tucked inside the jar files. Some of these jar dependencies are packaged with their source sitting next to the corresponding .class. I tried using an include filter in my source set to no avail. sourceSets { main { java { exclude 'com/mypkg/other/**' } } test { java { include 'com/mypkg/test/**' } } } I can run the tests in IntelliJ 13 using its gradle-aware make without issue (here I am right clicking the unit tests and running them) as it is smart enough to build the dependency class path without passing the files to Javac but somehow the same build.gradle is failing from the command line. Is this a known issue where Gradle automatically passes dependencies to javac as it finds them in the Jar files?
upvote count: 1
tagged with: intellij-idea
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25924312
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25924312

http://stackoverflow.com/q/25894719
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25894757
has answer: http://stackoverflow.com/a/25894922
has answer: http://stackoverflow.com/a/25894757
tagged with: arrays
has answer: http://stackoverflow.com/a/25894809
score: 0
accepted answer: http://stackoverflow.com/a/25894922
has answer: http://stackoverflow.com/a/62726469
has body: I am researching the difference of arrays and Arraylists. Can anyone clarify if it is possible to add an element to the middle of an array without replacing the existing value (like what the x.add() would to for an arraylist)? For example: if I had an array of fruit [apples, pears, peaches, nectarines] and I want to insert plums [apples, pears, plums, peaches, nectarines]. Would this be possible and how would it be done?
answer count: 5
has answer: http://stackoverflow.com/a/25894776
has title: Adding a value to the middle of an array without replacing an existing value in java

http://stackoverflow.com/comment/40602287
score: 0
type: Comment
has text: @Snorky35, still having error `Can not set java.lang.Integer field .... to java.lang.Integer`
type: QuestionComment
comment on: http://stackoverflow.com/q/25935430

http://stackoverflow.com/comment/40536443
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25899442
has text: Well `1,000,000` looks like one million to me.
type: Comment

http://stackoverflow.com/a/26036287
answers question: http://stackoverflow.com/q/26030425
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26030425
type: Answer
has body: Please remove the ScrollView. Using ListView inside ScrollView is not allowed. Because ListView by default has Scrolling effect.

http://stackoverflow.com/comment/40809833
type: Comment
has text: @HotLicks Let's see. I wrote this -- http://www.cowtowncoder.com/blog/archives/2007/02/entry_32.html -- 7 years ago; and this -- http://www.cowtowncoder.com/blog/archives/2010/04/entry_396.html -- bit later. So yes, I do know what I am talking about. Also, having written one JSON library, 2 XML libraries (Woodstox, Aalto), as well as worked on performance benchmarks (https://github.com/eishay/jvm-serializers), I know quite a bit about performance in this domain.
comment on: http://stackoverflow.com/a/26026786
type: AnswerComment
score: 4

http://stackoverflow.com/a/25883066
has body: The second one is considerably more efficient because it avoids all the copy steps. It's also a million times simpler and more apparent, which has its own value,
score: 3
upvote count: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25882697

http://stackoverflow.com/q/25939388
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25939528
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25939528
tagged with: ant
has body: I call runGraph class from CloverETL in a ANT script like this &lt;java classname="org.jetel.main.runGraph" fork="true" failonerror="true"&gt; &lt;arg value="${canadapostdir}/metadata/CanadaPostADDTypes34.grf"/&gt; &lt;classpath&gt; &lt;pathelement path="${ear.lib}/clover.jar" /&gt; &lt;pathelement path="${ear.libext}/oracle.jdbc/ojdbc6.jar" /&gt; &lt;pathelement path="${ear.libext}/mysql.jdbc/mysql-connector-java-3.0.15-ga-bin.jar" /&gt; &lt;fileset dir="${ear.lib}"&gt; &lt;include name="*.jar"/&gt; &lt;/fileset&gt; &lt;/classpath&gt; &lt;/java&gt; When clover start I can see that in the log : [java] [Clover] starting WatchDog thread ... [java] [WatchDog] Thread started. [java] [WatchDog] Running on 16 CPU(s) max available memory for JVM 3005703 kB [java] [Clover] Initializing phase: 0 [java] all edges initialized successfully... [java] initializing nodes: [java] INPUT ...OK [java] TYPEFILTER ...OK [java] REF ...OK [java] OUTPUT ...OK [java] [Clover] phase: 0 initialized successfully. [java] [WatchDog] Starting up all nodes in phase [0] [java] [WatchDog] INPUT ... started [java] [WatchDog] TYPEFILTER ... started [java] [WatchDog] REF ... started [java] [WatchDog] OUTPUT ... started [java] [WatchDog] Sucessfully started all nodes in phase! My question is : how can I make clover run with more memory than 3005703 kB ?There is actually 100gig of free ram on the server that this script is running. EDIT : I know for what I see that clover is not running on a separate jvm and that it use all the free memory availble on the current JVM instance I guess. I need to find a way to start clover on a separate jvm which I can pass -Xms10240m -Xmx10240m.
answer count: 1
downvote count: 0
favorite count: 0
has title: pass JVM args to clover in a ant script
tagged with: cloveretl

http://stackoverflow.com/q/25983128
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40687547
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40687710
linked to: http://stackoverflow.com/q/444380
score: 2
has answer: http://stackoverflow.com/a/25983211
downvote count: 0
has title: Is there a way to read only part of a JSON file in Java?
has body: I am using NetBeans 7.4 on Windows 7. When I tried to read a JSON file with the following call, String jsonTxt = IOUtils.toString(new FileInputStream(inputFileName), "UTF-8"); I received an OutOfMemoryError exception. I checked and saw that the file was over 28 GB so there is probably no way I can read it all into memory at once. Is there a way to read in only part of the JSON file so that I do not run out of memory? There does not appear to be a suitable method in IOUtils.
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 2

http://stackoverflow.com/comment/40710667
comment on: http://stackoverflow.com/q/25989744
score: 0
has text: @Zabri Then it must be tough on you when you use the JDK :) Such is life...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26010220
tagged with: java
has comment: http://stackoverflow.com/comment/134843415
type: Question
has answer: http://stackoverflow.com/a/26010549
has comment: http://stackoverflow.com/comment/134865704
has comment: http://stackoverflow.com/comment/134857259
score: 0
has body: I'm working in Java. Given a matrix NxM, I need to find all possible paths through the array. It is only allowed to go diagonally up or down, or go to the right. An example 4x4 matrix: 3 5 7 9 2 4 6 8 9 3 7 5 6 8 2 4 The numbers in the matrix can be any arbitrary value. I would like to generate all possible routes through the matrix, starting in one of the four numbers in the first column. It is only allowed to move Northeast, East, and Southeast. An example route: 3-5 7 9 \ 2 4 6-8 9 3 7 5 6 8 2 4 So all routes consist of M numbers. I'm using a 2D array to hold this NxM matrix. Some more possible paths are: 3 4 6 5 3 5 6 9 9 4 7 4 9 3 6 9 Is there a way to easily generate all paths in Java? Any help is much appreciated!
tagged with: multidimensional-array
answer count: 1
type: UnansweredQuestion
has title: Generate all paths/routes through 2D array in Java
has comment: http://stackoverflow.com/comment/134877700

http://stackoverflow.com/q/26024939
tagged with: jdbc
answer count: 4
has answer: http://stackoverflow.com/a/26025012
has body: I am trying to use a Java class that already worked great for me in the past in order to access MySQL from my JSP project, running Tomcat 6. The problem is, that this line: con = DriverManager.getConnection("jdbc:mysql://localhost:3306/", "root", "password"); gives con a value of null. Now, my question is - what can cause the "getConnection" method return null? Edit: I see now that also, I get the infamous ClassNotFoundException: com.mysql.jdbc.Driver. I have the connector included in my build path. So why am I getting this error? And, does it have to do with getConnection returning null?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2839321
tagged with: mysql
downvote count: 1
has answer: http://stackoverflow.com/a/26025010
score: 3
duplicate of: http://stackoverflow.com/q/2839321
tagged with: java
has answer: http://stackoverflow.com/a/26025274
has comment: http://stackoverflow.com/comment/40763406
type: Question
upvote count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/26025175
has title: DriverManager.getConnection returns null
has comment: http://stackoverflow.com/comment/40778702

http://stackoverflow.com/q/25978915
tagged with: authentication
type: Question
tagged with: tomcat
has body: I have a web application running on Tomcat 7 and it is configured with a custom JNDIRealm and my login-config auth-method in my web.xml is set to "FORM". I am trying to find a way to add the ability to authenticate users through the same LDAP with a smart card, if presented. I have changed my server.xml to have clientAuth=want, but want to know if there is a way to authenticate the user when a certificate is presented via the LDAP and then re-direct them past the login form. Is this possible? EDIT: Michael-O below was marked as the right answer because I was able to achieve this by creating a custom class that extends FormAuthenticator and then registering that in Tomcat's authenticator.properties. This allowed me to check for a x509cert from the client in the request. If the cert is present and valid, authenticate and forward the user to the secured resources page. If not present or invalid, forward the user to the form login.
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
has title: Authenticate user with Smart Card and LDAP in Tomcat 7
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25982351
accepted answer: http://stackoverflow.com/a/25982351
tagged with: java

http://stackoverflow.com/comment/40718721
type: QuestionComment
comment on: http://stackoverflow.com/q/26000235
has text: I'm not sure how working offline is specifically keeping you from using Gradle's Test task. If you a referring dependency management then you can use [local libraries](http://www.gradle.org/docs/current/userguide/dependency_management.html#sub:file_dependencies) with Gradle.
score: 0
type: Comment

http://stackoverflow.com/a/26024883
has comment: http://stackoverflow.com/comment/96798085
upvote count: 12
has body: Get the current working directory Path pwd = Paths.get("").toAbsolutePath(); and then relativize the target Path Path relative = pwd.relativize(target);
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26024797
score: 12
answers question: http://stackoverflow.com/q/26024797
type: AcceptedAnswer

http://stackoverflow.com/a/25927487
downvote count: 0
score: 6
type: Answer
answers question: http://stackoverflow.com/q/25927450
upvote count: 6
has body: No,you can not use variable in Annotation,only constant is permitted. the following will work,because here USERNAME_XPATH is a constant: final static String USERNAME_XPATH=&quot;//input[@name='Username']&quot;; @FindBy(how = How.XPATH, using=USERNAME_XPATH)

http://stackoverflow.com/q/25938949
has comment: http://stackoverflow.com/comment/40608494
has title: Java Array Break at Specific Array Number
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40608354
downvote count: 1
tagged with: java
score: -1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/25939133
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/40608380
has body: I've got an array with Strings in it. For this example, I'll use an array filled with classes. And there's an array with grades getting filled by user interaction. Now, I've got everything working except for the part where the last two classes which give more Study points then the rest get printed double and I can't figure out where this goes wrong. Some code has dutch names so here's a list of the translations: Cijfer is grade vakken is classes public static void main (String[] args) { Scanner input = new Scanner(System.in); final int MAX_ECTS = 39; int ects = 0; final int ECTS_VAK = 3; final int ECTS_PROJECT = 12; String[] vakkenArray = {"Programming", "Business", "Infrastructure", "Databases", "User Interaction", "Project Fasten Your Seatbelts", "Project Agile Developement"}; double[] cijferArray = new double[7]; for (int i = 0; i &lt; cijferArray.length; i++) { System.out.println("Voer A.U.B het cijfer in voor " + vakkenArray[i]); cijferArray[i] = input.nextDouble(); } for (int i = 0; i &lt; vakkenArray.length; i++) { if (i &lt; 5) { if (cijferArray[i] &gt;= 5.5) { ects = ects + 3; System.out.println("Vak/Project:" + vakkenArray[i] + " Cijfer:" + cijferArray[i] + " ECTS Behaald: " + ECTS_VAK); } if (cijferArray[i] &lt;= 5.5) { System.out.println("Vak/Project:" + vakkenArray[i] + " Cijfer:" + cijferArray[i] + " ECTS Behaald: " + 0); } } else { if (vakkenArray[i].equals("Project Fasten Your Seatbelts") &amp;&amp; (cijferArray[i] &gt;= 5.5)) { System.out.println("Vak/Project:" + vakkenArray[i] + " Cijfer:" + cijferArray[i] + " ECTS Behaald: " + ECTS_PROJECT); ects = ects + 12; } else { System.out.println("Vak/Project:" + vakkenArray[i] + " Cijfer:" + cijferArray[i] + " ECTS Behaald: " + 0); } if (vakkenArray[i].equals("Project Agile Developement") &amp;&amp; (cijferArray[i] &gt;= 5.5)) { System.out.println("Vak/Project:" + vakkenArray[i] + " Cijfer:" + cijferArray[i] + " ECTS Behaald: " + ECTS_PROJECT); ects = ects + 12; } else { System.out.println("Vak/Project:" +…
has comment: http://stackoverflow.com/comment/40608754
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/40608312
favorite count: 0

http://stackoverflow.com/comment/110797685
has text: Arrays.asList references an array (obviously): http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/be44bff34df4/src/share/classes/java/util/Arrays.java#l3810 Collections.singletonList: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/be44bff34df4/src/share/classes/java/util/Collections.java#l4801
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26039540
type: AnswerComment

http://stackoverflow.com/q/25891283
has answer: http://stackoverflow.com/a/25925042
accepted answer: http://stackoverflow.com/a/25893263
has comment: http://stackoverflow.com/comment/40521446
upvote count: 2
answer count: 3
downvote count: 1
has body: I am trying to parse a csv string like this COL1,COL2,COL3 1,2,3 2,4,5 and map columns to a java object- Class Person{ COL1, COL2, COL3; } Most of the libraries I found on google are for csv files but I am working with google app engine so can't write or read files. currently I am using split method but problems with this approach is column that I am getting in csv string could vary as COL1,COL3,COL2 don't want to use boiler plate code of splitting and getting each column.so what I need is list of column header and read all columns in a collection using header mapper. While iterating, map column value to a java object. There are several question based on similar type of requirement but none of them helped me. If anyone has done this before please could you share the idea? Thanks!
tagged with: java
has title: Parse a csv String and map to a java object
has answer: http://stackoverflow.com/a/25891509
has answer: http://stackoverflow.com/a/25893263
type: AnsweredQuestion
score: 1
favorite count: 0
type: Question
tagged with: google-app-engine
tagged with: http://stackoverflow.com/tag/csv
possible better answer: http://stackoverflow.com/a/25925042

http://stackoverflow.com/comment/40542580
type: Comment
has text: _East Doncaster Baptist Church_ (had to google it)
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/25902771

http://stackoverflow.com/comment/40625271
type: AnswerComment
comment on: http://stackoverflow.com/a/25949118
has text: the trick is to prevent null pointer exception in the method that doesn't throw it.
type: Comment
score: 0

http://stackoverflow.com/comment/40747932
comment on: http://stackoverflow.com/a/26010212
type: AnswerComment
score: 0
type: Comment
has text: Can you give any reference to your last sentence? Also can you give a shot at answering my point b) at bottom of question

http://stackoverflow.com/q/26031402
favorite count: 0
tagged with: windows
linked to: http://stackoverflow.com/q/25933941
has title: Cygwin command through java application on windows
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: nutch
upvote count: 1
has comment: http://stackoverflow.com/comment/44012227
type: Question
tagged with: cygwin
tagged with: hadoop
linked to: http://stackoverflow.com/q/16468685
has body: I am working with nutch 1.9 on windows using cygwin and it works well. Already asked How to run nutch 1.9 in eclipse on windows? but not getting any answer yet. Is there any way to run cygwin command through java program? I created a script file and tried to execute from batch file using cygwin bash, but it cause "file does not exists" for storing crawled data. print.sh #!/bin/bash cd /cygdrive/c/cygwin/home/apache-nutch-1.9/ bin/crawl urls/ crawlresult/ http://localhost:8983/solr/test 1 sample.bat C:\cygwin\bin\bash C:\Users\user\Desktop\print.sh Error Fetcher: org.apache.hadoop.mapred.InvalidInputException: Input path does not exist: file:/C:/cygwin/home/apache-nutch-1.9/crawlresult/segments/crawl_generate at org.apache.hadoop.mapred.FileInputFormat.listStatus(FileInputFormat.j ava:190) I can run nutch command from cygwin terminal, but fails when running script file as above.
downvote count: 0
score: 1

rounding
tags question: http://stackoverflow.com/q/25895696
tags question: http://stackoverflow.com/q/25981349
tags question: http://stackoverflow.com/q/25952616
tag name: rounding
type: Tag

http://stackoverflow.com/q/25979034
has comment: http://stackoverflow.com/comment/40679953
answer count: 1
has body: Write a sensor input method that takes as parameters a Scanner and a minimum allowable sensor value (a double). This method returns a double. This method must read a double as input from the Scanner. If this value is at or above the minimum value, then this value is returned by the method. If the value is below the minimum, then the method must prompt the user for another value. This is repeated until the minimum constraint is met. If the value is not a double (indicating that the user is done entering input), then the method must return Double.NaN. This is a special double value, Not-A-Number, that we will use here to indicate that there are no other values to be entered. Write a main method that calls your sensor input method repeatedly until NaN is returned. When NaN is returned, your main method reports the mean of the entered values and halts. code: import java.util.Scanner; public class Mean { public static double averageTemperature(Scanner input, double lowestTemp) { double temp = input.nextDouble(); if(temp &gt;= lowestTemp) return temp; while(temp &lt; lowestTemp) { System.out.println("Invalid temperature. Please Re-enter: "); averageTemperature(input,lowestTemp); } return Double.NaN; } public static void main(String[] args) { System.out.println("Enter the Temperature: "); Scanner input = new Scanner(System.in); double value = 0; double sum = 0; int i = 0; do{ value = averageTemperature(input, -10); if(value != Double.NaN) { sum += value; i++; } }while(value != Double.NaN); double mean = sum / i; System.out.println("The average temperature is: " + mean); } }
has comment: http://stackoverflow.com/comment/40679811
favorite count: 0
has title: What am I missing here? It's supposed to read a double and calculate the average of all the doubles entered and ends when Double.NaN is returned
has answer: http://stackoverflow.com/a/25979273
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40679995
tagged with: java
downvote count: 2
tagged with: methods
type: Question
upvote count: 0
score: -2

http://stackoverflow.com/comment/40505696
has text: I think they have the same meaning here.
type: AnswerComment
comment on: http://stackoverflow.com/a/25882358
score: 0
type: Comment

http://stackoverflow.com/q/25964779
has comment: http://stackoverflow.com/comment/40654571
has comment: http://stackoverflow.com/comment/40654316
upvote count: 0
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/9585764
has answer: http://stackoverflow.com/a/25965218
type: Question
has title: storing and using arraylist data returned from list<variables> function
has comment: http://stackoverflow.com/comment/40654207
score: -1
has body: hi im trying to store data returned from a database so i can use it in my application, after finding newbie attempt to use Java ArrayList to store ResultSet obtained from database i made the following code which seems to work fine; code for stordetails: public class StoryDetails { public int id; public String genre; public String category; public String title; public int chapters; public int current; public Date checked; } code for stroring the data: List&lt;StoryDetails&gt; storyData = new ArrayList&lt;StoryDetails&gt;(); while (resultSet.next()) { StoryDetails story = new StoryDetails(); story.id = resultSet.getInt("ID"); story.genre = resultSet.getString("GENRE"); story.category = resultSet.getString("CATEGORY"); story.title = resultSet.getString("TITLE"); story.chapters = resultSet.getInt("CHAPTERS"); story.current = resultSet.getInt("CURRENT"); story.checked = resultSet.getDate("CHECKED"); storyData.add(story); } return storyData; the problem im having is i cant figure how to store and use the data thats returned from this. any help is appreciated. i currently have List&lt;StoryDetails&gt; list = dao.displayAll(query); for(StoryDetails obj : list){ System.out.println(String.valueOf(obj[0])); } but it doesnt work. the answer turned out to be: List&lt;StoryDetails&gt; list = dao.displayAll(query); //for all for(StoryDetails obj : list){ System.out.println(obj.id); System.out.println(obj.category); } //for specific System.out.println(list.get(0).category);
has comment: http://stackoverflow.com/comment/40654375
tagged with: arraylist
tagged with: function
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40653495
favorite count: 0

http://stackoverflow.com/comment/40586533
type: Comment
has text: As I can see method is declared to accept arguments of type string and generic class `openSecondOrThirdPage(String secondPgUrl, Class<T> expectedPage)` but I assume you pass wrong arguments `openSecondOrThirdPage(driver, SecondPage.class)` because I bet your `driver` is an instance of WebDriver class. Isn't it?
score: 0
comment on: http://stackoverflow.com/q/25920664
type: QuestionComment

http://stackoverflow.com/a/25936604
answers question: http://stackoverflow.com/q/25936422
has comment: http://stackoverflow.com/comment/40604514
has comment: http://stackoverflow.com/comment/40606503
has comment: http://stackoverflow.com/comment/40620221
type: Answer
has comment: http://stackoverflow.com/comment/40615891
has comment: http://stackoverflow.com/comment/40624214
has comment: http://stackoverflow.com/comment/40620640
has comment: http://stackoverflow.com/comment/40604173
has body: I suspect this is the problem: &lt;attribute name="Main-Class" value="Main"/&gt; It should be: &lt;attribute name="Main-Class" value="com.cfsware.osco.test.Main"/&gt; ... in other words, the fully-qualified name of the class. Your Java file should be in a directory matching the package declaration, too.
has comment: http://stackoverflow.com/comment/40609368
has comment: http://stackoverflow.com/comment/40606706
has comment: http://stackoverflow.com/comment/40621066
score: 0

http://stackoverflow.com/q/25910909
score: 3
has comment: http://stackoverflow.com/comment/40564721
has comment: http://stackoverflow.com/comment/43649010
tagged with: spring-websocket
tagged with: java
tagged with: eclipse
answer count: 2
downvote count: 0
has body: How to create a Spring Java Web socket project with XML or Java Config but without Spring Boot. Where can I find a step-by-step tutorial. I dont know how to use spring boot in ecliplse. Also I dont want to use gradle or maven. I did not find a tutorial to use spring boot in eclipse. As I am new to spring I am unable to start a project without maven or gradle. I need to learn how to create a spring project without any built tool provided I need to use Eclipse. This is purly for learning puropse. Below is the classes I used to replace Spring boot related main class AppConfig Class import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @Configuration @ComponentScan("hello") @EnableWebMvc public class AppConfig { } WebAppInitializer Class import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration.Dynamic; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; public class WebAppInitializer implements WebApplicationInitializer{// extends AbstractAnnotationConfigDispatcherServletInitializer { public void onStartup(ServletContext servletContext) throws ServletException { try { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(AppConfig.class); ctx.setServletContext(servletContext); Dynamic dynamic = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dynamic.addMapping("/"); // dynamic.addMapping("/springStomp/"); dynamic.setLoadOnStartup(1); //dynamic.setAsyncSupported(true); //ctx.refresh(); System.out.println("config done"); } catch(Exception e) { e.printStackTrace(); System.out.println("error"); } } } WebSocketConfig Class import org.springframework.context.annotat…
has comment: http://stackoverflow.com/comment/40557456
favorite count: 0
has title: Write a Spring Web Socket project without SpringBoot or Maven/Gradle
tagged with: spring
has comment: http://stackoverflow.com/comment/43656523
has answer: http://stackoverflow.com/a/35432767
has answer: http://stackoverflow.com/a/27963019
has comment: http://stackoverflow.com/comment/40558500
has comment: http://stackoverflow.com/comment/40590399
upvote count: 3
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/40557545
type: Question
has comment: http://stackoverflow.com/comment/40556964

akka
type: Tag
tags question: http://stackoverflow.com/q/25917613
tags question: http://stackoverflow.com/q/26017485
tags question: http://stackoverflow.com/q/25888380
tag name: akka
tags question: http://stackoverflow.com/q/25947543
tags question: http://stackoverflow.com/q/25938743

http://stackoverflow.com/a/25931294
type: Answer
has body: You need to ecsape { character otherwise you will get PatternSyntaxException and in order to capture digits \\d+. Lastly matcher.group(1) will return String , so you need to cast it to Integer Below is a sample import java.util.HashMap; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Registrar { public static void main(String[] args) { String input = "Dear {0}, \n" + "You are being contacted because the '{1}' named '{2}' has been changed by '{3}' in the Application. These changes may impact any existing reports you are using which depend upon this information. If you have not authorized these changes, please contact '{4}' or send a request to IT Support to have the changes reversed"; Pattern pattern = Pattern.compile("\\{(\\d+)}"); HashMap&lt;Integer, String&gt; map = new HashMap&lt;&gt;(); map.put(0, "zero"); map.put(1, "one"); map.put(2, "two"); map.put(3, "three"); map.put(4, "four"); Matcher matcher = pattern.matcher(input); while (matcher.find()) { String val = matcher.group(1); String group = matcher.group(); input = input.replace(group, map.get(Integer.parseInt(val))); } System.out.println(input); } } And it outputs Dear zero, You are being contacted because the 'one' named 'two' has been changed by 'three' in the Application. These changes may impact any existing reports you are using which depend upon this information. If you have not authorized these changes, please contact 'four' or send a request to IT Support to have the changes reversed
score: 0
answers question: http://stackoverflow.com/q/25931091

http://stackoverflow.com/q/25912144
has comment: http://stackoverflow.com/comment/101800227
answer count: 0
has comment: http://stackoverflow.com/comment/40603004
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40563946
has comment: http://stackoverflow.com/comment/40594751
has comment: http://stackoverflow.com/comment/40563785
tagged with: spring
has comment: http://stackoverflow.com/comment/101840554
has body: Is there a way to use existing legacy hibernate mapping files (hbms) with spring jpa LocalContainerEntityManagerFactoryBean . configuration : Hibernate Version : 4.2.5.Final , Spring version : 4.0.3.RELEASE . Running in Tomcat 7 servlet container. I agree that this is unreasonable but the project manager whants to migrate the code to spring and hibernate 4 and not the hbm files. I tested the application with jpa annotated entities and it works great. but , it I try to use hbm it wont. I ended up writing somothing like this but didn't work. HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter(); jpaVendorAdapter.setDatabase(Database.MYSQL); jpaVendorAdapter.setShowSql(true); LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(configureDataSource()); entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter); entityManagerFactoryBean.setPersistenceXmlLocation("META-INF/persistence.xml"); and in persistence.xml : &lt;?xml version="1.0"?&gt; &lt;persistence version="1.0"&gt; &lt;persistence-unit name="easysApp" &gt; &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt; &lt;properties&gt; &lt;!-- Scan for annotated classes and Hibernate mapping XML files --&gt; &lt;property name="hibernate.archive.autodetection" value="hbm"/&gt; &lt;property name="hibernate.hbm2ddl.auto" value="validate" /&gt; &lt;property name="hibernate.show_sql" value="true" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; then i get this stack trace : WARN 2014-09-19 10:59:00,148 (InputStreamZippedJarVisitor.java:66) - HHH015010: Unable to find file (ignored): jndi:/localhost/Migration ava.io.FileNotFoundException: jndi:/localhost/Migration at org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnection.java:389) at java.net.URL.openStream(URL.java:1037) at org.hibernate.ejb.packaging.InputStreamZippedJarVis…
has comment: http://stackoverflow.com/comment/40564248
has comment: http://stackoverflow.com/comment/40594258
has comment: http://stackoverflow.com/comment/40575638
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40564872
has comment: http://stackoverflow.com/comment/40565394
tagged with: orm
has comment: http://stackoverflow.com/comment/101800201
type: Question
has comment: http://stackoverflow.com/comment/40570397
has comment: http://stackoverflow.com/comment/40563909
has comment: http://stackoverflow.com/comment/40576184
has comment: http://stackoverflow.com/comment/40565025
has comment: http://stackoverflow.com/comment/40559638
tagged with: jpa
has title: using jpa with legacy hbm files
has comment: http://stackoverflow.com/comment/40594667
has comment: http://stackoverflow.com/comment/40563970
score: 0
has comment: http://stackoverflow.com/comment/40594006
has comment: http://stackoverflow.com/comment/40594515
has comment: http://stackoverflow.com/comment/40565495
has comment: http://stackoverflow.com/comment/40560028
has comment: http://stackoverflow.com/comment/40594346

http://stackoverflow.com/comment/40757667
score: 0
comment on: http://stackoverflow.com/q/26021948
type: Comment
type: QuestionComment
has text: Use these Calculate the monthly payment using the following formulas: Monthly payment = (mIR * M) / (1 – (1 / (1 + mIR)(12*nOY) )), Where: mIR = monthly interest rate = annual interest rate / 12 nOY = number of years M = mortgage amount

http://stackoverflow.com/comment/40657554
type: QuestionComment
comment on: http://stackoverflow.com/q/25966734
has text: i printed # but still i am getting the output as # # # # # # # # #
score: 0
type: Comment

http://stackoverflow.com/comment/40534443
has text: Its better to use SHA-1 or SHA-256. MD5 is completely broken
comment on: http://stackoverflow.com/a/25897272
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25940044
has comment: http://stackoverflow.com/comment/40614993
answers question: http://stackoverflow.com/q/25939919
downvote count: 0
has comment: http://stackoverflow.com/comment/40614401
has body: There is an error in the loop for player2/computer's turn. It's in the first if-else loop, located in the else portion. input keyboard.nextLine(); should be input = keyboard.nextLine(); It works fine after correcting that error. Also, pay close attention to the compilation errors, they will point you towards which lines are generating said error. Revision: I think this works the way you intended it to. import java.util.*; public class Proj3Part1 { public static void main(String[] args) { int turnScore = 0; int totalScore = 0; int turnScore2 = 0; int totalScore2 = 0; final int WIN = 20; int dice = 0; int dice2 = 0; String input = "r"; String input2 = "r"; char repeat; Scanner keyboard = new Scanner(System.in); Scanner s = new Scanner (System.in); Random randomNumbers = new Random(); while(totalScore &lt; WIN &amp;&amp; totalScore2 &lt; WIN) { //Player 1's turn do { dice = randomNumbers.nextInt(6) + 1; System.out.println(); System.out.println("You rolled: " + dice); if(dice == 1) { turnScore = 0; System.out.println("Turn over."); System.out.println("Player 1 total is " + totalScore); break; } else { turnScore = dice; //removed +=??? think it's only the value of dice roll? //either way it's used to compute total, which would be redundant if not totalScore +=turnScore; //added to compute totalScore before turn is over System.out.print("Player 1 turn total is " + totalScore + " "); System.out.print("Enter (r)oll or (s)top: "); input = keyboard.nextLine(); repeat = input.charAt(0); if(repeat == 's') { System.out.println("Turn over."); System.out.print("Current score: Player 1 has " + totalScore); //previously total wasn't computed System.out.println(", Player 2 has " + totalScore2); break; } } }while(input.equalsIgnoreCase("r")); //totalScore += turnScore; was removed + curly braces that seemed to attach it to the above while loop //it isn't needed due to totalScore now being calculated after dice is rolled when !=1(else portion) if(totalScore &gt;= WIN) { System.out.prin…
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/40533808
type: Comment
type: QuestionComment
has text: Nobody can check what you're doing unless you provide the XML Schema so that it can be matched with the XPath expressions you are using in the bindings file. --- The XML Schema appears to have deeply nested anonymous types, which is bad. Can you change that - it doesn't mean to change the XML structure!
comment on: http://stackoverflow.com/q/25894994
score: 0

http://stackoverflow.com/q/25994952
has title: How to display number of records in the database on the HTML page dynamically
has body: I have a web application, in which the total number of registered users are displayed at the bottom of the page. This count is retrieved from the database table. Now, I want the count to be changed whenever a record is inserted in the DB table (a new user registered) without loading the page. So if a user gets registered now, the count need to be increased by one. Technologies used : HTML , Java
has answer: http://stackoverflow.com/a/25995057
has comment: http://stackoverflow.com/comment/40708077
score: 0
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/40708442
has comment: http://stackoverflow.com/comment/40708699
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25995088
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/40559497
score: 0
type: AnswerComment
type: Comment
has text: Thanks very much for the clear explanation hovercraft!
comment on: http://stackoverflow.com/a/25910943

http://stackoverflow.com/a/25950531
answers question: http://stackoverflow.com/q/25949693
has comment: http://stackoverflow.com/comment/40627566
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/40627481
has comment: http://stackoverflow.com/comment/40627662
accepted answer of: http://stackoverflow.com/q/25949693
type: AcceptedAnswer
type: Answer
has body: You're invoking rs.all() which, as the javadoc says, Returns all the remaining rows in this ResultSet as a list. Note that, contrary to iterator() or successive calls to one(), this method forces fetching the full content of the ResultSet at once, holding it all in memory in particular. It is thus recommended to prefer iterations through iterator() when possible, especially if the ResultSet can be big. So, when you then do Row one = rs.one(); which, as the javadoc states, returns the next row in this resultSet or null if this ResultSet is exhausted. it will return null since the ResultSet is exhausted. You would have seen Result set: ResultSet[ exhausted: false, Columns[doof(varchar)]] size: 1 fullyFetched:true in your logs which shows the row you added previously.

http://stackoverflow.com/a/25897119
downvote count: 0
answers question: http://stackoverflow.com/q/25896998
type: Answer
upvote count: 1
score: 1
has body: It is possible to log every sql fired by hibernate. you can have a rolling file configuration to get a new file every day. refer: http://logging.apache.org/log4j/1.2/manual.html I hope this helps.

http://stackoverflow.com/comment/40771198
type: Comment
has text: Well if it's a buffering issue, use `paintComponent` instead of `paint` as it will be within the components double buffering capacity. Also, you really should be using `getWidth` and `getHeight` instead of magic numbers
score: 0
comment on: http://stackoverflow.com/a/26029175
type: AnswerComment

http://stackoverflow.com/a/25925850
answers question: http://stackoverflow.com/q/25925722
has comment: http://stackoverflow.com/comment/40584910
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40585686
has comment: http://stackoverflow.com/comment/40584891
has body: Your main method lacks a body. public class TipCalc { public static void main(String[] args) { Scanner cin = new Scanner(System.in); System.out.println("Tip Calculator"); System.out.println("==============="); System.out.print("Enter check subtotal (9.25): "); double subtotal = cin.nextDouble(); System.out.print("Enter gratuity percentage (20): "); int gratuity = cin.nextInt(); System.out.println(""); double gratuityAmount = gratuity * .01 * subTotal; //Note: subTotal variable isn't defined System.out.println("\tGratuity: " + gratuityAmount); double total = gratuityAmount + subTotal; System.out.println("\tTotal: $" + total); } } That should help your formatting errors. The method body comes immediately after such as: public void doSomething(){ &lt;-begins body and ends with-> } In the beginning, methods are only briefly discussed but you will go more in-depth and get the hang of it.
has comment: http://stackoverflow.com/comment/40585055
has comment: http://stackoverflow.com/comment/40585238
score: 0
has comment: http://stackoverflow.com/comment/40585159
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40585503
type: Answer
accepted answer of: http://stackoverflow.com/q/25925722

http://stackoverflow.com/comment/40676031
has text: I have already written main method in my code but i don't know why this error showing again and again.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25977179

http://stackoverflow.com/comment/40613925
type: Comment
comment on: http://stackoverflow.com/a/25940767
has text: How is this data being used? If it's being used by other methods such as `methodB`, then you can use `methodB` and test its side effects.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25933308
upvote count: 2
has body: I don't know how you determine "is already present", but if it's any kind of database level constraint (probably on a primary key?) you can make use of the REPLACE INTO statement, which will create a record unless it gets an error in which case it'll update the record that prevents it from being inserted. It works just like INSERT basically: REPLACE INTO table ( id, field1, field2 ) VALUES ( 1, 'value1', 'value'2 ) If a row with ID 1 exists, it's updated with these values; otherwise it's created.
answers question: http://stackoverflow.com/q/25932971
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/40774593
comment on: http://stackoverflow.com/q/26030586
score: 0
type: Comment
type: QuestionComment
has text: from this https://jersey.java.net/documentation/latest/async.html and this https://www.adayinthelifeof.nl/2011/06/02/asynchronous-operations-in-rest/ RestFull webservice can be async. read it :)

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/25947376
tags question: http://stackoverflow.com/q/26001933
tags question: http://stackoverflow.com/q/25915984
type: Tag

http://stackoverflow.com/comment/40679695
type: QuestionComment
comment on: http://stackoverflow.com/q/25978928
has text: Are you testing each URL in a separate thread? If yes then it won't be efficient. In your case it means you'll be creating 20k threads!!! Also, use the disconnect() method. hope it helps.
score: 0
type: Comment

http://stackoverflow.com/comment/40737375
has text: Sorry, typo here. Its Charset.forName("UTF-8") not Class.forName("UTF-8").
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26010650
type: QuestionComment

http://stackoverflow.com/q/25905151
tagged with: hql
type: Question
tagged with: named-query
score: 0
linked to: http://stackoverflow.com/q/2536829
has body: I have the following two different HQL statements. My Data Structure looks like this: User @Entity (name = "User") public class User { @Id @GeneratedValue @Column (name = "id") private int id; @Column (name = "user_name") private String username; @Column (name = "password") private String password; @Column (name = "enabled") private boolean enabled; @ManyToMany (targetEntity = Role.class, cascade = { CascadeType.ALL }) @JoinTable (name = "user_role", joinColumns = { @JoinColumn (name = "user_id") }, inverseJoinColumns = { @JoinColumn (name = "role_id") }) private Set&lt;Role&gt; roles; /* getters and setters) } To cut it short the only difference between the two queries is that one is ASC the other is DESC @NamedQuery (name = "user.getUsersOrderByRoleAsc", query = "FROM User as u left outer join u.roles roles WHERE u.username like :username ORDER BY roles.name ASC"), @NamedQuery (name = "user.getUsersOrderByRoleDesc", query = "FROM User as u left outer join u.roles roles WHERE u.username like :username ORDER BY roles.name DESC"), The query for ASC returns: A list of Users -> As I would expect. The query of DESC returns: An List of Object[], and in each object the [0] is the User, while the [1] is just another null object. That does not make any sense to me. How can simply changing ASC to DESC change the structure of the result set ? I am using Hibernate 4.3.6.Final.
answer count: 2
has title: Hibernate does change the result set structure (puts Objects[]) into the result set when changing DESC to ASC on a many to many sorted column
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25905472
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25905464

http://stackoverflow.com/comment/40626397
type: Comment
type: QuestionComment
has text: did you have a look at http://stackoverflow.com/questions/21069733/jdo-persist-an-existing-entity-creats-new-entry-in-db?
score: 0
comment on: http://stackoverflow.com/q/25949867

http://stackoverflow.com/a/25982824
answers question: http://stackoverflow.com/q/25981283
has body: To answer your questions without giving your assignment away... 1) I need help with how constructor in CreditAccount looks like. How can I add local variable limit to the constructor? I suppose you're confused about "having" to implement the constructor of the base. Well, that doesn't prevent you from providing one specific to the needs of the sub. public CreditAccount(..., double limit) { //call the super from this this.limit = limit; } Is it better (easier) if I have a variable limit in base class instead, and let SavingsAccount Always set it to be zero, while CreditAccount let the user set the limit? Better; nope. Easier; that's subjective. Is it easier to set an untold number of sub class' needless variable easier than not including it in the first place? Easier isn't a factor that overrides good design. The whole point of all this is providing nice little data holders void of clutter. On top of that, it just doesn't seem right; does it; what does your gut say? My teacher says since SavingsAccount and CreditAccount are almost the same, @Override are exactly the same, he recommends me to implement those methods in base class (Account). How will the code look like if I do that? As opposed to the abstract class leaving the methods unimplemented, implement them. Put the simple getters inside the abstract class and remove them from the subs. The resulting code would look something like... public CreditAccount ... { protected double limit; //those constructors you need public double getLimit() { ... } } ...for starters.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25981283

http://stackoverflow.com/comment/40559082
comment on: http://stackoverflow.com/a/25904053
type: Comment
score: 2
has text: @nonex You shoulnd't point to elisp docs when talking about Common Lisp, the CLHS is a better reference. Particulary when elisp doesn't match CL's definitions. Elisp's if takes multiple else clauses, not so in CL. http://www.lispworks.com/documentation/HyperSpec/Body/s_if.htm
type: AnswerComment

http://stackoverflow.com/a/25907694
accepted answer of: http://stackoverflow.com/q/25906979
has body: I don't know, as you haven't provided any code, but if you have anti-aliasing enabled, that can cause the text to be displayed like it is: System.setProperty("awt.useSystemAAFontSettings","on"); System.setProperty("swing.aatext", "true"); Try removing these (if they exist), or setting them to "off" and "false" respectively.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25906979
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/25930984
answers question: http://stackoverflow.com/q/25927427
type: Answer
has body: Your problem is that you put the various components of the original object into an array and hope for it to magically become an object, when converted to JSON. To solve this, let CreateUser have a field deviceInfo of the type DeviceInfo. Similarly let DeviceInfo have a field infoof type Info and so on.
accepted answer of: http://stackoverflow.com/q/25927427
score: 0
type: AcceptedAnswer

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/25959795
type: Tag

http://stackoverflow.com/q/25935915
has answer: http://stackoverflow.com/a/25936465
linked to: http://stackoverflow.com/q/586363
has comment: http://stackoverflow.com/comment/40602935
accepted answer: http://stackoverflow.com/a/25936208
answer count: 2
downvote count: 0
favorite count: 0
has body: This is more of a conceptual question, so it's hard to post a small workable code sample. But, I have a class that overrides paintComponent here: public abstract class BasePanel extends JPanel { ... @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); this.standardDraw(drawObjects,g2); } } Basically, I'd like this to be the "standard way" this base panel draws if paintComponent is not overridden in a derived class. So, I have a derived class called AspectRatioPanel which I'd like to re-specify how it draws things: public class AspectRatioPanel extends BasePanel { ... @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); // Get ViewPort Bounding Box to clip BoundingBox viewPortBoundingBox = this.getViewPortBoundingBox(); // Clip to viewport g2.setClip((int)viewPortBoundingBox.topLeft.getX(),(int)viewPortBoundingBox.topLeft.getY(),(int)viewPortBoundingBox.getWidth(),(int)viewPortBoundingBox.getHeight()); this.standardDraw(drawObjectsBuf,g2); } } The problem I'm having is the call super.paintComponent(g) in the derived class. I intend for it to be calling paintComponent in JComponent, but it is going through BasePanel first. Is there a better way to approach this problem? I could delete the paintComponent method in BasePanel, but having a standard way of drawing things is useful for me. I also can't seem to call JComponent.paintComponent directly since it's protected. Is there a solution for this? Also, am I doing something conceptually wrong?
has answer: http://stackoverflow.com/a/25936208
possible better answer: http://stackoverflow.com/a/25936465
has title: Overriding paintComponent twice
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40603017
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/40602680

http://stackoverflow.com/q/26012779
has body: I'm making a minecraft mod and I don't know which one is more recommended. Block[] blocks = new Block[] {BlueBlock, MeatBlock, ....}; for (Block bls : blocks) GameRegistry.registerBlock(bls, bls.getUnlocalizedName().substring(5)); or GameRegistry.registerBlock(BlueBlock, "BlueBlock"); GameRegistry.registerBlock(MeatBlock, "MeatBlock"); GameRegistry.registerBlock(..., "...");
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26012943
tagged with: java
has answer: http://stackoverflow.com/a/26013042
accepted answer: http://stackoverflow.com/a/26013042
downvote count: 1
type: Question
has title: Which one is more memory efficient?
tagged with: minecraft-forge
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26012943
upvote count: 1

http://stackoverflow.com/q/25980582
has comment: http://stackoverflow.com/comment/40682575
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/40683971
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40683511
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40682791
tagged with: spring
answer count: 0
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/40685709
type: Question
has body: I have two classes. Now I have database access and want to get Lead value. Using Spring REST + JDBC. @XmlRootElement(name="newlead") public class NewLead { private String FIRSTNAME; private int LEADID; public String getFIRSTNAME() { return FIRSTNAME; } public void setFIRSTNAME(String FIRSTNAME) { this.FIRSTNAME = FIRSTNAME; } public int getLEADID() { return LEADID; } public void setLEADID(int LEADID) { this.LEADID = LEADID; } } and @XmlRootElement(name="newLeads") public class NewLeadList { @XmlElement(required = true) public List<NewLead> allLeads = new ArrayList<NewLead>(); @XmlElement(required = false) public List<NewLead> getData() { return allLeads; } public void setData(List<NewLead> data) { this.allLeads = data; } } My controller @Controller // Will be detected by <context:component-scan> @RequestMapping("/lead") // Will be detected by <mvc:annotation-driven> (more specifically by one of its component - RequestMappingHandlerMapping) public class LeadController { @Resource(name="newLeadService") private com.varazo.service.NewLeadService newLeadService; // This method should be called for requests to "/" @RequestMapping(value = "/newLeads", method = RequestMethod.GET, headers="Accept=application/xml,application/json") public @ResponseBody NewLeadList getNewLead() { // Call service here NewLeadList result = new NewLeadList(); result.setData(newLeadService.getAll()); System.out.println("*********************LeadController Retrieving all persons ***"+result+"***yes*************"); return result; } I am getting xml like 0 0 0 0 0 0 0 But I need each Lead value with firstname and id values. What is the problem here?
has title: Class has two properties of the same name

http://stackoverflow.com/a/25910076
accepted answer of: http://stackoverflow.com/q/25909854
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Application is unable to find MainActivity.tophone as your device is booted just and your application is yet no open it mean tophone variable is yet initialized. So it is firing NullPointerException because of No package identifier it mean it is unable to find resource with a given name which actually is null. Resolve : Declare value of tophone it self in Broadcast Store Value in SharedPreference in activity and fetch it in BroadcastReceiver
answers question: http://stackoverflow.com/q/25909854
has comment: http://stackoverflow.com/comment/40555458

http://stackoverflow.com/q/25956592
has answer: http://stackoverflow.com/a/25957372
has answer: http://stackoverflow.com/a/25956633
has comment: http://stackoverflow.com/comment/40638383
score: 0
answer count: 3
has title: Finding index out of bounds exception
has answer: http://stackoverflow.com/a/25956640
has body: All was well with this program until I made some changes in my addMainMenu method. Now it seems as though there is an array index out of bounds somewhere. Eclipse is not leading me too it. Does anyone know why this code has an array index out of bounds exception. Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.LinkedList.checkElementIndex(Unknown Source) at java.util.LinkedList.get(Unknown Source) at Menu.main(Menu.java:58) import java.util.LinkedList; import java.util.List; public class Menu { LinkedList &lt;LinkedList&gt; mainMenuItems = new LinkedList &lt;LinkedList&gt; (); public void Menu(){} public boolean addMainMenuItem(String newItem, String existingItem, int position){ LinkedList &lt;String&gt; subMenuItems = new LinkedList &lt;String&gt; (); for (int i = 0; i&lt;= mainMenuItems.size(); i++){ if (mainMenuItems.get(i).contains(existingItem)){ subMenuItems.addLast(newItem); int existingIndex = mainMenuItems.indexOf(existingItem); if (position == 1){ mainMenuItems.add(existingIndex + 1, subMenuItems); break; } if (position == -1){ mainMenuItems.add(existingIndex, subMenuItems); break; } if (i == mainMenuItems.size()){ subMenuItems.addLast(newItem); mainMenuItems.add(subMenuItems); break; } } } } return true; } public boolean deleteMainMenuItem(String item){ if (mainMenuItems.contains(mainMenuItems.indexOf(item))){ mainMenuItems.remove(mainMenuItems.indexOf(item)); return true; } else{ return false; } } public static void main(String[] args){ Menu b = new Menu(); b.addMainMenuItem("h", "b", 1); b.addMainMenuItem("hi", "h", 1); b.addMainMenuItem("i", "h", 1); System.out.println(b.mainMenuItems.get(0)); b.deleteMainMenuItem("hi"); System.out.println(b.mainMenuItems.get(0)); System.out.println(b.deleteMainMenuItem("hi")); }
favorite count: 0
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/40639618
has comment: http://stackoverflow.com/comment/40638782
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40638372
accepted answer: http://stackoverflow.com/a/25956640
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/40638379
type: Question
possible better answer: http://stackoverflow.com/a/25956633

http://stackoverflow.com/comment/40689802
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25984389
has text: What is the expected input? For example, am I entering, for John Doe, `Doe John` or `Doe, John`? These will have two different solutions.
score: 0

http://stackoverflow.com/comment/40701496
type: AnswerComment
type: Comment
has text: but i want to check the order. will Lists.transform preserve order?
comment on: http://stackoverflow.com/a/25990212
score: 0

http://stackoverflow.com/a/25967333
downvote count: 2
upvote count: 0
answers question: http://stackoverflow.com/q/25967177
type: Answer
score: -2
has body: When there aren't any curly braces around around code after a for statement in Java, the very next line is the only line processed as part of the for statement. In this case, the for is like a function that calls the next line of code, which is a for statement that then calls the next line of code. So the first for calls the second for which evaluates to see if the two sides are the same, and if they aren't then it kicks back up to the second for which continues incrementing itself until it finishes and then it returns to the first for, which increments, and calls the second for... and so on. That code seems like it's partially broken, though, since it would have to have all numbers in numeric order, and it doesn't check anything in the middle. For instance: {1, 2, 3, 1} //evaluates to true because 1-1=0, although it should be false {6, 2, 2, 3} //evaluates to true because 6-3-2=0, although it should be false {2, 3, 4, 6} //evaluates to true because 2+3-6=0, although it should be false

http://stackoverflow.com/a/25980174
has body: Your problem is you need to return the new node that is created to set it as root. Or you could also expose an setter for root node Use this code for you method private static Tree insertintree(tree root, int input) throws EmptyQueueException { LLQueue Q =new LLQueue(); tree temp = null; int temp1; tree newnode =new tree(); newnode.setdata(input); newnode.setleft(null); newnode.setright(null); if(newnode ==null){ System.out.println("memory error"); return null; } return newnode; } And you code in main will change to switch(choice){ case 1: System.out.println("insert here"); int input =Integer.parseInt(br.readLine()); Tree treeNode = insertintree(root,input); if(treeNode!=null &amp;&amp; root==null) {root = treeNode;} break;
score: 0
answers question: http://stackoverflow.com/q/25980000
type: Answer

http://stackoverflow.com/comment/40547993
type: QuestionComment
comment on: http://stackoverflow.com/q/25905901
has text: thanks, my issue is that i am creating global objects that are populated when i start the game, destroyed whilst playing and then re-populated when the user has another go. do I take it that when I call remove() and delete all referances in arrays etc that the garbage collector will then clean up after me automatically? -- **edit just read through some of the further reading suggested in the other post and I think i have my answer.
score: 0
type: Comment

http://stackoverflow.com/comment/116320310
type: AnswerComment
comment on: http://stackoverflow.com/a/25949646
has text: How do you install the new SWT version? I guess I'd have to add the path to the CLASSPATH of eclipse, but I cannot find the way.
score: 0
type: Comment

session
tags question: http://stackoverflow.com/q/25915696
tags question: http://stackoverflow.com/q/25922151
tags question: http://stackoverflow.com/q/25972440
tags question: http://stackoverflow.com/q/25956591
type: Tag
tags question: http://stackoverflow.com/q/25971265
tags question: http://stackoverflow.com/q/25969544
tags question: http://stackoverflow.com/q/25934968
tag name: session
tags question: http://stackoverflow.com/q/25893476
tags question: http://stackoverflow.com/q/25884727

http://stackoverflow.com/comment/40706400
has text: why not try the simple approach of appending trx_log.2014-09-22-12-42 to your log statements from you classes. This is good in case if you are implementing logger from scratch in your prj but in other case can you check the pattern layout for your appender where you can configure the ConversionPattern
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25993787

http://stackoverflow.com/comment/40658245
comment on: http://stackoverflow.com/q/25901715
score: 0
has text: -1 for ignoring all comments and replies. A multidimensional array needs multiple indices; if you don't know that you need go back to basics.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40742582
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/26013785
type: Comment
has text: Yup. As explained [here](http://stackoverflow.com/questions/288861/eclipse-optimize-imports-to-include-static-imports).

http://stackoverflow.com/comment/40734918
type: QuestionComment
score: 0
has text: show code on what you've tried so far
comment on: http://stackoverflow.com/q/26009456
type: Comment

http://stackoverflow.com/q/25965833
type: AnsweredQuestion
tagged with: view
tagged with: java
type: Question
tagged with: libgdx
has body: I am making a LibGDX app, and I need to get the view to put to an Android app. Here is the code to get the view: package jangkoo.game.shadowfiend.android; import jangkoo.game.shadowfiend.ShadowFiendGame; import android.os.Bundle; import android.util.Log; import android.view.View; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; public class LibGdx extends AndroidApplication { private static final String TAG = "LibGDx"; public View view; Bundle savedInstanceState; @Override protected void onCreate (Bundle savedInstanceState) { if(savedInstanceState == null) this.savedInstanceState = getIntent().getExtras(); Log.e(TAG,savedInstanceState + ""); super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); view = initializeForView(new ShadowFiendGame(), config); } public LibGdx(){ onCreate(new Bundle()); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); } } And I want to get the libGDX.view from this,for a class that doesn't extend AndroidApplication. protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); interstitialAd = new IntestialAds(this); inflater = LayoutInflater.from(this); config = new AndroidApplicationConfiguration(); libGdx = new LibGdx(); Log.e(TAG,libGdx.view + ""); } However, the onCreate function has nullpointer exception. How can I handle this?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25968826
accepted answer: http://stackoverflow.com/a/25968826
has title: get view from libGDX application Android
tagged with: android

http://stackoverflow.com/q/26033851
has body: I have 3 web applications and a CAS Server. Two of applications and CAS server are in Java and work correctly, but I want my third application witch is in Python to use CAS server for authentication. How can I implement this? I tried to use this client but it didn't work, and also there is no example to use this client with Django on the web. Is there any other CAS client or an example of using this client?
score: 0
answer count: 1
tagged with: cas
has title: Integrating Java CAS Server and Python CAS Client
tagged with: django
tagged with: python
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26053136
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26053136

http://stackoverflow.com/comment/40563092
score: 1
has text: can i get back the string from ByteBuffer ?
type: AnswerComment
comment on: http://stackoverflow.com/a/25913982
type: Comment

http://stackoverflow.com/a/25989982
score: 0
answers question: http://stackoverflow.com/q/25989798
type: Answer
has body: Why don't you simply keep your getter and setter? public int x; public getX() { return x; } public setX(int x) { this.x = x; }
has comment: http://stackoverflow.com/comment/40699548
has comment: http://stackoverflow.com/comment/40699942
has comment: http://stackoverflow.com/comment/40732926

http://stackoverflow.com/comment/40748334
score: 0
type: AnswerComment
has text: @dalawh you either haven read the configuration or something is calling LogManager.reset. Call LogManager.getProperty to verify that your settings were loaded before you create your file handler.
type: Comment
comment on: http://stackoverflow.com/a/25982686

http://stackoverflow.com/comment/40510518
type: AnswerComment
type: Comment
has text: +1, and feel free to incorporate my regex into the answer and I'll delete mine.
comment on: http://stackoverflow.com/a/25884652
score: 0

http://stackoverflow.com/comment/40546403
type: Comment
comment on: http://stackoverflow.com/a/25898797
type: AnswerComment
has text: sounds great..!! but we will be moving into production by next month . so is there any compiled version of this (.so or .ll file) that i can run it in impala 1.2.4 by creating temporary function or by any other means ?
score: 0

http://stackoverflow.com/comment/40620319
has text: how would this help the cause.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25940789
type: AnswerComment

http://stackoverflow.com/a/28856458
has body: Am I missing something, or is that unlikely to be the intended behaviour? Looks like that is the intended behavior per the comment: // getDataContentHandler always uses these 'wrapper' handlers // to make sure it returns SOMETHING meaningful... If you look closely at the code, the 'dataContentHandler' is passed as an argument to 'new DataSourceDataContentHandler' and 'new ObjectDataContentHandler'. That is the 'wrapping' referred to in the comment.
type: Answer
accepted answer of: http://stackoverflow.com/q/25997263
downvote count: 0
answers question: http://stackoverflow.com/q/25997263
score: 1
upvote count: 1
type: AcceptedAnswer

inner-classes
tags question: http://stackoverflow.com/q/25991377
type: Tag
tags question: http://stackoverflow.com/q/26021770
tags question: http://stackoverflow.com/q/25977149
tags question: http://stackoverflow.com/q/25985956
tag name: inner-classes

http://stackoverflow.com/comment/40517582
type: QuestionComment
has text: No, I'm afraid I'm not using Tomcat by myself. However, I'm pretty sure that's the reason why your Tomcat2 instance connects to your Tomcat1-Datasource, because it does do the JNDI lookup with Tomcat1's naming provider.
comment on: http://stackoverflow.com/q/25883588
score: 0
type: Comment

http://stackoverflow.com/q/25977197
possible better answer: http://stackoverflow.com/a/31090064
upvote count: 3
tagged with: java
type: Question
tagged with: jodatime
tagged with: local
has comment: http://stackoverflow.com/comment/40676098
has title: Convert UTC to LocalDateTime in Joda?
has answer: http://stackoverflow.com/a/25977413
linked to: http://stackoverflow.com/q/6239976
answer count: 3
has answer: http://stackoverflow.com/a/31090064
has answer: http://stackoverflow.com/a/25977300
accepted answer: http://stackoverflow.com/a/25977300
downvote count: 0
favorite count: 0
has body: DateTime dt = new DateTime("2014-09-15T21:20:14"); System.out.println(dt); System.out.println(dt.plusMillis(581042272).toDateTime().toLocalDateTime().toDateTime(DateTimeZone.forID("GMT"))); the time in dt is in UTC, I want to set the time in dt plus milliseconds to GMT? However, the time is still printed as UTC (1 hour behind GMT). How can I set it so it's one hour in front? 2014-09-15T21:20:14.000+01:00 2014-09-22T14:44:16.272Z I know the time is exactly one hour behind because I made this request at 15:44:16 GMT
tagged with: time
has comment: http://stackoverflow.com/comment/40676067
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/25991638
has comment: http://stackoverflow.com/comment/40702614
score: 3
type: Answer
has body: Inner classes were a late entry to Java. When they were added they were added as a compiler extension only, no change to the JVM. The language spec stated that an inner class was allowed to access the private members of the class that it was declared within; that includes other inner classes. To make it work, the compiler generates bridge methods. Using javap with Main$A from the example above looks like this: Notice the addition of access$200 and access$300. They provide back door access to the private method and field respectively. class Main$A { Main$A(Main$1); Code: 0: aload_0 1: invokespecial #3 // Method "&lt;init&gt;":()V 4: return static void access$200(Main$A); Code: 0: aload_0 1: invokespecial #2 // Method foo:()V 4: return static int access$300(Main$A); Code: 0: aload_0 1: getfield #1 // Field a:I 4: ireturn } For completeness, here is the generated code for Main$B. Notice the calls to access$200 and 300, they appear where super.a and super.foo() appeared in the Java code. class Main$B extends Main$A { public Main$B(); Code: 0: aload_0 1: aconst_null 2: invokespecial #1 // Method Main$A."&lt;init&gt;":(LMain$1;)V 5: aload_0 6: invokestatic #2 // Method Main$A.access$100:(LMain$A;)V 9: getstatic #3 // Field java/lang/System.out:Ljava/io/PrintStream; 12: aload_0 13: invokestatic #4 // Method Main$A.access$200:(LMain$A;)I 16: invokevirtual #5 // Method java/io/PrintStream.println:(I)V 19: return } And if it is legal, why it is possible only via "super.XXX" construct? private fields are not usually part of the compilers resolution path for fields, by forcing developers to specify super the compiler is making certain that private access is what was meant and not a mistake.
accepted answer of: http://stackoverflow.com/q/25991377
answers question: http://stackoverflow.com/q/25991377
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25934887
score: 1
accepted answer of: http://stackoverflow.com/q/25934663
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25934663
has body: To be simple, an abstract class means you cannot create a new instance of this class. However, it's still possible to declare an object as a Ship (compile-time type vs runtime type) to use the polymorphism, allows you to do some funny stuff like an array of Ship which contains both Submarine and Destroyer (and many more). Ship[] army = new Ship[2]; army[0] = new Submarine("0"); army[1] = new Destroyer("1"); for( Ship s : army ) { s.fire(); } In this sample, we can invoke fire() on the two object because fire() is a method of Ship. As the ship's attack depends on the ship's type (a submarine will not fire like a destroyer), you set the fire() method of Ship abstract and implements it in Submarine and Destroyer. These tricks are essential in OOP, and allows you to implement powerful design patterns. If you're a beginner, looks at the strategy pattern and the template method pattern, they changed my vision of OOP few years ago ;) Hope this little sample helps you :)
upvote count: 1

http://stackoverflow.com/q/25931856
tagged with: java-8
has answer: http://stackoverflow.com/a/25934962
tagged with: java
has body: I am newbie to nashorn engine.In my java code i specify the javascript path in filereader but it throws filenotfoundexception in runtime.If i put my javascript in desktop and give that location my code is works.but If i put my javascript function in one of the folder in project it's not work throws file not found exception. Here is my error code engine.eval(new FileReader("res/nashorn1.js")); Here is my working code engine.eval(new FileReader("C:/Users/selva/Desktop/res/nashorn1.js")); I am using java stand alone application. My Code public class Nashorn1 { public static void main(String[] args) throws Exception { ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn"); engine.eval(new FileReader("C:/Users/selva/Desktop/res/nashorn1.js")); Invocable invocable = (Invocable) engine; Object result = invocable.invokeFunction("fun1", "Peter Parker"); System.out.println(result); System.out.println(result.getClass()); invocable.invokeFunction("fun2", new Date()); invocable.invokeFunction("fun2", LocalDateTime.now()); invocable.invokeFunction("fun2", new Person()); } } nashorn1.js var fun1 = function(name) { print('Hi there from Javascript, ' + name); return "greetings from javascript"; }; var fun2 = function (object) { print("JS Class Definition: " + Object.prototype.toString.call(object)); }; Any help would be Greatly Appreciated!!
upvote count: 1
downvote count: 1
type: Question
tagged with: nashorn
tagged with: javascript
has title: File not found exception in executing javascript in Nashorn
score: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25904779
has answer: http://stackoverflow.com/a/25905116
tagged with: java
has body: I have read every page that shows up on the first Google result page with that search. But nothing seems to help. Of course I can run "mvn clean install" in or out of Eclipse and get the .war generated in the target folder. I can copy the .war in the deployments folder of JBoss installation myself. And then I can start the server through the server adapter in Eclipse. But I want that "manual copy of war" to be automatic as well. How can I do this? What do I need to do to add a new item to "Run As" menu, say, "Maven JBoss Deploy" where underneath, it does a clean, install, deploy (copy to deployments)? I have Maven 3.1.1 installed separately (outside of Eclipse) and I have told Eclipse where my Maven is. I have JBoss Tools (latest version) installed with JBoss Maven Integration part of it. I just don't see any way to integrate JBoss and Maven within Eclipse :(
tagged with: jboss
tagged with: eclipse
has answer: http://stackoverflow.com/a/25936509
type: Question
has comment: http://stackoverflow.com/comment/40569011
has title: How to deploy a Maven WAR to JBoss EAP 6.3 within Eclipse Luna
linked to: http://stackoverflow.com/q/4656946
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40546670
tagged with: deployment
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/q/26025718
upvote count: 1
has body: Does the Spring PropertyPlaceholderConfigurer take a directory location and load all properties file, without me having to specify the file names explicitly. <property name="location" value="<path to all properties files>" /> Is there any other way to achieve this?
has title: PropertyPlaceholderConfigurer - Can it load all files from given directory path?
type: Question
accepted answer: http://stackoverflow.com/a/26026662
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26026662
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/40660836
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25964758
has text: Thank you for your reply! The links helped me learn a lot about securing applications which I was lacking.
type: AnswerComment

http://stackoverflow.com/q/25945044
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26026579
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26026579
downvote count: 0
has answer: http://stackoverflow.com/a/25945058
has body: I am writing a custom serializer to convert double values into strings in JSON objects. My code so far: public String toJson(Object obj) throws IOException { ObjectMapper mapper = new ObjectMapper(); SimpleModule module = new SimpleModule("DoubleSerializer", new Version(1, 0, 0, "")); module.addSerializer(Double.class, new DoubleSerializer()); mapper.registerModule(module); return mapper.writeValueAsString(obj); } public class DoubleSerializer extends JsonSerializer&lt;Double&gt; { @Override public void serialize(Double value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { String realString = new BigDecimal(value).toPlainString(); jgen.writeString(realString); } } This works perfectly fine with Double (class members) but does not work for double (primitive type) members. For example, public void test() throws IOException { JsonMaker pr = new JsonMaker(); TestClass cl = new TestClass(); System.out.println(pr.toJson(cl)); } class TestClass { public Double x; public double y; public TestClass() { x = y = 1111142143543543534645145325d; } } Returns: {"x":"1111142143543543565865975808","y":1.1111421435435436E27} Is there a way to make it follow same behavior for both cases?
tagged with: jackson
favorite count: 0
accepted answer: http://stackoverflow.com/a/25945058
upvote count: 3
has title: Jackson serializer for primitive types
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/25978267
upvote count: 1
answer count: 1
tagged with: junit
favorite count: 0
tagged with: jenkins
tagged with: maven
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: This is a maven build, running on Jenkins. Version numbers listed at the end of this post. I'm trying to figure out how to abort my build when I get an error in the generate-test-resources phase. Requirement: During maven's generate-test-resources phase, I have processes that run on a remote server (iSeries). From those calls, I retrieve a success flag (true or false). When I get false, I'd like to mark the ENTIRE build as BUILD FAILURE, and abort the build. The code I run in generate-test-resources is in Java, but it submits jobs to the iSeries, and the real work is done in those submitted jobs. Rational: My primary purpose of this build it to execute JUnit test cases. The generate-test-resources phase calls processes to initialize the test environment. If the generate-test-resources phase is not 100% successful, the tests will likely pass, but those results would be invalid. Furthermore, when generate-test-resources has issues, but all the test cases pass, Jenkins reports BUILD SUCCESS. Very strange. Example: Here is an example from my log. I know that my call to MY_BUILD_COMMAND calls back to the server correctly, and it is successful most days. But when there is an error, I need to trap it. Notice I have the status at "success? = false" 23:11:33.982 INFO BuildTestEnvironment | -- Begin BuildTestEnvironment --------------------- 23:11:35.224 INFO BuildTestEnvironment | Connected to VQ_INSCI10 as VQCINSCI10 23:11:35.292 INFO qcmdExc | CALL QCMDEXC('MY_BUILD_COMMAND', 16) 23:11:35.621 FATAL qcmdExc | [CPF0006] Errors occurred in command. java.sql.SQLException: [CPF0006] Errors occurred in command. at com.ibm.as400.access.JDError.throwSQLException(JDError.java:646) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:617) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1401) at com.ibm.as400.access.AS400JDBCStatement.execute(AS400JDBCStatement.java:1755) at main.java._tools.QcmdExc.run(QcmdExc.java:33) at main.java._tools.B…
tagged with: unit-testing
type: Question
has title: Jenkins and Maven, abort build on BUILD FAILURE during generate-test-resources
has answer: http://stackoverflow.com/a/25979871
accepted answer: http://stackoverflow.com/a/25979871

http://stackoverflow.com/q/25930786
tagged with: tabpanel
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/25942854
score: 0
tagged with: uibinder
has title: GWT uiBinder TabPanel - Tab title from dictionary
answer count: 1
has body: I want to change GWT TabPanel behaviour, so it would allow me to set tab titles not directly in .ui.xml files, but in some kind of dictionary class. Standard tabPanel looks like this: &lt;gwt:TabPanel ui:field="tabPanel"&gt; &lt;gwt:Tab text="Some tab title"&gt; &lt;gwt:VerticalPanel&gt; &lt;!-- components --&gt; &lt;/gwt:VerticalPanel&gt; &lt;/gwt:Tab&gt; &lt;gwt:Tab text="Other tab title"&gt; &lt;gwt:VerticalPanel&gt; &lt;!-- components --&gt; &lt;/gwt:VerticalPanel&gt; &lt;/gwt:Tab&gt; &lt;/gwt:TabPanel&gt; I want to use external dictionary with all labels/titles, so I could get the label/title by it's dictionary key, e.g: Tab.Title.some=Some tab title Tab.Title.other=Other tab title So my .ui.xml file should looks like this: &lt;gwt:TabPanel ui:field="tabPanel"&gt; &lt;gwt:Tab text="Tab.Title.some"&gt; &lt;gwt:VerticalPanel&gt; &lt;!-- components --&gt; &lt;/gwt:VerticalPanel&gt; &lt;/gwt:Tab&gt; &lt;gwt:Tab text="Tab.Title.other"&gt; &lt;gwt:VerticalPanel&gt; &lt;!-- components --&gt; &lt;/gwt:VerticalPanel&gt; &lt;/gwt:Tab&gt; &lt;/gwt:TabPanel&gt; In all other cases (labels, table headers etc) I was able to extend component class and overload setText(String text) method. But for Tab there is only an interface and I'm not sure what to do with it to get desirable effect. Anyone knows the solution?
tagged with: dictionary

java.util.scanner
tags question: http://stackoverflow.com/q/25898841
tags question: http://stackoverflow.com/q/26014322
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/25976370
tags question: http://stackoverflow.com/q/25902487
tags question: http://stackoverflow.com/q/25877199
tags question: http://stackoverflow.com/q/26025427
type: Tag
tags question: http://stackoverflow.com/q/25962804
tags question: http://stackoverflow.com/q/25926885
tags question: http://stackoverflow.com/q/25991705
tags question: http://stackoverflow.com/q/25916476
tags question: http://stackoverflow.com/q/25953722
tags question: http://stackoverflow.com/q/25954035
tags question: http://stackoverflow.com/q/25962939
tags question: http://stackoverflow.com/q/25995969
tags question: http://stackoverflow.com/q/25901198
tags question: http://stackoverflow.com/q/26029828
tags question: http://stackoverflow.com/q/25961408

compiler-errors
tags question: http://stackoverflow.com/q/25903898
tag name: compiler-errors
tags question: http://stackoverflow.com/q/25903469
type: Tag
tags question: http://stackoverflow.com/q/25984140
tags question: http://stackoverflow.com/q/25994173
tags question: http://stackoverflow.com/q/26029634
tags question: http://stackoverflow.com/q/25908680
tags question: http://stackoverflow.com/q/26031900
tags question: http://stackoverflow.com/q/26000017

http://stackoverflow.com/q/25874250
has title: HttpMediaTypeNotAcceptableException XML ResponseEntity<List<>>
type: Question
downvote count: 0
favorite count: 0
tagged with: rest
has body: I am working on an API that will primary return JSON but I also want it to return XML if the client prefers to work with XML. My controller is included below. I can get JSON and XML to return for http://127.0.0.1:8080/gender/1 However http://127.0.0.1:8080/gender/1 work with JSON only, XML returns HttpMediaTypeNotAcceptableException: could not find acceptable representation. Is this because I'm trying to serialize a List&lt;> to XML? What is the solution to work around? package net.jkratz.bloodpressure.api.controller; import net.jkratz.bloodpressure.api.model.Gender; import net.jkratz.bloodpressure.api.repository.GenderRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.inject.Inject; import java.util.List; @RestController @RequestMapping(value = "/gender", produces = {"application/json","application/xml"}) public class GenderController { @Inject GenderRepository genderRepository; private Logger logger = LoggerFactory.getLogger(getClass()); @RequestMapping(value = {"","/"}, method = RequestMethod.GET) public ResponseEntity&lt;List&lt;Gender&gt;&gt; getGenders(@RequestHeader("Accept") String acceptHeader) { logger.info("Serving resource for Accept header: {}", acceptHeader); List&lt;Gender&gt; genders = genderRepository.findAll(); return new ResponseEntity&lt;&gt;(genders, HttpStatus.OK); } @RequestMapping(value = "/{id}", method = RequestMethod.GET) public ResponseEntity&lt;Gender&gt; getGender(@PathVariable("id") Integer id, @RequestHeader("Accept") String acceptHeader) { logger.info("Serving resource for Accept header: {}", acceptHeader); return new ResponseEntity&lt;&gt;(genderRepository.findOne(id), HttpStatus.OK); } }
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: spring-mvc
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/40647097
comment on: http://stackoverflow.com/a/25940287
type: Comment
has text: Yes, I got it to work perfectly. The reason I didn't react is that I'm pretty knew to java and wanted to do one thing at the time. It works, but I don't know what it does in de first part of the if statement. BTW I get 3 warnings about the types map, collections and Iterator. Map is a raw type. References to generic type Map<K,V> should be parameterized.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40606850
comment on: http://stackoverflow.com/a/25938072
type: Comment
has text: OK, thank you. Is there any way to instantiate that class without throwing the InstantiationException and IllegalAccessExceptions? Or a better way overall to solve this?
score: 0
type: AnswerComment

http://stackoverflow.com/a/25918510
score: 0
type: AcceptedAnswer
has body: You are asking for your AccessDecisionManager to be applied to an HTTP filter chain (by bunging it in the HttpSecurity), but (without seeing the code) I am guessing that it isn't meant to support that. It's more likely to work with GlobalMethodSecurityConfiguration. I think you need to extend that class add override the accessDecisionManager() method. Example here: https://spring.io/blog/2013/07/04/spring-security-java-config-preview-method-security/.
type: Answer
answers question: http://stackoverflow.com/q/25911265
accepted answer of: http://stackoverflow.com/q/25911265

http://stackoverflow.com/comment/117336734
comment on: http://stackoverflow.com/a/26025846
type: Comment
has text: However, if you use 0.###, integers are formatted with a dot ad the end. For example, 33 is displayed as 33. If you use #.###, 0 is not displayed at all.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40512390
comment on: http://stackoverflow.com/a/25886142
type: Comment
has text: can you post the code of when you are building your menu ?
score: 0
type: AnswerComment

http://stackoverflow.com/q/25947849
has title: @Value can not autowired from properities
answer count: 1
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/25948209
tagged with: spring
tagged with: properties
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25948209
tagged with: java
has body: The bean definition is as below: import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.web.client.RestTemplate; import com.ma2oo.model.domain.User; import com.ma2oo.model.res.interfaces.IUserService; @Configuration @PropertySource("classpath:exam-binary.properties") public class UserServiceImpl implements IUserService { private static final RestTemplate restTemplate = new RestTemplate(); @Value("${user.post.uri}") private String registerUri; public User register(final User user) { System.out.println(registerUri.toString()); return restTemplate.postForObject(registerUri, user, User.class); } @Bean(name = "userServiceImpl") public IUserService getUserService() { return new UserServiceImpl(); } } The imported properties file is under src/main/resources. And the variable is like: user.post.uri=http://localhost:9000/users/newUser Method used to call this function is like: ApplicationContext applicationContext = new AnnotationConfigApplicationContext(UserServiceImpl.class); IUserService userService = (UserServiceImpl) applicationContext.getBean("userServiceImpl"); User result = userService.register(register); The standard output for the function register() is ${user.post.uri}, that means the value doesn't be autowired. Exception description is: java.lang.IllegalArgumentException: Not enough variable values available to expand 'user.post.uri' Could anyone help with this? Thanks in advance.
type: Question
tagged with: mongodb

http://stackoverflow.com/q/25960888
tagged with: java
tagged with: match
type: Question
has body: I want to accept a string as long as it contains alphabetical letters, for example: String testStr = "hello world 1. ?" I am currently using this: testStr.matches("^[a-zA-Z\\s]+"), but it won't accept strings that have characters outside of the alphabet. So I am wondering how to use regex in this situation.
accepted answer: http://stackoverflow.com/a/25960939
has title: Use Regex to accept a string as long as it contains alphabet
score: 0
has answer: http://stackoverflow.com/a/25960939
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/40646143
has comment: http://stackoverflow.com/comment/40646292
has comment: http://stackoverflow.com/comment/40646588
tagged with: regex
type: AnsweredQuestion

http://stackoverflow.com/comment/40588497
score: 2
comment on: http://stackoverflow.com/q/25926376
has text: What's the error? :-)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25890590
type: Answer
score: 1
upvote count: 1
has body: You ignore the results returned from your JOptionPane calls. Put those results into a variable. Note JOptionPane.showInputDialog("Enter Foo"); but String foo = JOptionPane.showInputDialog("Enter Foo"); or String foo = JOptionPane.showInputDialog("Enter some int"); int someInt = Integer.parseInt(foo); You also appear to be trying to do your calculations before getting your user input. That should intuitively not make sense to you, right?
downvote count: 0
answers question: http://stackoverflow.com/q/25890543

http://stackoverflow.com/q/25936239
has comment: http://stackoverflow.com/comment/40603453
score: -1
has title: Java: How to reset a JFrame?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40603139
has answer: http://stackoverflow.com/a/25936309
favorite count: 0
has answer: http://stackoverflow.com/a/25936935
has comment: http://stackoverflow.com/comment/40603373
has body: setVisible currently use to restart the methods, but the transition does a flashing, is there any instruction other than setVisible? leave it in its initial state. reset button on the last Frame_1 only to return to the initial state. public class frame_1 extends javax.swing.JFrame { private void btnfinishActionPerformed(java.awt.event.ActionEvent evt) { Period total = new Period(0, totalDuration, PeriodType.yearMonthDay()); txta.append("________________________________________________" + "\n"); txta.append("Duracion total: " + total.getYears() + " years " + total.getMonths() + " Months " + total.getDays() + " Days " + "\n"); txtini.setText(null); txtfin.setText(null); } private void btnaddActionPerformed(java.awt.event.ActionEvent evt) { period(); txtini.setText(null); String fu = principio.txtingresa.getText(); txtfin.setText(fu); } public void period(){ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); String startDate = txtini.getText(); String endDate = txtfin.getText(); Date start = null; Date end = null; try { start = sdf.parse(startDate); end = sdf.parse(endDate); } catch (ParseException ex) { Logger.getLogger(fecha_1.class.getName()).log(Level.SEVERE, null, ex); } if(end.getTime() &lt; start.getTime()){ JOptionPane.showMessageDialog(null, "the date finish y higher.!"); txtini.setText(null); txtfin.setText(null); }else{ long duration = end.getTime() - start.getTime(); Period period = new Period(0, duration, PeriodType.yearMonthDay()); txta.append(startDate + " - "+ endDate + " = " + period.getYears()+ " years " + period.getMonths() + " Months " + period.getDays() + " Days " + "\n"); totalDuration += duration; } txtini.requestFocusInWindow(); } private void btnrestartActionPerformed(java.awt.event.ActionEvent evt) { frame_1 obj1 = new frame_1(); obj1.setVisible(false); obj1.setVisible(true); } }
tagged with: restart
downvote count: 1
tagged with: frame
has comment: http://stackoverflow.com/comment/40603295
upvote count: 0
has comment: http://stackoverflow.com/comment/40603826
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/40603400
has comment: http://stackoverflow.com/comment/40603530
tagged with: java

http://stackoverflow.com/a/25966998
has comment: http://stackoverflow.com/comment/40659123
has body: I'd recommend reading through this for documentation on the Android SDK's GeoPoints. This would be the basic syntax for you. @Override public void onLocationChanged(Location loc) { double lati = loc.getLatitude(); double longi = loc.getLongitude(); //User's current location ParseGeoPoint point = new ParseGeoPoint(lati, longi); ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("Locations"); query.whereWithinKilometers("location", point, 100); query.findInBackground(new FindCallback&lt;ParseObject&gt;() { ... }); }
has comment: http://stackoverflow.com/comment/40682908
has comment: http://stackoverflow.com/comment/40668387
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25966882
downvote count: 0
answers question: http://stackoverflow.com/q/25966882
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/26023049
tagged with: java
has title: Using Java to access a deep XML structure
possible better answer: http://stackoverflow.com/a/26023145
has answer: http://stackoverflow.com/a/26023145
has body: I am using java to read a xml template. This template comes from a word file, its important to keep this template to keep the structure of the items inside and the data organization (I have not found any other way to keep the structure and data with any other way without using the XML file). To make the code easier I will only put a simplified code, excluding all the non-revelant information and only showing the tags until the level the problem is found. More Tags More Tags <c> <d>More Tags </d> </c> <c> <d>More Tags </d> </c> More Tags More Tags More Tags More Tags More Tags More Tags More Tags More Tags To read this im using the following java code: public static int listFile() throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); folder = getPath(); File dir = new File(folder); String[] list = dir.list(filter); for (String file : list) { Document doc = (Document) db.parse(file); doc.getDocumentElement().normalize(); NodeList nodes = doc.getElementsByTagName("a"); for(int var1=0;var1<nodes.getLength();var1++){ Element element1 = (Element) nodes.item(var1); NodeList nodes1 = element1.getElementsByTagName("b"); for(int var2=0; var2<nodes1.getLength();var2++){ Element element2 = (Element) nodes.item(var2); NodeList nodes2 = element2.getElementsByTagName("c"); System.out.print(var1+":"+nodes1.getLength()+":"+nodes2.getLength()+", "); } } } } The result of using this code is the following: 0:1:0, 1:1:0, 2:1:0, 3:1:0, 4:1:0, 5:1:0, 6:1:0, 7:1:0, 8:1:0, 9:1:0, 10:1:0, That means that all 11 (numbered to 0 to 10) "a" tags have been found . Also the "b" tags corresponding from each "a" tag have been found (1 "b" in each "a" tag), but when I try to acces to the tag "c" these tags are not found. That makes me suspect that the code Element element2 = (Element) nodes.item(var2); NodeList nodes2 = element2.getElementsByTagName("c"); is wrong even when in …
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26023163
downvote count: 0
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/26023163
type: Question
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/40652045
has text: Your time format is wrong. The `Y` I could forgive (but it won't be compatible with calendars that don't support week years), but the `DD` is outright incorrect.
comment on: http://stackoverflow.com/a/25963807
type: AnswerComment
score: 0
type: Comment

simpledateformat
tags question: http://stackoverflow.com/q/25884332
tags question: http://stackoverflow.com/q/26026321
tags question: http://stackoverflow.com/q/26025477
tags question: http://stackoverflow.com/q/26016728
tags question: http://stackoverflow.com/q/25972040
tags question: http://stackoverflow.com/q/25994123
type: Tag
tag name: simpledateformat
tags question: http://stackoverflow.com/q/25879589

http://stackoverflow.com/a/26037241
score: 4
has body: GOD it took me ages.... but first things first: it was totally right to use the IChangeHistorySyncReport instead of IUpdateReport... so what was wrong? IWorkspaceConnection stream; //is not null, already instantiated somewhere else IBaselineSet bl0 = (IBaselineSet) itemManager.fetchCompleteItem(baseLineHandle0, IItemManager.DEFAULT, monitor); IBaselineSet bl1 = (IBaselineSet) itemManager.fetchCompleteItem(baseLineHandle1, IItemManager.DEFAULT, monitor); IChangeHistorySyncReport report = workspaceManager.compareBaselineSets(bl0, bl1, getComponentHandles(stream), monitor); a simply code change solves the problem //have a close look: 3.rd param is now null!! IChangeHistorySyncReport report = workspaceManager.compareBaselineSets(bl0, bl1, null, monitor); by the way, there was another tricky part, when i browsed up the report: System.out.println("report: "+report ); System.out.println("incoming: "+report.incomingChangeSets() ); output: report = com.ibm.team.scm.common.internal.dto.impl.ChangeHistorySyncReportImpl@127c1ae (localTime: &lt;unset&gt;, remoteTime: &lt;unset&gt;, compareFlags: &lt;unset&gt;) incoming [] looked empty ot first sight - but digging deeper i found out that i simply had to ask for report.outgoingChangeSets() which brings out a great sum of (expected) changes... but when i exchange the baseline workspaceManager.compareBaselineSets(bl1, bl0, null, monitor); then report.outgoingChangeSets() is empty and report.incomingChangeSets() brings the correct results!! update: using the compare baseline method i can now provide a full diff on several components!!!
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/40785461
downvote count: 0
has comment: http://stackoverflow.com/comment/40785543
has comment: http://stackoverflow.com/comment/41153621
has comment: http://stackoverflow.com/comment/41153507
has comment: http://stackoverflow.com/comment/41153584
answers question: http://stackoverflow.com/q/26016569
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40785585
accepted answer of: http://stackoverflow.com/q/26016569

http://stackoverflow.com/comment/40683622
has text: thanks! for making an addLast or addFirst, would I just make a slight variation of that add method?
comment on: http://stackoverflow.com/a/25981028
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40748573
score: 0
has text: At the beginning you use `nextLine()` but at the end of the loop you use `next()`. Is there a reason for that?
type: Comment
comment on: http://stackoverflow.com/q/26017055
type: QuestionComment

http://stackoverflow.com/q/25936092
favorite count: 0
has title: Partial Data deletes using Java SQL Hibernate
has comment: http://stackoverflow.com/comment/40603275
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40603044
tagged with: db2
score: -1
has answer: http://stackoverflow.com/a/25938857
has comment: http://stackoverflow.com/comment/40603497
has body: Our Java program has to delete large number of records from DB2 tables but it is running out of Transaction logs. We are working on increasing the logs space but due to internal processes and other things... it will take a week+ to complete. We are looking for a temporary way to delete a few records at a time instead of deleting all. For e.g When we have 1000 records to delete, we want the program to delete 50 records at a time and then do a commit and proceed for next 50 until all 1000 records deleted. If delete fails after X number of records deletion, it is still fine. We are using Hibernate. Requesting your suggestion on how it can be achieved. I'm looking at checking the sqlstate and sqlcode in java even on successful sql execution scenario but my bad, i couldn't find a way. so like, loop do... while(check sqlcode for completion not true) We cannot delete from back-end as the deletions are supposed to happen on user requests from java web application and in addition, we also have some table constraints and delete cascades.
tagged with: sql
accepted answer: http://stackoverflow.com/a/25938857
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40603122

http://stackoverflow.com/comment/40704760
type: Comment
type: QuestionComment
has text: perfect, i have used PreparedStatement and it works
comment on: http://stackoverflow.com/q/25992471
score: 0

http://stackoverflow.com/q/25968190
type: AnsweredQuestion
has title: Read CP932 type file into String in Java 6
score: 0
tagged with: java
type: Question
tagged with: character-encoding
has answer: http://stackoverflow.com/a/25968624
has body: I want to read file content into java String objects whose character encoding is "CP932". I am using Java 6. When i try to read it will throw exception: "UnsupportedChasetEncoding" I have tried following things for the same but I was failed: 1. FileUtils (Apache common IO) 2. Gauva 3. Scanner class
answer count: 1
accepted answer: http://stackoverflow.com/a/25968624

http://stackoverflow.com/comment/127945813
type: Comment
comment on: http://stackoverflow.com/a/72426009
has text: sample https://pl.kotl.in/IlSSmtp1w?theme=darcula
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40700849
score: 0
type: Comment
type: QuestionComment
has text: _adding new data into tables with relationship is the same_ Have you tried? Did you encountered some problems?
comment on: http://stackoverflow.com/q/25990571

http://stackoverflow.com/comment/40695406
comment on: http://stackoverflow.com/a/25987530
score: 0
type: AnswerComment
has text: @Pushpa better post the complete code, what is the datatype of the number you are getting, and how..??
type: Comment

http://stackoverflow.com/q/25885005
upvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/48439341
score: 8
tagged with: javafx
type: Question
has body: I tested Spinner control in Java 8u40 import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Spinner; import javafx.scene.control.SpinnerValueFactory; import javafx.scene.layout.GridPane; import javafx.stage.Stage; public class MainApp extends Application { public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) { final Spinner spinner = new Spinner(); spinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 10000)); spinner.setEditable(true); GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(10)); int row = 0; grid.add(new Label("Spinner:"), 0, row); grid.add(spinner, 1, row); Scene scene = new Scene(grid, 350, 300); stage.setTitle("Hello Spinner"); stage.setScene(scene); stage.show(); } } How I can only insert number into the spinner control field? Now I can insert numbers and text. Is there any example that can be used as example?
has answer: http://stackoverflow.com/a/29557191
tagged with: java
answer count: 3
tagged with: javafx-8
has answer: http://stackoverflow.com/a/63522899
downvote count: 0
has title: Insert only numbers in Spinner Control
favorite count: 0
has answer: http://stackoverflow.com/a/29561005

http://stackoverflow.com/a/25965111
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/40654228
accepted answer of: http://stackoverflow.com/q/25964880
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25964880
has body: The following code creates an anonymous inner class: new Expectations(Preconditions.class) { // ... }; The calls to Preconditions.checkNotNull and assignments to this.result occur within an initializer block scoped within the anonymous inner class. In order for the @SuppressFBWarnings annotation to apply to those statements, the annotation must be placed, at minimum, on the class that contains them. Though the source code for the anonymous inner class and its statements are physically written within the ctor_checksForNullArguments test method, the resulting bytecode is not actually a part of the test class, nor that method, and so placing the annotation on the method applies it to the wrong scope. Since any anonymous inner class can be extracted to either a named (non-anonymous) inner class or even a top-level class, doing so will enable you to place @SuppressFBAnnotations on the proper scope: either the entire class, or potentially a more restricted scope such as a particular method or constructor (as needed).

http://stackoverflow.com/comment/40570666
type: QuestionComment
comment on: http://stackoverflow.com/q/25918103
score: 0
has text: Aren't I allowed to do that " for ( int i = 0; i < 2*n; ++i ) { val[i] = i; }" ?
type: Comment

hql
tag name: hql
tags question: http://stackoverflow.com/q/25892850
tags question: http://stackoverflow.com/q/25893528
tags question: http://stackoverflow.com/q/25970226
tags question: http://stackoverflow.com/q/25968883
tags question: http://stackoverflow.com/q/25885267
tags question: http://stackoverflow.com/q/25905151
type: Tag
tags question: http://stackoverflow.com/q/25926222

http://stackoverflow.com/comment/40563712
score: 1
type: AnswerComment
has text: No. Html entities aren't java character encodings.
type: Comment
comment on: http://stackoverflow.com/a/25913954

http://stackoverflow.com/comment/40499351
comment on: http://stackoverflow.com/a/25878225
type: Comment
has text: thanks!! I've got another quick question. I edited the problem, so if you can take a look at it that would be great.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40584445
has text: @nem Ok. posting changes now
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25925562
type: QuestionComment

http://stackoverflow.com/comment/40833129
type: Comment
has text: @user3300710 [This answer](http://stackoverflow.com/a/4405134/2479481) brought the [`Matcher.find()`](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Matcher.html#find()) method to my attention. You can use it if you want to check for containment automatically. Though, it is perhaps [more verbose](http://docs.oracle.com/javase/tutorial/essential/regex/matcher.html).
comment on: http://stackoverflow.com/a/25999101
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40741197
type: Comment
comment on: http://stackoverflow.com/a/26012422
has text: I am not sure, I understand what you mean. Waiting for edited question.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40527009
type: QuestionComment
comment on: http://stackoverflow.com/q/25890991
score: 0
has text: You mean the 1337? It's one of the strange things on your cfg that differs from the usual case. The others are the charset in content type and the missing attachment or inline in content disposition... Sorry I'm on the phone now, I can't expand it, but try changing them too as in the doc
type: Comment

http://stackoverflow.com/comment/40560421
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25911428
has text: I have used Jadira and Hibernate with no problems in the past. Just included `org.jadira.usertype:usertype.jodatime:2.0.1` in the gradle build file and used `@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")` on each DateTime field.
score: 0

http://stackoverflow.com/comment/40626042
score: 1
has text: Dont use equals method for checking null... Use errorMessage == null
comment on: http://stackoverflow.com/q/25949625
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25956312
type: Question
score: 0
answer count: 1
has title: Java need explanation on my Lexicographic order algorithm
has answer: http://stackoverflow.com/a/25956338
favorite count: 0
accepted answer: http://stackoverflow.com/a/25956338
has body: import java.util.Scanner; public class StringOrder { public static void main(String[] args) { String s1, s2, s3; Scanner keyboard = new Keyboard(System.in); System.out.println("Enter your first string."); s1 = keyboard.next(); System.out.println("Enter your second string."); s2 = keyboard.next(); System.out.println("Enter your third string."); s3 = keyboard.next(); int c1 = abs(s1.compareTo(s2)); int c2 = abs(s2.compareTo(s3)); int c3 = abs(s1.compareTo(s3)); System.out.println(Math.min(c1,c2,c3)+" "+Math.median(c1,c2,c3)+" "+Math.max(c1,c2,c3)); System.out.println("lexicographical sorting finished"); } } The above is my code. I have no problem with the code itself. I am just trying to see if this way of me trying to solve this problem is true. I am trying to sort the three user-input string values into Lexicographic order. I came up with the solution to use the compareTo method and store the resulting values into integer variables, then use absolute value to find which one is next to each other. I have not compiled the code above yet. My only question is whether should my algorithm works or not? I 'm trying to figure out the algorithm on my own, so I wouldn't want any preferred solutions to the problem, but just an explanation of why it shouldn't work or should work.
has comment: http://stackoverflow.com/comment/40637900
downvote count: 1
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
upvote count: 1

http://stackoverflow.com/q/25966078
type: Question
has comment: http://stackoverflow.com/comment/40690448
tagged with: java
has comment: http://stackoverflow.com/comment/40690350
possible better answer: http://stackoverflow.com/a/33572989
has answer: http://stackoverflow.com/a/33572989
answer count: 2
has comment: http://stackoverflow.com/comment/40690228
has answer: http://stackoverflow.com/a/25985001
has comment: http://stackoverflow.com/comment/40690105
tagged with: security
score: 0
has title: RSA keyblock wrapper: javax.crypto.BadPaddingException: Decryption error
has body: In a larger application doing other things - I need to encrypt and decrypt a file. So I have been looking around and have implemented these two core functions that basically use RSA keys to wrap a random AES key that encrypts a file. The symmetric key and iv are written to the start of the file. I'm getting an exception ("javax.crypto.BadPaddingException: Decryption error") in the decrypt function portion of below. On the unpackKeyandIV line -- the doFinal. Specifically this line is the Exception point: Object[] keyIv = unpackKeyAndIV(xCipher.doFinal(keyBlock)); I've checked and remade the RSA key pairs. I've also checked the save/load of the keyBlock. My gut is the problem has something to do with how I write/read the keyBlock --- or encoding perhaps? One goal is to keep the RSA/AES instance as generic as possible so as not to need Bouncy Castle or extra Java security unlimited strength extensions. Any thoughts on where I might be going wrong. Thanks in advance. [Final update: This code below is working. Error was passing in a corrupted privKey] // RSA_INSTANCE = "RSA"; // ASSYM_CRYPTO_STR = 1024; // SYM_CRYPTO_STR = 128; // SYM_CRYPTO = "AES"; // AES_INSTANCE = "AES/CTR/NoPadding"; // // File in = plain input file // File out = encrypted output file // Key pubKey = public Key (that wraps a random AES key) public static void encryptFile(File in, File out, Key pubKey) throws Exception { FileInputStream fin; FileOutputStream fout; int nread = 0; byte[] inbuf = new byte[1024]; fout = new FileOutputStream(out); fin = new FileInputStream(in); SecureRandom random = new SecureRandom(); // symmetric wrapping Key sKey = createKeyForAES(Config.SYM_CRYPTO_STR, random); IvParameterSpec sIvSpec = createCtrIvForAES(0, random); // encrypt symmetric key with RSA/pub key Cipher xCipher = Cipher.getInstance(Config.RSA_INSTANCE); xCipher.init(Cipher.ENCRYPT_MODE, pubKey, random); byte[] keyBlock = xCipher.doFinal(packKeyAndIv(sKey, sIvSpec)); fout.write(keyBlock); // encrypt data wit…
has comment: http://stackoverflow.com/comment/40690689
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40690530
has comment: http://stackoverflow.com/comment/40689825
tagged with: encryption
has comment: http://stackoverflow.com/comment/40659580
accepted answer: http://stackoverflow.com/a/25985001
has comment: http://stackoverflow.com/comment/40690802

http://stackoverflow.com/q/25875123
type: Question
has comment: http://stackoverflow.com/comment/40494365
has comment: http://stackoverflow.com/comment/40492854
has body: We have following error java.lang.NullPointerException Fine, I know whats that mean... code System.out.println(objectC.getObjectB().getObjectA()); //console show for example com.project.ObjectA@6b, anyway it works if(objectC.getObjectB().getObjectA() != null) { ObjectD objectD = new ObjectD(); objectD.setObjectA(objectC.getObjectB().getObjectA()); //is here error NullPointer } What is wrong? Below is the code and ideas. Object A contains multiple Objects B Object B contains the Object A Object B contains multiple objects C Object C contains the Object B Object D contains the Object A In the above example, I have object C, which is already assigned to B object and that object A. Object C contains information about the object A (thanks by lazy fetching), which is needed to create the object D. Mapping Object A @OneToMany(fetch = FetchType.LAZY, mappedBy = "objectA", cascade = CascadeType.ALL) public Set&lt;ObjectD&gt; getObjectDs() { return this.Ds; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "objectA", cascade = CascadeType.ALL) public Set&lt;ObjectB&gt; getObjectBs() { return this.Bs; } --- Object B @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "OBJECTAID", nullable = false) public ObjectA getObjectA() { return this.A; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "objectB", cascade = CascadeType.ALL) public Set&lt;ObjectC&gt; getObjectCs() { return this.Cs; } --- Object C @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "OBJECTBID", nullable = true) public ObjectB getObjectB() { return this.B; } --- Object D @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "OBJECTAID", nullable = false) public ObjectA getObjectA() { return this.A; } Of course, I skipped some of the methods get/set (for readability...) UPDATE: Error full stack SEVERE: Servlet.service() for servlet [spring] in context with path [/project] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause java.lang.NullPointerExcepti…
has title: Hibernate, @ManyToOne and NullPointerException
has comment: http://stackoverflow.com/comment/40492637
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40494575
has comment: http://stackoverflow.com/comment/40492332

http://stackoverflow.com/a/25922143
has comment: http://stackoverflow.com/comment/40579488
answers question: http://stackoverflow.com/q/25921840
type: Answer
has body: I think spring SAML sample is looking for IDP metadata. It may assume that WSO2 Identity Server supports for SAML meta data profile. But as i know, this profile is still not supported by the Identity Server. However, there may be a place where you can manually configure the IDP meta data in the sample. Therefore please check for it. Because normally it is not required support this profile by all IDPs there must be some option to ignore it and manually do it. Also, you can find the IDP meta data of Identity Server that has been created manually from [this] blog
score: 0

http://stackoverflow.com/comment/41455606
type: AnswerComment
comment on: http://stackoverflow.com/a/26403150
type: Comment
has text: I'm sorry, but what is useless about my answer? I am saying that @sol4me got it wrong, and in the Java API you actually have to use createIndex(). I even reference the corresponding JIRA issue where I managed to clarify this with the MongoDB developers... If I ever got a reply from those who delete my answer I would edit it and not leave all the stuff in there to show how it got deleted. As it is, this is all extremely hostile towards me, after I even made the effort of discussing things with the developers so I could give a correct answer.
score: 2

http://stackoverflow.com/q/25944063
tagged with: java
accepted answer: http://stackoverflow.com/a/25944149
has title: How to find the number of correct answers that user had made then convert the correct answer to percentage?
has comment: http://stackoverflow.com/comment/40617730
answer count: 2
upvote count: 0
tagged with: variables
possible better answer: http://stackoverflow.com/a/25944118
favorite count: 0
has answer: http://stackoverflow.com/a/25944118
has body: There are 3 questions for user to answer. For example: if user had made all answers correctly, the code will show that "You got 3 correct answer and your grade is 100%" int x = ( int ) (20 * Math.random()) + 1; int y = ( int ) (20 * Math.random()) + 1; System.out.println(x + " + " + y + " : "); int sum = keyboard.nextInt(); if (sum == (x+y)) { System.out.println("Correct!"); } else {System.out.println("Wrong!"); } System.out.println( x + " * " + y + " : "); int mult = keyboard.nextInt(); if (mult == (x*y)) { System.out.println("Correct!"); } else {System.out.println("Wrong!"); } System.out.println(x + " - " + y + " : "); int minus = keyboard.nextInt(); if (minus == (x-y)) { System.out.println("Correct!"); } else { System.out.println("Wrong!"); }
has answer: http://stackoverflow.com/a/25944149
tagged with: primitive-types
downvote count: 7
type: Question
score: -7
type: AnsweredQuestion

http://stackoverflow.com/comment/40516259
score: 0
comment on: http://stackoverflow.com/q/25884028
type: Comment
type: QuestionComment
has text: about the second question http://stackoverflow.com/questions/8186965/what-do-numbers-using-0x-notation-mean http://stackoverflow.com/questions/2670639/why-are-hexadecimal-prefixed-as-0x

http://stackoverflow.com/comment/40542976
comment on: http://stackoverflow.com/q/25881588
has text: at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1422) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:606) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:526) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:756) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:683)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25999936
has comment: http://stackoverflow.com/comment/40726961
accepted answer of: http://stackoverflow.com/q/25998046
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40767922
has comment: http://stackoverflow.com/comment/40717884
has comment: http://stackoverflow.com/comment/40718002
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40748464
upvote count: 1
has comment: http://stackoverflow.com/comment/40718391
has body: CustomField is now part of Vaadin7 base API. It is also possible to override validate(), setInternalValue(), commit(), setPropertyDataSource, isEmpty() and other methods to implement different functionalities in the field. Methods overriding setInternalValue() should call the superclass method.
answers question: http://stackoverflow.com/q/25998046

http://stackoverflow.com/comment/40556731
type: Comment
has text: You don't really need to extend `AbstractTransactionalJUnit4SpringContextTests` only if you want your test to be the transactional boundary. It isn't a necessity for transactions to work. This setup basically renders `@Transactional` on this service useless (unless it would a REQUIRES_NEW or NEVER propagation level).
comment on: http://stackoverflow.com/a/25910635
score: 1
type: AnswerComment

http://stackoverflow.com/a/27064645
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25913710
score: 2
answers question: http://stackoverflow.com/q/25913710
downvote count: 0
has body: It should be enough to download and install a fresh update for Apple Java 1.6. At the moment the latest update was Java for OS X 2014-001.
upvote count: 2

http://stackoverflow.com/comment/40666605
comment on: http://stackoverflow.com/q/25972068
type: QuestionComment
type: Comment
has text: if column names are diff , how do you know which column to be compared with which one ???
score: 0

http://stackoverflow.com/comment/40578003
comment on: http://stackoverflow.com/a/25921646
score: 0
type: AnswerComment
has text: Ensure that the source folder containing your images shows up in the workspace you currently are using in eclipse. You should be able to see the Project -> src -> Package -> Classes [inside the package with the classes, you should see a folder named "images".] Then when exporting, you want to select the classes and the folder to export.
type: Comment

http://stackoverflow.com/comment/43056195
type: Comment
type: QuestionComment
has text: @Rotten194 the post was edited to clarify that subtlety only after it was closed.
comment on: http://stackoverflow.com/q/25964515
score: 0

http://stackoverflow.com/q/25927496
has answer: http://stackoverflow.com/a/25927707
has title: Return the number of elements in a linked list recursively
has answer: http://stackoverflow.com/a/25927607
has answer: http://stackoverflow.com/a/25927543
answer count: 3
has body: I have the following recursive method in a class called ImageNode which is passed the head(this - the start of the linked list) from a class called Image. I thought my code would recursively go through each node, increase the count then when its at the end return the count, unfortunatly not. Where am I going wrong? private int countRec() { int count = 1; ImageNode node = this; if (node.next != null ){ node = node.next; count++; countRec(); } return count; }
downvote count: 0
possible better answer: http://stackoverflow.com/a/25927607
has comment: http://stackoverflow.com/comment/40587773
favorite count: 0
has comment: http://stackoverflow.com/comment/40587803
has comment: http://stackoverflow.com/comment/40587724
has comment: http://stackoverflow.com/comment/40587718
has comment: http://stackoverflow.com/comment/40587760
accepted answer: http://stackoverflow.com/a/25927543
type: AnsweredQuestion
tagged with: recursion
score: 1
tagged with: java
upvote count: 1
type: Question

entity
tags question: http://stackoverflow.com/q/26027525
type: Tag
tags question: http://stackoverflow.com/q/25896215
tags question: http://stackoverflow.com/q/25986231
tags question: http://stackoverflow.com/q/26025286
tag name: entity

http://stackoverflow.com/comment/40647741
score: 0
comment on: http://stackoverflow.com/q/25961585
type: Comment
type: QuestionComment
has text: As stated in the assignment I've been given, I am asked to write three methods, one method to determine the polynomial function, one method to calculate the value and one method to print the results. So for the first method, which is the one I'm working on, I apparently don't have to calculate the value yet, I just have to determine the polynomial function, so x wouldn't have a value yet, I mean I can't say that x is equal 7 or something since that is determined in the second method, where I have to calculate the value for a lot of different varying values of x (I have to find the root).

http://stackoverflow.com/q/25887547
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25887669
score: -1
tagged with: listview
answer count: 2
downvote count: 1
favorite count: 0
tagged with: android-listview
tagged with: android
has body: I have a ListView with two TextView and I need to get value of a TextVeiw but get me wrong data . For example get me duplicate data. lstContent.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { //String selectedFromList = (lstContent.getItemAtPosition(arg2).toString()); //String selectedFromList = lstContent.getSelectedItem().toString(); //String txtselect = (TextView) findViewById(R.id.txtTitle); //select = txtselect.getText().toString(); //Log.i("Log_five", select); //Log.i("Log_five", selectedFromList); } }); I use above comment codes but all of them get me wrong data .
possible better answer: http://stackoverflow.com/a/25887853
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/25887669
has title: Get text listview with multiple textview android
has answer: http://stackoverflow.com/a/25887853

http://stackoverflow.com/a/26015919
has body: The simplest way to declare an 8x8 array of optional objects in C++ is like so: boost::optional&lt;Piece&gt; myPieces[8][8]; The boost::optional type represents an optional object (like your nullable references in Java) that doesn't have all the pitfalls of using pointer types. It should be available as part of the standard library in the next few years. You may prefer to use the std::array type, which is an encapsulation of fixed-size arrays that allows them to be treated as first-class citizens and also provides a nicer interface: std::array&lt;std::array&lt;boost::optional&lt;Piece&gt;, 8&gt;, 8&gt; myPieces; If you want to be able to resize your arrays at run-time, consider std::vector instead.
type: Answer
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/40769893
answers question: http://stackoverflow.com/q/26015704
downvote count: 0
has comment: http://stackoverflow.com/comment/40793876
has comment: http://stackoverflow.com/comment/40750209

http://stackoverflow.com/a/25939653
has comment: http://stackoverflow.com/comment/40614026
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40614308
has body: OK, I figured it out, thanks in part to Rp-'s comment private int id; had to be changed to private Integer id; And in the Servicelog.hbm.xml <column name="ID" /> <generator class="identity" /> to <column name="ID" /> <generator class="assigned" />
type: Answer
answers question: http://stackoverflow.com/q/25939024
has comment: http://stackoverflow.com/comment/40614871
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25939024
has comment: http://stackoverflow.com/comment/40613024

http://stackoverflow.com/q/25890361
tagged with: sql
upvote count: 1
answer count: 1
favorite count: 0
tagged with: jooq
has answer: http://stackoverflow.com/a/25890666
type: UnansweredQuestion
has title: Cast query string to Query or SelectQuery object using jOOQ
downvote count: 0
score: 1
tagged with: java
has body: I have some query string: String queryStr = "SELECT * FROM car"; I want cast this object to SelectQuery and then use incremental query building. How to cast String object into SelectQuery?
type: Question

http://stackoverflow.com/a/25984534
score: 1
upvote count: 1
has body: Use name.split(delimiter). This returns a String array, and each element the array is a component of the String separated by a delimiter that you have to specify as a parameter while using the method. Eg. From official Java documentation: The string "boo:and:foo", for example, yields the following results with these expressions: Regex Result : { "boo", "and", "foo" } o { "b", "", ":and:f" } Approach: Scanner.nextLine() returns a String. So that makes the variable name a String instance. Now you need to find out what methods are supported by String, so that you can invoke it on the instance using a .. This is the time to go through the official Java documentation for String, and find out the methods that you can use. Once you find the methods you want, you can Google for examples :).
downvote count: 0
answers question: http://stackoverflow.com/q/25984389
type: Answer

http://stackoverflow.com/comment/40688005
score: 0
has text: i don't know if you have webtools, maybe it can help you validate your html. The link is [link]http://www.eclipse.org/webtools/ also post all the code from the page, maybe there was something you missed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25983336

http://stackoverflow.com/q/25877208
linked to: http://stackoverflow.com/q/7187581
tagged with: jodatime
answer count: 2
has title: How do I change the hour and minute on a joda time DateTime object?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40496346
has comment: http://stackoverflow.com/comment/40496486
possible better answer: http://stackoverflow.com/a/25877333
has answer: http://stackoverflow.com/a/25877799
has comment: http://stackoverflow.com/comment/40496558
has answer: http://stackoverflow.com/a/25877333
type: AnsweredQuestion
has body: I've tried the following two options: DateTime dt = new DateTime(); dt = dt.plusDays(1).withMinuteOfHour(0); and DateTime dt = new DateTime(); dt = dt.withMinuteOfHour(0); they both report the following error message: Method "withMinuteOfHour" with signature "(I)Lorg/joda/time/DateTime;" is not applicable on this object I'm using joda time 2.3: joda-time:joda-time:2.3
has comment: http://stackoverflow.com/comment/40496406
has comment: http://stackoverflow.com/comment/40496404
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: weblogic
has comment: http://stackoverflow.com/comment/40496370
accepted answer: http://stackoverflow.com/a/25877799

http://stackoverflow.com/a/25989585
upvote count: 3
has body: There is no explicit limit for the number of variable arity arguments. However the method size is limited. It should not exceed 65535 bytecodes. When javac compiles a call to a variable arity method, it creates and fills the array using the pattern like: +0: dup +1: bipush &lt;index&gt; (or sipush if index &gt; 127) +3: iconst_0 +4: iastore +5: dup ... So, filling one array element takes 5 or 6 bytecodes. This means you can practically call a method with a little more than 10K arguments.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25988977
score: 3

http://stackoverflow.com/q/26014311
type: Question
accepted answer: http://stackoverflow.com/a/26031530
has title: JavaFX - What is the purpose of JavaFX-Fallback-Class?
downvote count: 0
answer count: 1
score: 1
favorite count: 0
upvote count: 1
has body: I have found an entry in MANIFEST.MF file of some JavaFX project: JavaFX-Fallback-Class: But I cannot find out what is it used for, search on Google did not give any reasonable result. So my question is: What is the purpose of fallback class in JavaFX? When does is it run?
has answer: http://stackoverflow.com/a/26031530
type: AnsweredQuestion
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/40575552
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25919653
has text: More people seem interested in editing rather than actually answering. I know editing is important but I don't think anyone (who knew the answer) misunderstood the actual question based on its original format.
type: Comment

http://stackoverflow.com/q/26005435
linked to: http://stackoverflow.com/q/25694806
favorite count: 0
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22031086
has answer: http://stackoverflow.com/a/26005536
accepted answer: http://stackoverflow.com/a/26005536
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/25963481
tagged with: swing
has title: JProgressBar without JButton and PropertyChangeListener
type: Question
has body: I am new to JProgressBar and new to OOPs concepts as well (learning it) and read a lot of articles and tried my best to learn it. All of the examples shown had a button which starts progress in it but how can I make a method so that when the method is called it starts progress? Here is my code first import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingWorker; public class ProgressDemo { JProgressBar ProgressBar; Task task; boolean done = false; class Task extends SwingWorker&lt;Void, Void&gt; { @Override public Void doInBackground() { Random random = new Random(); int progress = 0; setProgress(0); while (progress &lt; 100) { try { Thread.sleep(random.nextInt(1000)); } catch (InterruptedException ignore){} progress += random.nextInt(10); setProgress(Math.min(progress, 100)); } return null; } @Override public void done() { done = true; } } public void propertyChange(PropertyChangeEvent evt) { if(!done) { int progress = task.getProgress(); if(progress==0) { ProgressBar.setIndeterminate(true); } else { ProgressBar.setIndeterminate(false); ProgressBar.setString(null); ProgressBar.setValue(progress); } } } //I want to make a method here, so that it can be called when ever I want public void ExecuteTask() { task = new Task(); task.execute(); } public static void main(String[] args) { JFrame MainScreen = new JFrame(); JPanel MainPanel = new JPanel(); ProgressBar = new JProgressBar(0, 100); ProgressBar.setValue(0); ProgressBar.setStringPainted(false); MainPanel.add(ProgressBar); MainScreen.getContentPane().add(MainPanel); MainScreen.setVisible(true); } } My jProgressBar is not listening when I call ExecuteTask() method. How can I make it to call ExecuteTask() and it execute task and jProgressBar listen to it?
upvote count: 1
answer count: 1

http://stackoverflow.com/a/26606288
has comment: http://stackoverflow.com/comment/67705110
has comment: http://stackoverflow.com/comment/43482067
downvote count: 0
has body: Just spent an entire day trying to solve the same issue. There's barely any info out there. Local machines: Linux FedoraCore 20, KDE desktop, NVIDIA GeForce 7300 LE Linux FedoraCore 20, KDE desktop, NVIDIA GeForce GT 720 Running remote Java GUI over ssh, swing popups are extremely slow for PC2. Desktop freezes until popup appears. On the other hand, PC1 runs very fast/smooth, with no problems at all. Turns out, in my case, the problem is that PC2 has 2 monitors. The closest bug report I could find is: JDK-8004103 : sun.awt.X11.XToolkit.getScreenInsets() may be very slow and it appears to be still open. Temporary Workarounds: In KDE, Disable second monitor, Launch Application, Enable second monitor Work in Gnome Desktop (My Gnome environment not affected by this issue) Launch remote Java app using Java 6 (Issue not present in Java6) None of these are ideal workarounds, but considering that my Desktop freezes for 3-4 seconds every time I click on a menu item, they'll do for the time being.
score: 8
upvote count: 8
answers question: http://stackoverflow.com/q/26002948
type: Answer
has comment: http://stackoverflow.com/comment/56140317
has comment: http://stackoverflow.com/comment/42423742
has comment: http://stackoverflow.com/comment/42386546

http://stackoverflow.com/comment/40795886
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25912449
has text: @ madhawa priyashantha Hello Would you be able to provide some help on http://stackoverflow.com/questions/26042383/from-java-popup-table-to-java-table-within-a-gui

http://stackoverflow.com/a/25952390
upvote count: 4
downvote count: 0
has body: Keep your JFrame's default close operation to JFrame.DO_NOTHING_ON_CLOSE, but listen for closing attempt with a WindowListener (or more succinctly, a WindowAdapter). You could use the same AbstractAction for both the menu item and the button, and then call the action's method in a WindowListener. For example import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.*; public class ClosingJFrame { public static void main(String[] args) { final JFrame frame = new JFrame("My Frame"); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); final CloseAction closeAction = new CloseAction(frame); JPanel panel = new JPanel(); panel.add(new JButton(closeAction)); JMenuItem exitMenuItem = new JMenuItem(closeAction); JMenu menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); menu.add(exitMenuItem); JMenuBar menuBar = new JMenuBar(); menuBar.add(menu); frame.setJMenuBar(menuBar); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { closeAction.confirmClosing(); } }); frame.add(panel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } } class CloseAction extends AbstractAction { private JFrame mainFrame; public CloseAction(JFrame mainFrame) { super("Exit"); putValue(MNEMONIC_KEY, KeyEvent.VK_X); this.mainFrame = mainFrame; } @Override public void actionPerformed(ActionEvent e) { confirmClosing(); } public void confirmClosing() { int confirmed = JOptionPane.showConfirmDialog(mainFrame, "Are you sure you want to quit?", "Confirm quit", JOptionPane.YES_NO_OPTION); if (confirmed == JOptionPane.YES_OPTION) { // clean up code System.exit(0); } } } Edit Oops, I forgot your ctrl-Q keystroke bit. Use the same Action for that, and bind it to the ctrl-q key using KeyBindings. The improved code: import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.event.…
type: Answer
has comment: http://stackoverflow.com/comment/40634707
answers question: http://stackoverflow.com/q/25952297
score: 4

http://stackoverflow.com/comment/40749511
type: Comment
type: QuestionComment
has text: Check your superclass, `WorldOfAdams`, it probably has a variable to store the `currentPopulation`. You'll want to increase that variable, probably `currentPopulation += populationIncrease`
comment on: http://stackoverflow.com/q/26017460
score: 0

http://stackoverflow.com/comment/40728432
comment on: http://stackoverflow.com/a/26003196
type: Comment
score: 0
type: AnswerComment
has text: @DwB see edits. At least some frameworks can use annotations or other techniques to work around the get/set convention.

http://stackoverflow.com/comment/40779442
type: QuestionComment
comment on: http://stackoverflow.com/q/26033835
score: 0
has text: index `-1` means it doesn't exist. `v.getId()`'s value doesn't exist in your array
type: Comment

http://stackoverflow.com/a/25992837
score: 0
upvote count: 1
downvote count: 1
has body: This is wrong if (tracksN.size().get(i)==index) It should be if (tracksN.get(i)==index) tracksN is an ArrayList there is no such method .size().get(i). tracksN.get(i) will return the Track you should able to get the field from it to compare. Also take a look at your method. public Track getTrack(int index){ // you should return a Track not int } You have to correct all those issue. You can get the Track by index easily using get(index) Read about List in Java
answers question: http://stackoverflow.com/q/25992805
has comment: http://stackoverflow.com/comment/40704625
type: Answer
has comment: http://stackoverflow.com/comment/40705189
has comment: http://stackoverflow.com/comment/40704338
has comment: http://stackoverflow.com/comment/40704422
has comment: http://stackoverflow.com/comment/40706268

http://stackoverflow.com/comment/40611814
type: QuestionComment
comment on: http://stackoverflow.com/q/25940748
has text: Are you running this through a loop? Try posting more of your code.
score: 0
type: Comment

http://stackoverflow.com/comment/40922651
type: AnswerComment
comment on: http://stackoverflow.com/a/25937890
type: Comment
has text: I don't quite follow your latest edits. If you can separate by package, you may find this useful: http://stackoverflow.com/questions/6330436/grails-and-log4j-how-to-logs-in-different-files-with-same-level Or, there are additional tips here: http://stackoverflow.com/questions/14844945/grails-logging-multiple-loggers-and-appenders
score: 0

http://stackoverflow.com/comment/40748234
type: AnswerComment
comment on: http://stackoverflow.com/a/26016429
type: Comment
has text: The images are in /media. And no, not so great, experience comes to everyone, now to you. The smart thing here, is not using java's ZipFile but the java FileSystem from "jar:file:" URIs. Then one can copy an image file into the docx with just `Files.copy` etc.
score: 1

http://stackoverflow.com/q/25986568
tagged with: java
has answer: http://stackoverflow.com/a/25997211
type: Question
has comment: http://stackoverflow.com/comment/40693714
upvote count: 6
has answer: http://stackoverflow.com/a/25995625
tagged with: messageformat
answer count: 2
has comment: http://stackoverflow.com/comment/40693727
favorite count: 0
has title: How can I output localized Java floating point values in full precision?
tagged with: scala
type: UnansweredQuestion
tagged with: double
score: 6
linked to: http://stackoverflow.com/q/3334168
downvote count: 0
has body: If I format a double using the toString method, then I get the full precision of the double. For example (using Scala syntax): java.text.MessageFormat.format ("{0}", Math.PI.toString) will result in a string containing: 3.141592653589793 However, this value is not localized. If I pass the double value as a boxed Double, that is as: java.text.MessageFormat.format ("{0}", Math.PI.asInstanceOf[AnyRef]) (AnyRef is the Scala type that is equivalent to Object in Java), then the result is a localized string with truncated precision: 3.142 The result is the same even if I add more of a hint to the format string: java.text.MessageFormat.format ("{0,number}", Math.PI.asInstanceOf[AnyRef]) I can get the full precision by specifying a custom format: java.text.MessageFormat.format ("{0,number,#.###############}", Math.PI.asInstanceOf[AnyRef]) but this requires some knowledge of the double's magnitude and precision. If I'm printing any double value (not just Pi), and want to retain the full precision of the value, then this approach means that I have to dynamically change the format string - and that's not exactly convenient if (as in my case) the format string is actually obtained from a resource bundle. For example, consider a double value of 1.0e37. Converting to a string first and using "{0}" as the format string results in the appropriate, but unlocalized, string value 1.0E37. If I pass this as a boxed Double with a format string of "{0,number}" then I get the ridiculous value 10,000,000,000,000,000,000,000,000,000,000,000,000. In short, I can't seem to find a format string that preserves the full precision of a double without first converting it to a string - and that's something I would prefer to avoid like the plague. Is there a number format string that outputs the full precision of a double as a localized value? UPDATE: Just to clarify why I would prefer not to have to convert doubles to strings: toString returns, so far as I'm able to tell, a valid Java double literal …

http://stackoverflow.com/comment/40535648
score: 0
type: AnswerComment
has text: understood. I learned something new today. have a blessed day!
type: Comment
comment on: http://stackoverflow.com/a/25898320

http://stackoverflow.com/comment/40585442
type: Comment
comment on: http://stackoverflow.com/a/25926238
has text: Haven't tested this, but it looks solid =)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40632790
has text: for sure i already have a question about this problem if some one could help
comment on: http://stackoverflow.com/q/25949303
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25943817
downvote count: 1
score: -1
has body: Calling GraphicsDevice#getFullScreenWindow might work, though I haven't really tested this code. BufferedImage screenshot; GraphicsDevice gd = GraphicsEnvironment .getLocalGraphicsEnvironment() .getDefaultScreenDevice(); Window window = gd.getFullScreenWindow(); if(window == null) { Robot robot = new Robot(); GraphicsConfiguration config = gd.getDefaultConfiguration(); screenshot = robot.createScreenCapture(config.getBounds()); } else { screenshot = new BufferedImage(window.getWidth(), window.getHeight(), BufferedImage.TYPE_INT_RGB); window.paint(screenshot.getGraphics()); } ImageIO.write(screenshot, "png", file);
has comment: http://stackoverflow.com/comment/40652180
has comment: http://stackoverflow.com/comment/40747468
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25943500

http://stackoverflow.com/a/25984893
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25984727
answers question: http://stackoverflow.com/q/25984727
type: Answer
has body: If i get your question right, the you want to access the array created here : public void create_table_array(Table table,int number) { Table[] tableList = new Table[number]; int i = 0; for(i = 0; i &lt; number; i++) tableList[i] = table; } What you can do is change the method from void to Table[] and return the created array. Like this: public Table[] create_table_array(Table table,int number) { Table[] tableList = new Table[number]; int i = 0; for(i = 0; i &lt; number; i++) tableList[i] = table; return tableList; } Now in your main program, you can call the method like this: Table[] tables = RestaurantObject.create_table_array(TableObject, max_tables); Now you can access all tables by their indices. For example for(int i = 0; i &lt; tables.length; i++) //do something to tables[i] Also, you should stick with JAVA naming conventions and use camelCase for variable names. For example: TableList==>tableList etc...

http://stackoverflow.com/q/25900167
tagged with: coldfusion-8
tagged with: apple-push-notifications
tagged with: coldfusion
type: AnsweredQuestion
has title: What is causing this error when using notnoop's java-apns library?
has answer: http://stackoverflow.com/a/25900568
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25900568
score: 1
tagged with: java
downvote count: 0
answer count: 1
tagged with: javaapns
favorite count: 0
has body: Code: &lt;cfset LOCAL.APNSService = CreateObject( "java", "com.notnoop.apns.APNS" ).newService( ).withCert( "MyCert.p12", "" ).withSandboxDestination().build() /&gt; Exception: java.io.IOException: failed to decrypt safe contents entry: java.lang.ArithmeticException: / by zero Stack Trace: com.notnoop.exceptions.InvalidSSLConfig: java.io.IOException: failed to decrypt safe contents entry: java.lang.ArithmeticException: / by zero at com.notnoop.apns.internal.Utilities.newSSLContext(Utilities.java:102) at com.notnoop.apns.ApnsServiceBuilder.withCert(ApnsServiceBuilder.java:139) at com.notnoop.apns.ApnsServiceBuilder.withCert(ApnsServiceBuilder.java:114) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at coldfusion.runtime.StructBean.invoke(StructBean.java:511) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2300)

http://stackoverflow.com/comment/40795945
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26028210
has text: I have added full stack trace here. Yes, it looks like resource declaration issue only rather than CXF issue. I have tried many different ways to solve resource declaration issue but no luck. Please help here.
score: 0

http://stackoverflow.com/a/26032504
type: Answer
has body: In Dependency Injection or lesser used term Inversion of Control is actually The the passing of a dependency (a service) to a dependent object (a client) (Source:Wikipedia). But this responsibility of passing or association is not done by the two objects in question themselves but some third entity, let's say Dependency Injector. Now the very objective of DI is that the object to be associated with each other, do not do the association themselves but leave it to the Dependency Injector via some configuration. Any Dependency Injector OR DI framework (e.g. Spring) is responsible for taking away the responsibility of creating and associating the objects from object themselves so that Object worry only about the business logic and leave the creation/configuration to the framework. In the example of &lt;jsp:include&gt;, One JSP is including the other JSP, the JSPs themselves are assuming the responsibility of associating themselves hence this is NOT a DI example.
score: 0
answers question: http://stackoverflow.com/q/26031429

http://stackoverflow.com/q/25973669
has answer: http://stackoverflow.com/a/25982754
possible better answer: http://stackoverflow.com/a/25995992
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has body: I am new in Talend and currently I am writing my first Talend job. I am doing the following: Query one MySQL db table (SELECT * FROM docs WHERE DocName = 'XYZ') which will return few records using tHashInput Store these records in memory using tHashOutput Fetch these records from memory using tHashInput and log the records using the tLogRow component I am running this Talend job from Java application like this: FetchDocuments mySQLConnectorJob = new FetchDocuments(); mySQLConnectorJob.runJob(new String[]{}); And at the end I would like to fetch these records somehow in the Java application, for example with some method: mySQLConnectorJob.getResultSet(); I know that we can store these records in the CSV file using the tFileOutputDelimited component and then to parse that file in the Java application to fetch records, but I would like to avoid using that file if it is possible. My questions: Do you know maybe how I can fetch records in the Java application and finish this task? If my design on Talend job is not good, could you provide me some advice how to change it to be able to finish task? Thanks, Nenad
type: Question
has title: Talend - Reading value from tHashImport component in Java application - HowTo?
has answer: http://stackoverflow.com/a/25995992
accepted answer: http://stackoverflow.com/a/25982754
score: 0
answer count: 2
tagged with: talend

http://stackoverflow.com/comment/40492459
score: 0
comment on: http://stackoverflow.com/q/25874831
type: Comment
type: QuestionComment
has text: @KickingLettuce That doesn't answer my question. Why did you remove the currency symbol from the `DecimalFormat` object? Your output won't have the currency sign anyway *since it's a `double`, not a `String`*

http://stackoverflow.com/a/26006260
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40729536
type: Answer
has body: Instead of a thread running all the time, I think it is better for you to use AsyncTask and triggers the task for each message. There is no point to keep a long running thread that is probably idle most of the time.
accepted answer of: http://stackoverflow.com/q/26006223
answers question: http://stackoverflow.com/q/26006223

http://stackoverflow.com/q/25941892
answer count: 0
type: UnansweredQuestion
has body: I have a small web app and I had put all the compiled classes of it (Not jar/war but simple .class files of all the classes) in /WEB-INF/classes/ folder of Tomcat. It was working fine without any issues. Since I had to put/copy all the classes separately, I created a jar file of them using Ant and put that app.jar in /WEB-INF/lib/ folder. I also moved all the individual .class files from /WEB-INF/classes/ (to make sure they are not used by Tomcat). Then I restarted the Tomcat server and now I get HTTP STATUS 404. Note that I left all the JSPs, web.xml etc as it was before. I just wanted to group all the .class files to a .jar to make my life easier. Is there something else I need to do ?
has title: Tomcat HTTP Status 404
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40614640
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/40614075
linked to: http://stackoverflow.com/q/7974882

http://stackoverflow.com/a/25894028
upvote count: 14
accepted answer of: http://stackoverflow.com/q/25893913
answers question: http://stackoverflow.com/q/25893913
score: 14
has comment: http://stackoverflow.com/comment/61450889
has comment: http://stackoverflow.com/comment/61455893
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Variables in scriptlets cannot be seen in JSTL because Expression Language, the stuff between ${} used in JSTL, will look for attributes in page, request, session or application. You have to at least store the variable from scriptlet in one of these scopes, then use it. This is an example: &lt;% boolean a = true; request.setAttribute("a", a); %&gt; &lt;c:if test="${a}"&gt; &lt;c:out value="a was found and it's true." /&gt; &lt;/c:if&gt; More info: Expression Language StackOverflow wiki JSTL StackOverflow wiki As a recommendation, stop using scriptlets. Move the business logic in your JSP to controller and the view logic into EL, JSTL and other tags like &lt;display&gt;. More info: How to avoid Java code in JSP files?

http://stackoverflow.com/q/25927447
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has title: Java project runs in ecipse but fails when exported
has body: Hey everyone thanks for all the help so far !. I have finally finished this project and it runs fine in eclipse but when I export it I get this error from stack trace also any help on how this could be improved in terms of architecture is much appreciated. Exception is Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeExcepti on: com.badlogic.gdx.utils.GdxRuntimeException: File not found: assets\font.fnt It runs fine in eclipe but fails when exported public class ConnectFourApplication extends Game implements ApplicationListener { private Screen screen; private Game game; public static void main(String[] args) { new LwjglApplication(new ConnectFourApplication(), "PennyPop", 1280, 720, true); } public ConnectFourApplication(){ game = this; } @Override public void create() { screen = new MainScreen(game); setScreen(screen); screen.show(); } @Override public void dispose() { screen.hide(); screen.dispose(); } /** Clears the screen with a white color */ private void clearWhite() { Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); } @Override public void pause() { screen.pause(); } @Override public void render() { clearWhite(); super.render(); } @Override public void resize(int width, int height) { screen.resize(width, height); } @Override public void resume() { screen.resume(); } public class MainScreen implements Screen { private final Stage stage; private final SpriteBatch spriteBatch; //Parameter for drawing the buttons private final BitmapFont font; private final TextureAtlas buttons; private final Button SFXButton; private final Button APIButton; private final Button GameButton; private final Skin images; //Parameter for Sound private final com.badlogic.gdx.audio.Sound SFXClick; //Parameter for the api call private final String WeatherUrl; private final HttpRequest request; private final City SanFrancisco; //The screen to load after the game button is hit private Screen gamescreen; private Game game; public MainScreen…
has answer: http://stackoverflow.com/a/26313246
tagged with: libgdx
answer count: 2
has comment: http://stackoverflow.com/comment/40587734
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40587692
has answer: http://stackoverflow.com/a/25927867

http://stackoverflow.com/q/25908921
answer count: 2
has answer: http://stackoverflow.com/a/25909067
linked to: http://stackoverflow.com/q/6309407
has comment: http://stackoverflow.com/comment/40571731
has comment: http://stackoverflow.com/comment/40553456
tagged with: jframe
score: 0
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/25954968
has body: I have a frame (called from the main window) with button, on click it run a cycle, in console i see: 1 2 3 4 5 The frame is closed by setDefaultCloseOperation (JFrame.DISPOSE_ON_CLOSE); If I close the frame, and reopen it again, when click on the button in the console displays 1 2 3 4 5 1 2 3 4 5 the output is duplicate and so will increase each time when I re-open the frame (up to a complete restart of the program). Please help! How to close the frame (without closing the program) without duplicate. Thank!
has title: Java JFrame.DISPOSE_ON_CLOSE + duplicate cycle when reopen the frame
tagged with: java
tagged with: duplicates
type: Question

http://stackoverflow.com/comment/40609105
comment on: http://stackoverflow.com/q/25939228
type: Comment
type: QuestionComment
score: 1
has text: You need to peek item then call dequeue

http://stackoverflow.com/comment/40660066
has text: @klaux if you have seen my first comment. that comment it self is an answer. have you tried that one? `there are two solution for this. you need MainActivity reference in your Thread class else you need to create incrementCounter method as Static.`
comment on: http://stackoverflow.com/a/25967952
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/25969716
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/40662936
has title: runtime exception in mysql
has comment: http://stackoverflow.com/comment/40663413
score: 0
has comment: http://stackoverflow.com/comment/40669209
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40663599
has answer: http://stackoverflow.com/a/25989069
has comment: http://stackoverflow.com/comment/40664340
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40663837
has body: I have a code as shown below for data access object. On successful insertion of data in signup table,I want to extract only CustId of the signup table of that particular row. So am using UserName column to extract that particular users CustId in readCustomer() method. The program is as shown below: public class RegisterDAO { public static int custId; private DataSource dataSource; public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; public void createCustomer(Register register) { String sql = "INSERT INTO signup " + "(CustId,FirstName,LastName,Address1,Address2,Country,State,City,ZipCode,UserName,EmailId,ContactNo,MobileNo,Status)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,'ONHOLD')"; Connection conn = null; try { conn = dataSource.createConnection(); PreparedStatement ps = conn.prepareStatement(sql); ps.setInt(1, register.getId()); ps.setString(2, register.getFirstName()); ps.setString(3, register.getLastName()); ps.setString(4, register.getAddress1()); ps.setString(5, register.getAddress2()); ps.setString(6, register.getCountry()); ps.setString(7, register.getState()); ps.setString(8, register.getCity()); ps.setInt(9, register.getZipCode()); ps.setString(10, register.getUserName()); ps.setString(11, register.getEmailId()); ps.setString(12, register.getContactNo()); ps.setString(13, register.getMobileNo()); ps.executeUpdate(); ps.close(); } catch (SQLException e) { throw new RuntimeException(e); } catch (NullPointerException e1){ } finally { if (conn != null) { try { conn.close(); } catch (SQLException e) { } } } } public void readCustomer(String username) { String sql= "select * from signup where UserName= '" + username + "'"; Connection conn = null; try { conn = dataSource.createConnection(); PreparedStatement ps = conn.prepareStatement(sql); ResultSet rs = ps.executeQuery(); if (rs.next()) { custId =rs.getInt("CustId"); System.out.println(custId); } }catch (SQLException …
has comment: http://stackoverflow.com/comment/40662653
tagged with: java
has comment: http://stackoverflow.com/comment/40662581
has comment: http://stackoverflow.com/comment/40665153
tagged with: mysql
has comment: http://stackoverflow.com/comment/40664372
type: Question

http://stackoverflow.com/a/25942074
has comment: http://stackoverflow.com/comment/40614746
has body: Your code seems to be a little off. It's harder to capture what you're trying to do in a linear layout. The ImageView would be your fragment. <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:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MyActivity$PlaceholderFragment"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Some Text" android:gravity="center" android:textSize="20dp"/> <ImageButton android:layout_width="75dp" android:layout_height="75dp" android:id="@+id/random_image" android:src="@drawable/ic_launcher" /> <ImageButton android:layout_width="75dp" android:layout_height="75dp" android:id="@+id/random_image2" android:layout_below="@id/random_image" android:src="@drawable/ic_launcher"/> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_toRightOf="@id/random_image" android:layout_alignBottom="@id/random_image2" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:background="#000000"/>
has comment: http://stackoverflow.com/comment/40614637
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25941493

http://stackoverflow.com/a/26064161
accepted answer of: http://stackoverflow.com/q/26018730
type: AcceptedAnswer
has body: I found a solution to my problem. I replaced the default FrameLayout that Android automatically created as a container for my fragments, with a ViewPager, then created a FragmentPagerAdapter like this: public static class MyAdapter extends FragmentPagerAdapter { public MyAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { Fragment fragment; switch (position) { // ...other cases case PEN: fragment = PenaltiesFragment.newInstance(); break; // ...other cases } return fragment; } @Override public int getCount() { return 6; } } Then the only thing left to do to keep all the views at all times has been to add this line to my activity onCreate method. mPager.setOffscreenPageLimit(5); See the documentation for details on how this method works. This way, though, I had to reimplement all the back button logic, but it's still simple, and this is how I did it: I create a java.util.Stack&lt;Integer&gt; object, add fragment numbers to it (except when you use the back button, see below), and override onBackPressed() to make it pop the last viewed fragment instead of using the back stack, when my history stack is not empty. You want to avoid pushing elements on the Stack when you press the back button, otherwise you will get stuck between two fragments if you keep using the back button, instead of eventually exiting. My code: MyAdapter mAdapter; ViewPager mPager; Stack&lt;Integer&gt; pageHistory; int currentPage; boolean saveToHistory; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mAdapter = new MyAdapter(getSupportFragmentManager()); mPager = (ViewPager)findViewById(R.id.container); mPager.setAdapter(mAdapter); mPager.setOffscreenPageLimit(5); pageHistory = new Stack&lt;Integer&gt;(); mPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int arg0) { if(saveToHistory) pageHistory.push(Integer.valueOf(current…
type: Answer
answers question: http://stackoverflow.com/q/26018730
score: 0

http://stackoverflow.com/a/25900793
score: 1
upvote count: 1
has body: As you post in your question I also checked the Servlet itself when asking it on the hyperlink with the .java extension I think you are putting the servlet class file in a folder under your web folder and that is why you can access trough the url. project src web controllers TestServlet.java page.jsp WEB-INF classes As opposed of the jsp files the servlet classes must be in the WEB-INF/classes folder (the .class file not the .java file), and the source code of your class must be in the src folder of your project under the package controllers so: project src controllers TestServlet.java web page.jsp WEB-INF classes controllers TestServlet.class If you're using eclipse, netbeans or other IDE when you put your java class in the source folder it automatically put the .class in the WEB-INF/classes folder.
answers question: http://stackoverflow.com/q/25898812
downvote count: 0
type: Answer

effective-java
tags question: http://stackoverflow.com/q/25973463
tag name: effective-java
type: Tag

http://stackoverflow.com/comment/56393820
type: AnswerComment
type: Comment
score: 2
has text: Source: Language Level change to 7 - Diamonds, ARM, multi-catch etc. for IDEA 15
comment on: http://stackoverflow.com/a/26009627

http://stackoverflow.com/q/25984807
tagged with: servlets
type: Question
has body: When I have this code in my servlet doPost method, everything is fine. @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ... String data = CharStreams.toString(new InputStreamReader(request.getInputStream(), "UTF-8")); ... } I wanted to move this code out to another class, but when I did that I get this error that intellij reports: java.io.UnsupportedEncodingException public class SomeUtil { public String readFromInput(ServletInputStream is) { return CharStreams.toString(new InputStreamReader(is, "UTF-8")); } } Does the servlet doPost somewhere handle this exception that I can't see?
has answer: http://stackoverflow.com/a/25984865
accepted answer: http://stackoverflow.com/a/25984865
answer count: 1
has comment: http://stackoverflow.com/comment/40690548
has comment: http://stackoverflow.com/comment/40690565
score: 0
has comment: http://stackoverflow.com/comment/40690591
has comment: http://stackoverflow.com/comment/40690577
type: AnsweredQuestion
tagged with: java
has title: UnsupportedEncodingException when I moved logic to my own class from my Servlet doPost method

http://stackoverflow.com/comment/40797463
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25971898
type: Comment
has text: What I want is to have a file X.properties where the resource bundle can fin data ( as messages or others ) and use this data inside the app(ejb app), so these file could be packaged when the app is deployed

http://stackoverflow.com/comment/40676987
comment on: http://stackoverflow.com/a/25977176
type: Comment
score: 0
has text: Unfortunately it didn't help( This problem arose after migration from cq 5.5 to cq 5.6.1
type: AnswerComment

http://stackoverflow.com/comment/42267308
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26813585
has text: I am not sure but I think as you leave that activity gc dose not run immediately, I think it only runs when you need more memory and dose not have enough, so play around and see if it will do any cleaning or not.

http://stackoverflow.com/comment/40638782
has text: No it keeps leading me to the same error after making more changes
type: Comment
comment on: http://stackoverflow.com/q/25956592
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40724141
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26001202
score: 0
has text: Have you tried adding attributes to the Model and have the ModelAndView to redirect?

http://stackoverflow.com/q/25973854
type: AnsweredQuestion
has title: Web crawler with incremental crawling support for windows
score: 1
tagged with: java
tagged with: nutch
has body: I need a open source web crawler developed in java with incremental crawling support. Web crawler should be easily customized and integrated with solr or elasticsearch. It should be an active one which is developing further with more features. Aperture is one of a good crawler, it has all features i mentioned but its not an active crawler and due to license (if i use it for commercial purpose) of their dependency i ignored. Nutch - a web crawler which has more features with hadoop support. But i go through many websites and tutorials, there is no proper documents, api found for customizing it programmatically in windows. I could edit the code in eclipse but it cause many errors while running map reduce jobs. There is no java api for nutch to implement like aperture. Crawl4j is a good web crawler but it has no incremental crawling features and i haven't checked license problems. Is there any other crawler which have all features that i mentioned or is there any way to use any one of above mentioned crawler for my requirements? Helpful answers will be greatly appreciated.
tagged with: crawler4j
tagged with: web-crawler
type: Question
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26312159
favorite count: 0
tagged with: solr
upvote count: 1
has answer: http://stackoverflow.com/a/26312159

http://stackoverflow.com/a/64525877
has comment: http://stackoverflow.com/comment/114094932
has body: I was recently facing the same problem. This Error was showing on my screen after running my project main file. Error:java: invalid source release: 11 Follow the steps to resolve this error File-&gt;Project Structure -&gt; Project Click New button under Project SDK: Add the latest SDK and Click OK. After running You will see error is resolved..
type: Answer
answers question: http://stackoverflow.com/q/25878045
score: 0

http://stackoverflow.com/comment/40613060
score: 0
type: Comment
type: QuestionComment
has text: You might consider looking into this http://www.jvmmonitor.org/ JVM Monitor for eclipse
comment on: http://stackoverflow.com/q/25941348

http://stackoverflow.com/comment/40579967
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25922912
has text: It means that `viewText` is `null`. Something wrong with `TextView viewText = (TextView)findViewById(R.id.textView4);`. Please re-check the id.
score: 0

http://stackoverflow.com/comment/40691759
type: Comment
score: 1
has text: use "DROP TABLE IF EXISTS 'myDatabase.myTable" in command line and check what happens
comment on: http://stackoverflow.com/q/25985410
type: QuestionComment

http://stackoverflow.com/comment/113403002
type: Comment
score: 0
comment on: http://stackoverflow.com/a/44936883
type: AnswerComment
has text: Also note that, unlike other solutions on this page, this solution returns a _view_ to the underlying map, not a copy.

http://stackoverflow.com/q/25992277
favorite count: 0
has title: @AspectJ pointcut for all methods inside package
tagged with: spring
has answer: http://stackoverflow.com/a/47108760
upvote count: 34
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26005838
tagged with: java
score: 34
has body: I have this working code for a specific package, but i want to configure it for all controllers, service and dao packages Eg com.abc.xyz.content.controller com.abc.xyz.content.service com.abc.xyz.content.dao com.abc.xyz.category.controller com.abc.xyz.category.service com.abc.xyz.category.dao and so on. . . that is the base package of my project, can someone please help how I can go about doing it so that it works for all classes of my web project including controllers, thanks in advance. . . package com.abc.xyz.utilities; import java.util.Arrays; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @Aspect @Component public class LoggingAspect { private Log log = LogFactory.getLog(this.getClass()); @Pointcut("execution(* com.abc.xyz.content.service..*(..))") protected void loggingOperation() { } @Before("loggingOperation()") @Order(1) public void logJoinPoint(JoinPoint joinPoint) { log.info("Signature declaring type : " + joinPoint.getSignature().getDeclaringTypeName()); log.info("Signature name : " + joinPoint.getSignature().getName()); log.info("Arguments : " + Arrays.toString(joinPoint.getArgs())); log.info("Target class : " + joinPoint.getTarget().getClass().getName()); } @AfterReturning(pointcut = "loggingOperation()", returning = "result") @Order(2) public void logAfter(JoinPoint joinPoint, Object result) { log.info("Exiting from Method :" + joinPoint.getSignature().getName()); log.info("Return value :" + result); } @AfterThrowing(pointcut = "execution(* com.abc.xyz.content.service.…
type: Question
possible better answer: http://stackoverflow.com/a/25992338
has answer: http://stackoverflow.com/a/25992338
tagged with: aop
linked to: http://stackoverflow.com/q/2011089
accepted answer: http://stackoverflow.com/a/26005838
tagged with: spring-aop
tagged with: aspectj
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/40726413
comment on: http://stackoverflow.com/q/26002682
score: 1
type: Comment
type: QuestionComment
has text: Wait... Why would a web app ever be a jar?

http://stackoverflow.com/q/25913880
has body: I am done with iOS MDM enrollment as well as commands like DeviceInformation, DeviceLock and applying policies(restriction). I want to check at server side whether the policies(restrictions) and configurations that I pushed are applied correctly or not? e.g. : If I had set passcode policy with certain restriction, and I want to know whether user has set it correctly according to passcode policy applied. Similarly, I have to test other restrictions and configurations, whether they applies correctly or not? So that I will maintain state of that device whether it is compliant or not? So, Is there any way to know this? Or any command with which I will get to know applied restrictions and configurations on device? Hope my question is clear to understand.. Thanks in advance..!
accepted answer: http://stackoverflow.com/a/25917017
has title: iOS MDM: How to know whether the applied policies(restriction) and configurations are complaint?
score: 0
tagged with: ios
answer count: 1
type: AnsweredQuestion
tagged with: mdm
type: Question
has answer: http://stackoverflow.com/a/25917017
tagged with: java

http://stackoverflow.com/comment/40695026
has text: can you please elaborate a little about the code. I think query1 is in properties file and the second line is in java class. What is MessageFormat???. I think you are still hardcoding the column and table in java class which I don't prefer. Is there any way to proceed with same approach but reading the column as well as the table name properties file.
comment on: http://stackoverflow.com/a/25987311
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40649397
type: AnswerComment
type: Comment
has text: thanks for noticing that. I tried it but i still get the same error so it must be that and something else.
comment on: http://stackoverflow.com/a/25962499
score: 0

http://stackoverflow.com/comment/40496833
comment on: http://stackoverflow.com/q/25877337
score: 0
has text: As @anubhava indicates `bash -c cd && pwd` is parsed by the shell as `bash -c cd`, `&&`, `pwd` and you need `cd && pwd` to be passed as the argument to `-c`.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25881598
answer count: 1
favorite count: 0
has body: Can any one help to explain why I get so many "Broken pipe IOE" in ZooKeeper log? ZooKeeper throws this exception almost every minute. I don't think we use the four letter command to dumpWatches so frequently. So what does this mean? This may be caused by the command wchc because our ZooKeeper has more than ten thousand znodes. And I have found that this command is executed from the same server with the different port. Will ZooKeeper call this command frequently? 2014-09-17,10:52:09,179 ERROR org.apache.zookeeper.server.NIOServerCnxn: [myid:0] Error sending data synchronously java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:69) at sun.nio.ch.IOUtil.write(IOUtil.java:40) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:336) at org.apache.zookeeper.server.NIOServerCnxn.sendBufferSync(NIOServerCnxn.java:138) at org.apache.zookeeper.server.NIOServerCnxn$SendBufferWriter.checkFlush(NIOServerCnxn.java:453) at org.apache.zookeeper.server.NIOServerCnxn$SendBufferWriter.write(NIOServerCnxn.java:474) at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111) at java.io.BufferedWriter.write(BufferedWriter.java:212) at java.io.PrintWriter.write(PrintWriter.java:412) at java.io.PrintWriter.write(PrintWriter.java:429) at java.io.PrintWriter.print(PrintWriter.java:559) at java.io.PrintWriter.println(PrintWriter.java:695) at org.apache.zookeeper.server.WatchManager.dumpWatches(WatchManager.java:166) at org.apache.zookeeper.server.DataTree.dumpWatches(DataTree.java:1240) at org.apache.zookeeper.server.NIOServerCnxn$WatchCommand.commandRun(NIOServerCnxn.java:722) at org.apache.zookeeper.server.NIOServerCnxn$CommandThread.run(NIOServerCnxn.java:496) 2014-09-17,10:52:09,179 INFO org.apache.zookeeper.server.NIOServerCnxn: [myid:0] Closed socket connection for client /10.20.201.234:53756 which had sessionid 0x34840357f664…
tagged with: exception
has title: So many "Broken pipe IOE" in ZooKeeper log
downvote count: 0
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/25889763
score: 1
tagged with: java
type: Question
tagged with: apache-zookeeper
upvote count: 1

http://stackoverflow.com/q/25925403
has comment: http://stackoverflow.com/comment/40584054
has comment: http://stackoverflow.com/comment/40584085
type: AnsweredQuestion
tagged with: equals
tagged with: java
has answer: http://stackoverflow.com/a/25925476
type: Question
tagged with: hashcode
has comment: http://stackoverflow.com/comment/40584125
score: 0
has title: Equals method returning always true JAVA
answer count: 2
possible better answer: http://stackoverflow.com/a/25925572
has answer: http://stackoverflow.com/a/25925572
tagged with: arrays
accepted answer: http://stackoverflow.com/a/25925476
has body: I am having a problem with overriding equals method in one class, this class has only one attribute which is a 2-dimensional array called grid. This is the constructor: public World(int n, int m){ this.grid = new Object[n][m]; } The equals method: @Override public boolean equals(Object obj) { if (this == obj) return true; if (null == obj) return false; if ( !obj instanceof World) return false; World other = (World) obj; if ( !Arrays.deepEquals(grid, other.grid)) return false; return true; } I have already overridden the hashCode() method as well, but the problem is that doesn't matter the case, the equals is always returning true. Does anyone know what is wrong?

http://stackoverflow.com/a/26016429
answers question: http://stackoverflow.com/q/26015943
downvote count: 0
has comment: http://stackoverflow.com/comment/40747391
score: 4
has comment: http://stackoverflow.com/comment/40755080
has comment: http://stackoverflow.com/comment/40753933
has comment: http://stackoverflow.com/comment/40757571
type: Answer
has comment: http://stackoverflow.com/comment/40748850
has comment: http://stackoverflow.com/comment/40755356
has comment: http://stackoverflow.com/comment/40754144
has body: One may use for docx (a zip with XML and other files) a java zip file system and XML or text processing. URI docxUri = ,,, // "jar:file:/C:/... .docx" Map&lt;String, String&gt; zipProperties = new HashMap&lt;&gt;(); zipProperties.put("encoding", "UTF-8"); try (FileSystem zipFS = FileSystems.newFileSystem(docxUri, zipProperties)) { Path documentXmlPath = zipFS.getPath("/word/document.xml"); When using XML: DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(Files.newInputStream(documentXmlPath)); //Element root = doc.getDocumentElement(); You can then use XPath to find the places, and write the XML back again. It even might be that you do not need XML but could replace place holders: byte[] content = Files.readAllBytes(documentXmlPath); String xml = new String(content, StandardCharsets.UTF_8); xml = xml.replace("#DATE#", "2014-09-24"); xml = xml.replace("#NAME#", StringEscapeUtils.escapeXml("Sniper"))); ... content = xml.getBytes(StandardCharsets.UTF_8); Files.delete(documentXmlPath); Files.write(documentXmlPath, content); For a fast development, rename a copy of the .docx to a name with the .zip file extension, and inspect the files. File.write should already apply StandardOpenOption.TRUNCATE_EXISTING, but I have added Files.delete as some error occured. See comments.
has comment: http://stackoverflow.com/comment/40749490
has comment: http://stackoverflow.com/comment/40764346
has comment: http://stackoverflow.com/comment/40748072
has comment: http://stackoverflow.com/comment/40747304
has comment: http://stackoverflow.com/comment/40756394
upvote count: 4
has comment: http://stackoverflow.com/comment/40758703
has comment: http://stackoverflow.com/comment/40748234

http://stackoverflow.com/a/46918838
upvote count: 13
has comment: http://stackoverflow.com/comment/89146037
type: Answer
downvote count: 0
score: 13
has body: You can import the SSL cert manually and just add it to the keystore. For linux users, Syntax: keytool -trustcacerts -keystore /jre/lib/security/cacerts -storepass changeit -importcert -alias nexus -file Example : keytool -trustcacerts -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/security/cacerts -storepass changeit -importcert -alias nexus -file ~/Downloads/abc.com-ssl.crt
answers question: http://stackoverflow.com/q/25911623
has comment: http://stackoverflow.com/comment/137365527

lwjgl
tags question: http://stackoverflow.com/q/25979454
tag name: lwjgl
tags question: http://stackoverflow.com/q/25957768
tags question: http://stackoverflow.com/q/25921143
tags question: http://stackoverflow.com/q/25926409
type: Tag

file-upload
tags question: http://stackoverflow.com/q/25956767
type: Tag
tags question: http://stackoverflow.com/q/25961104
tags question: http://stackoverflow.com/q/26015378
tag name: file-upload

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/25987176
tags question: http://stackoverflow.com/q/25970123
tags question: http://stackoverflow.com/q/25922372
tags question: http://stackoverflow.com/q/25933331
tags question: http://stackoverflow.com/q/25927306
tags question: http://stackoverflow.com/q/25925306
tags question: http://stackoverflow.com/q/25949642
tags question: http://stackoverflow.com/q/25989277
tags question: http://stackoverflow.com/q/25875883
tags question: http://stackoverflow.com/q/25964496
tags question: http://stackoverflow.com/q/26013925
tags question: http://stackoverflow.com/q/26030693
tags question: http://stackoverflow.com/q/25903128
tags question: http://stackoverflow.com/q/25999265
tags question: http://stackoverflow.com/q/25919108
tags question: http://stackoverflow.com/q/25974209
tags question: http://stackoverflow.com/q/25903478
type: Tag
tags question: http://stackoverflow.com/q/25911129
tags question: http://stackoverflow.com/q/25941022
tags question: http://stackoverflow.com/q/25955951

http://stackoverflow.com/comment/40755318
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26020607
has text: I see no problem. What type `jdbcTemplate` have?
score: 0

http://stackoverflow.com/comment/40634786
has text: 1) Why code an applet? If it is due to the teacher specifying it, please refer them to [Why CS teachers should **stop** teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 2) Why not simply use HTML/JS for this?
type: Comment
comment on: http://stackoverflow.com/q/25943647
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40577518
has text: If you're not catching the exception it's either because it's not being thrown inside the `try` range or because the two exception classes are somehow different from each other. (Or because some other `try` catches it first.)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25921475

http://stackoverflow.com/comment/40705017
has text: @m0skit0 Can you concretize question? A annotated as Component and as Service and have annotated Activate method
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25991841
score: 0

http://stackoverflow.com/comment/40620239
has text: Two good strategies for big buttons. 1) Large font (or a large icon) 2) [`setMargin(Insets)`](http://docs.oracle.com/javase/8/docs/api/javax/swing/AbstractButton.html#setMargin-java.awt.Insets-).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25945439
type: Comment

http://stackoverflow.com/a/26004114
has comment: http://stackoverflow.com/comment/40735156
accepted answer of: http://stackoverflow.com/q/26003521
answers question: http://stackoverflow.com/q/26003521
has comment: http://stackoverflow.com/comment/40725594
score: 0
type: AcceptedAnswer
type: Answer
has body: How do you know that the web service is receiving duplicate json objects? Are you looking directly at the web service or just the app's log? Because you created two identical logs: Log.i("coooooooooooooooooooooooooooooooooooooood", "Server Response : " + response1); Log.i("coooooooooooooooooooooooooooooooooooooood", "Server Response : " + response1);
has comment: http://stackoverflow.com/comment/40725508

http://stackoverflow.com/comment/40540140
comment on: http://stackoverflow.com/q/25893503
has text: Do you want to convert it to a legacy binary .doc, or a docx file?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/40660485
type: AnswerComment
comment on: http://stackoverflow.com/a/25942616
has text: I've verified that your suggested workaround crashes JVM - even worse than ArrayIndexOutOfBoundsException.
type: Comment
score: 0

http://stackoverflow.com/comment/40646582
type: Comment
comment on: http://stackoverflow.com/a/25961041
score: 0
has text: Did you set the `JAVA_HOME` variable under the **System Variables** section? You may need to restart Windows for the changes to take effect.
type: AnswerComment

http://stackoverflow.com/a/26014399
upvote count: 6
has comment: http://stackoverflow.com/comment/40743522
answers question: http://stackoverflow.com/q/26014322
type: AcceptedAnswer
downvote count: 0
has body: You are not updating strOption. You should move your strOption=sc.nextLine(); inside your while loop Also, as TheLostMind pointed out, replace hasNext with hasNextLine. Edit You might consider to switch to Console. Also, you may create confirm utility method since it's fairly common task: private Console console; ... console = System.console(); ... if (confirm("Do you want to create the file.elt? (Y/N)")) { elements.createElements(file); } else { System.out.println("There will be no file.elt created! ."); } ... private boolean confirm(String message) { String answer = console.readLine(message); while (!answer.matches("[YyNn]")) { answer = console.readLine("Please, type Y or N."); } return "Y".equalsIgnoreCase(answer); } Note: This doesn't work in eclipse.
accepted answer of: http://stackoverflow.com/q/26014322
score: 6
type: Answer

http://stackoverflow.com/comment/40762920
has text: @DoubleDouble yes you're right
comment on: http://stackoverflow.com/q/26024326
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26021050
has answer: http://stackoverflow.com/a/37196796
score: 7
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/58968790
has comment: http://stackoverflow.com/comment/40756630
has comment: http://stackoverflow.com/comment/40757000
accepted answer: http://stackoverflow.com/a/26022710
has title: JPA/Hibernate select query returning duplicate records
type: Question
has comment: http://stackoverflow.com/comment/40757398
has body: I have a table ,say, Instrument with ID,State, and User_ID as columns. So I have this JPA query to return all the instrument records with a matching User_ID. query = manager.createQuery("SELECT instrument from Instrument instrument where instrument.User_ID=:User_ID",Instrument.class); query.setParameter("User_ID", User_ID); List&lt;Instrument&gt; instruments= query.getResultList(); for(Instrument instrument:instruments){ System.out.println("Instrument ID "+instrument.getID()); // using sysout as it is not prod code yet } It is returning only the first record repeated as many times as there are matching records. 11:13:01,703 INFO [stdout] (http-/127.0.0.1:8080-1) Instrument ID 1 11:13:01,704 INFO [stdout] (http-/127.0.0.1:8080-1) Instrument ID 1 11:13:01,704 INFO [stdout] (http-/127.0.0.1:8080-1) Instrument ID 1 I have three records in Db with instrument IDs 1,2, and 3 I enabled show sql query on hibernate and the query runs fine on the Database directly and returns distinct records. Hibernate Query: select instrumentjdo0_.User_ID as member_U1_0_, instrumentjdo0_.ID as ID2_0_, instrumentjdo0_.state as state4_0_ from instrument instrumentjdo0_ where instrumentjdo0_.User_ID=? Instrument Entity import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "instrument") public class Instrument{ @Id @Column(name="User_ID", length=9, unique=true, nullable=false) String user_ID; @Column(name="ID",nullable=false) String ID; @Column(name="state",nullable=false) String state; public String getID() { return ID; } public void setID(String ID) { this.ID = ID; } public String getUserID() { return user_ID; } public void setUserID(String userID) { this.user_ID = userID; } public String getState() { return state; } public void setState(String state) { this.state = state; } } Not sure what I am missing.
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/40756072
has comment: http://stackoverflow.com/comment/40757007
favorite count: 0
tagged with: oracle-database
tagged with: sql
has comment: http://stackoverflow.com/comment/40756794
answer count: 4
has answer: http://stackoverflow.com/a/26022710
has comment: http://stackoverflow.com/comment/40756497
has comment: http://stackoverflow.com/comment/40756170
has answer: http://stackoverflow.com/a/68490314
has comment: http://stackoverflow.com/comment/40756894
upvote count: 7
possible better answer: http://stackoverflow.com/a/37196796
type: AnsweredQuestion

http://stackoverflow.com/q/25988243
has body: I have some issues mocking a method (using mockito) which depending from the input parameter return a String or an exception. The code of the unit test seems to be wrong but even after asking google I could not find a solution. Thanks for any help public class MyClassTest { public MyClass mc; public ClassUnknown cu; @Before public void setUp() { mc = new MyClass(); cu = mock(ClassUnknown.class); // The next two lines seems to be wrong when(cu.methodUnknown("hello")).thenReturn("hello there"); when(cu.methodUnknown("???")).thenThrow(new Exception("don't know")); } @Test public void testMain() { mc.mainMethod("hello"); .....; } } and here is the "classUnknown": public class ClassUnknown { public String methodUnknown(String s) throws Exception { // The real logic is much more complex and does some CRUD operations if (s.equals("Hello")) { return "Hello there"; } throw new Exception("don't know"); } } and the class to be tested: public class MyClass { public void mainMethod(String s) { ClassUnknown cu = new ClassUnknown(); try { String methodUnknown = cu.methodUnknown(s); System.out.println(methodUnknown); } catch (Exception ex) { System.out.println(ex.getMessage()); } } }
accepted answer: http://stackoverflow.com/a/25988385
score: 0
has title: Mocking an Exception
answer count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25988385
tagged with: junit4
tagged with: java
tagged with: unit-testing
type: Question
tagged with: mockito

http://stackoverflow.com/comment/40602394
type: AnswerComment
type: Comment
has text: So when spring is managing the transactions will it close the session after transaction is completed?
score: 0
comment on: http://stackoverflow.com/a/25935140

http://stackoverflow.com/q/25882272
possible better answer: http://stackoverflow.com/a/25882358
downvote count: 0
favorite count: 0
has title: Join() in multithreading
has answer: http://stackoverflow.com/a/25882465
answer count: 4
has answer: http://stackoverflow.com/a/25882461
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/25882358
type: Question
accepted answer: http://stackoverflow.com/a/25882475
has body: According to join definition, the join thread executes till its execution is complete and is not prempted in the middle (correct me if i am wrong) .But in the following code: the join thread t1 doesnt stop the main thread to take the control in between the execution of t1. why so ? public class JavaAtomic { public static void main(String[] args) throws InterruptedException { ProcessingThread pt = new ProcessingThread(); Thread t1 = new Thread(pt, "t1"); t1.start(); Thread t2 = new Thread(pt, "t2"); t2.start(); t1.join(); t2.join(); System.out.println("Processing count=" + pt.getCount()); } } class ProcessingThread implements Runnable { private int count; @Override public void run() { for (int i = 1; i &lt; 5; i++) { processSomething(i); count++; System.out.println(Thread.currentThread()+"---"+getCount()) ; } } public int getCount() { return this.count; } private void processSomething(int i) { // processing some job try { Thread.sleep(i * 1000); } catch (InterruptedException e) { e.printStackTrace(); } } } output: Thread[t1,5,main]---1 Thread[t2,5,main]---2 Thread[t1,5,main]---3 Thread[t2,5,main]---4 Thread[t1,5,main]---5 Thread[t2,5,main]---5 Thread[t2,5,main]---6 Thread[t1,5,main]---7 Processing count=7 Many Thanks Jayendra
has answer: http://stackoverflow.com/a/25882475

http://stackoverflow.com/q/26024755
tagged with: java
downvote count: 2
type: Question
has body: I need to read through several text files, all located within the same directory. I need to loop through each line of the text file, parse the line out, perform some processing, then read the next line. When I get to the last line, I want to read the next file in the directory, if another file exists. Does anyone know of a way to read through each file within a directory? ie. All lines in file1, then all lines in file2, then al lines in file3. I know how to read through the text lines, but I do not know how to read the next file in the directory. The files names may not be known in advance, but I still need to read the next file available. Example File1.txt - Data line 1 - Data line 2 - Data line 3 File2.txt - Data line 1 - Data line 2 File7.txt - Data line 1 - Data line 2 - Data line 3
score: -2
has answer: http://stackoverflow.com/a/26025017
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/326390
has answer: http://stackoverflow.com/a/26024810
has comment: http://stackoverflow.com/comment/40763294
favorite count: 0
type: UnansweredQuestion
has title: How to read multiple files in java
has comment: http://stackoverflow.com/comment/40763514

http://stackoverflow.com/a/25996058
answers question: http://stackoverflow.com/q/25981657
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40723106
has body: You are on your own here in the sense that Ehcache does not offer an out-of-the-box solution for this. You also need to realize that depending on the frequency and running time of that update, this may cause bottle necks. Can't you find a different pattern for doing this?
type: Answer
accepted answer of: http://stackoverflow.com/q/25981657
score: 0

http://stackoverflow.com/a/25926958
has comment: http://stackoverflow.com/comment/40609487
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40617865
answers question: http://stackoverflow.com/q/25919653
has comment: http://stackoverflow.com/comment/40611429
upvote count: 3
has comment: http://stackoverflow.com/comment/40607376
has body: Note that you can control the buffer size but you cannot control how many messages get stored in-memory before being flushed to disk. This is a function of how fast these messages get produced versus how fast they are consumed. If your queue size is too small and your buffer becomes full during a burst, the call to logger.log(...) will block until space is available in the buffer again. So be careful about making the size too small, unless you are on a platform with very little memory (embedded or phone or so).
type: Answer
has comment: http://stackoverflow.com/comment/40607360

http://stackoverflow.com/q/25882944
has comment: http://stackoverflow.com/comment/40507072
type: AnsweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25883320
type: Question
tagged with: combinations
has title: Finding all possible combination of elements across lists of varying length
has comment: http://stackoverflow.com/comment/40506904
score: -1
has comment: http://stackoverflow.com/comment/40506648
has comment: http://stackoverflow.com/comment/40516750
answer count: 1
has body: I have n lists, each of which having variable number of elements. I want to find all possible combination of elements across lists. for eg, list1 = l11, l12 list2 = l21 list3 = l31,l32 The resulting list should contain [l11] [l12] [l21] [l31] [l32] [l11, l21] [l12, l21] [l21, l31] [l21, l32] [l11, l31] [l11, l32] [l12, l31] [l12, l32] [l11, l21, l31] [l11, l21, l32] [l12, l21, l31] [l12, l21, l31] Please provide some insight into solving the problem. I am implementing the solution in java
accepted answer: http://stackoverflow.com/a/25883320
tagged with: permutation
favorite count: 0
has comment: http://stackoverflow.com/comment/40506974
downvote count: 2
has comment: http://stackoverflow.com/comment/40506643

http://stackoverflow.com/q/25911698
tagged with: mongodb
tagged with: datanucleus
accepted answer: http://stackoverflow.com/a/25919397
score: 0
has title: how to remove class name from references in mongodb+datanucleus
has answer: http://stackoverflow.com/a/25919397
answer count: 1
has body: I have two classes with 1-1 relations. classes are final, so there is no inheritance. @PersistantCapable @DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY) class A { @PrimaryKey @Column(name = "_id") @Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT long id; } class B { A a; } The whole system works correctly, but references represented in very inefficient way. For instance: { a: "full.class.name.A:3" }. I want to remove class names and use integers to store IDs, this will improve speed (especially on indexes) and disk space consumption.
tagged with: jdo
has comment: http://stackoverflow.com/comment/40673541
type: AnsweredQuestion
tagged with: java
type: Question

random
tags question: http://stackoverflow.com/q/25968676
tags question: http://stackoverflow.com/q/25884994
tags question: http://stackoverflow.com/q/25919883
tags question: http://stackoverflow.com/q/25994281
tags question: http://stackoverflow.com/q/25962328
tags question: http://stackoverflow.com/q/25904241
tags question: http://stackoverflow.com/q/25987918
tags question: http://stackoverflow.com/q/25947404
tags question: http://stackoverflow.com/q/25875692
tags question: http://stackoverflow.com/q/25955683
tags question: http://stackoverflow.com/q/25918356
tags question: http://stackoverflow.com/q/25964782
tag name: random
tags question: http://stackoverflow.com/q/25954149
type: Tag
tags question: http://stackoverflow.com/q/26033962
tags question: http://stackoverflow.com/q/26005013

http://stackoverflow.com/comment/40766580
score: 3
comment on: http://stackoverflow.com/q/26026561
type: Comment
has text: map the vulgar versions to their realworld values, probably.
type: QuestionComment

http://stackoverflow.com/a/25900775
type: Answer
has body: 1. add field Calendar to your dog class to replace the month,day,year field 2. use Calendar.setTime(Date )to initiate 3. use Calendar.after or Calendar.before to compare
score: 0
has comment: http://stackoverflow.com/comment/139907530
answers question: http://stackoverflow.com/q/25900542

http://stackoverflow.com/q/25896073
type: AnsweredQuestion
tagged with: ddl
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/25896745
type: Question
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25896745
favorite count: 0
tagged with: postgresql
has title: Can not execute a DDL with Statement DB(postgres) - Java
score: -1
has body: I need to make a DDL Statement by updating the database (new tables, fields and keys). But only when I try to add tables with foreign keys and modify tables by adding foreign keys does not work, get error, but the application is paused indefinitely. For example: instanceStatement.execute ("ALTER TABLE pay ADD CONSTRAINT foranea_pay_customer FOREIGN KEY (customerid) REFERENCES customer (customerid) ON UPDATE CASCADE ON DELETE SET NULL;"); Help please.

http://stackoverflow.com/comment/40721472
has text: @TedHopp No, they get created or they do not get created. It's enough if there is any existing.
score: 0
comment on: http://stackoverflow.com/q/26001903
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25927113
type: Answer
has body: For any of those wondering here is my solution to this problem given the ridiculous constraints. public class Assignment3 { public static void main(String[] args) { //read names and return error if the name starts with a non-alphabetic character Scanner scan = new Scanner(System.in); System.out.print("Please input the first name: "); String name1 = scan.nextLine(); name1 = name1.substring(0, 1).toUpperCase() + name1.substring(1,name1.length()).toLowerCase(); if (Character.isLetter(name1.charAt(0))){ System.out.println("The first name is: " + name1); }else{ System.out.println("Error: The name was not accepted"); name1 = ""; } System.out.print("Please input the second name: "); String name2 = scan.nextLine(); name2 = name2.substring(0, 1).toUpperCase() + name2.substring(1,name2.length()).toLowerCase(); if (Character.isLetter(name2.charAt(0))){ System.out.println("The second name is: " + name2); }else{ System.out.println("Error: The name was not accepted"); name2 = ""; } System.out.print("Please input the third name: "); String name3 = scan.nextLine(); name3 = name3.substring(0, 1).toUpperCase() + name3.substring(1,name3.length()).toLowerCase(); if (Character.isLetter(name3.charAt(0))){ System.out.println("The third name is: " + name3); }else{ System.out.println("Error: The name was not accepted"); name3 = ""; } //Sort the names alphabetically String first = ""; if(name1.compareTo(name2) &lt;= 0 &amp;&amp; name1.compareTo(name3) &lt;= 0){ first = name1; }else if (name2.compareTo(name3) &lt;= 0 &amp;&amp; name2.compareTo(name1) &lt;= 0){ first = name2; }else if (name3.compareTo(name1) &lt;= 0 &amp;&amp; name3.compareTo(name2) &lt;=0){ first = name3; } String middle = ""; if (name1.compareTo(name2)*name1.compareTo(name3) &lt;= 0){ middle = name1; }else if (name2.compareTo(name1)*name2.compareTo(name3) &lt;= 0){ middle = name2; }else if (name3.compareTo(name2)*name3.compareTo(name1) &lt;= 0){ middle = name3; } String last = ""; if(name1.compareTo(name2) &gt;= 0 &amp;&amp;…
answers question: http://stackoverflow.com/q/25924445
score: 0

http://stackoverflow.com/q/25927920
answer count: 1
has comment: http://stackoverflow.com/comment/40588418
upvote count: 0
has comment: http://stackoverflow.com/comment/40588465
downvote count: 5
has answer: http://stackoverflow.com/a/25928124
accepted answer: http://stackoverflow.com/a/25928124
type: AnsweredQuestion
score: -5
has comment: http://stackoverflow.com/comment/40588739
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40588585
has title: Search a object without iterating a collection in java
has comment: http://stackoverflow.com/comment/40588493
tagged with: java
has body: How to look for a particular object in a large list(java collection) without iterating it. Assume we have a large collection and just need to check whether a object exists or not without iterating.

http://stackoverflow.com/a/25966074
type: Answer
answers question: http://stackoverflow.com/q/25966027
has body: It seems there is duplication of same view.It should be ok if you remove the tag with attribute name =center and keep the tag with attribute name=body. However its up to you to keep both if you have requirements like that. Yes its possible to give arbitrary names but it makes sense if you give the names like header,footer,body,left,right.
score: 0

http://stackoverflow.com/q/25918994
type: AnsweredQuestion
tagged with: java
tagged with: switch-statement
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25919020
tagged with: custom-keyboard
tagged with: android-softkeyboard
has title: Understanding Switch statement with "&" sign
tagged with: android
has body: I'm designing a custom keyboard for Android. I used a sample SoftKeyboard project. In LatinKeyboard.java class there is a switch statement like bellow: switch (options &amp; (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { //Cases } I'm trying to understand this switch statement. I searched switch statement documentation but I couldn't find "&amp;" sign in switch. I also searched on other places for solution but no solution so far.
possible better answer: http://stackoverflow.com/a/25919016
accepted answer: http://stackoverflow.com/a/25919020
has answer: http://stackoverflow.com/a/25919016

http://stackoverflow.com/comment/56225192
type: AnswerComment
score: 8
has text: @MiguelLavigne Just FYI, OkHttp changed in 2.5.0 to have a default timeout of 10 sec.
type: Comment
comment on: http://stackoverflow.com/a/25973778

http://stackoverflow.com/comment/40576957
comment on: http://stackoverflow.com/a/25920978
has text: I missed one important point: you cannot call fmt:formatDate on any other object but on java.util.Date, so you have to use c:set to increase date.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42129119
score: 0
comment on: http://stackoverflow.com/a/26030664
type: Comment
has text: You know there is a test application that I was asked to develop, in requirements it was mentioned to use netty and there a statement: "correctly handle saturated outbound situation". That is all, that is why I looking for answer how to handle this situation.
type: AnswerComment

http://stackoverflow.com/comment/102927668
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25963720
has text: @user1445967 Agreed. I re-opened the Question. And provided [an Answer](https://stackoverflow.com/a/58281016/642706) using *java.time*. Thanks.

http://stackoverflow.com/comment/40540935
comment on: http://stackoverflow.com/q/25901714
score: 0
type: Comment
type: QuestionComment
has text: @JimmyT. - Yup! - Lazy instantiation and thread safe.

http://stackoverflow.com/a/25892309
upvote count: 1
has comment: http://stackoverflow.com/comment/40534516
has body: Please take a look at this example using an ExecutorService and Callable tasks organized according to your given tree structure. It's ready to run, so you can test it and experiment with it: public class Test { public static void main(String[] args) throws Exception { // Declare a new ExecutorService with a maximum of 2 threads. ExecutorService service = Executors.newFixedThreadPool(2); // Declare the tasks. StringTask t1 = new StringTask("First task!"); StringTask t2 = new StringTask("Second task!"); StringTask t3 = new StringTask("Third task!"); StringTask t4 = new StringTask("Fourth task!"); StringTask t5 = new StringTask("Fifth task!"); // Submit the first task. String result1 = service.submit(t1).get(); // Using the .get() directly blocks the waiting for completion of the task. System.out.println("T1 result: " + result1); // Submit the second task. String result2 = service.submit(t2).get(); System.out.println("T2 result: " + result2); // Prepare the list of parallel tasks and invoke them. List&lt;StringTask&gt; parallelTasks = new ArrayList&lt;&gt;(2); parallelTasks.add(t3); parallelTasks.add(t4); List&lt;Future&lt;String&gt;&gt; results = service.invokeAll(parallelTasks); // Note that using .invokeAll() will block the // execution until all tasks are completed. for (Future&lt;String&gt; result : results) { System.out.println("Parallel task result: " + result.get()); } // Submit the last task. String result5 = service.submit(t5).get(); System.out.println("T5 result: " + result5); } /** * Callable task that reverses a given String. */ private static final class StringTask implements Callable&lt;String&gt; { private String input; private StringTask(String input) { super(); if (input == null) { throw new NullPointerException(); } this.input = input; } @Override public String call() throws Exception { StringBuilder builder = new StringBuilder(); for (int i = this.input.length() - 1; i &gt;= 0; i--) { builder.append(this.input.charAt(i)); } return builder.toString()…
type: Answer
has comment: http://stackoverflow.com/comment/40536126
downvote count: 0
answers question: http://stackoverflow.com/q/25876679
score: 1

giraph
tags question: http://stackoverflow.com/q/25902761
tag name: giraph
type: Tag

http://stackoverflow.com/comment/40602336
comment on: http://stackoverflow.com/q/25935749
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [Using Regular Expressions to Extract a Value in Java](http://stackoverflow.com/questions/237061/using-regular-expressions-to-extract-a-value-in-java)

http://stackoverflow.com/comment/40564682
comment on: http://stackoverflow.com/q/25914819
type: Comment
type: QuestionComment
has text: Do you need 3 forward slashes?
score: 0

http://stackoverflow.com/q/25953201
tagged with: playframework
type: Question
has answer: http://stackoverflow.com/a/25981334
has title: Bootstrapping data Play framework 2.3.3
has body: I have a project in play framework that I would like to have preloaded with some data when the application is first built (after running 'activator run'). From what I understand that used to be achieved by creating a 'initial-data.yml' file in the /conf folder and then having a Bootstrap.java file such as the following: import play.*; import play.jobs.*; import play.test.*; import models.*; @OnApplicationStart public class Bootstrap extends Job { public void doJob() { // Check if the database is empty if(User.count() == 0) { Fixtures.load("initial-data.yml"); } } } However, that no longer works. How do I preload data into my project in play framework 2.3.3?
tagged with: playframework-2.3
score: 0
tagged with: java
answer count: 1
type: UnansweredQuestion
tagged with: akka-persistence

http://stackoverflow.com/comment/89031163
comment on: http://stackoverflow.com/a/32342693
type: Comment
has text: it worked, but I had to import the Json Processing API :\
score: 1
type: AnswerComment

http://stackoverflow.com/comment/40551320
type: Comment
has text: no i don't want to compare, i want to change the values from my java class. @bhavesh
comment on: http://stackoverflow.com/a/25907637
score: 0
type: AnswerComment

http://stackoverflow.com/q/25974351
linked to: http://stackoverflow.com/q/2658922
has answer: http://stackoverflow.com/a/25975386
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has title: Are there any drawbacks of using JSTL tags for escaping XML for XSS prevention
tagged with: servlets
has body: I want to sanitize the text which will be sent to user (browser) by the server using these jsp tags. got idea after reading this post XSS prevention in JSP/Servlet web application &lt;c:out value="${bean.userControlledValue}"&gt; &lt;input name="foo" value="${fn:escapeXml(param.foo)}"&gt; But I have many jsp pages and I want to perform search for tags or &lt;p&gt; and add these escaping tags so, Is it good to do this or is any drawback or precaution we need to care of.
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0

http://stackoverflow.com/q/25911678
has title: How to return a result from an anonymous PL/pgSQL block?
tagged with: postgresql
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/40558601
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40558377
has answer: http://stackoverflow.com/a/25911950
has answer: http://stackoverflow.com/a/25912674
has body: PostgreSQL version I'm using is 9.3. I've written a code which contains the following chunk: String queryString = "do $$\n" + "&lt;&lt; outerblock &gt;&gt;\n" + "DECLARE\n" + "table_name varchar DEFAULT 'partner.partner_statistic';\n" + "BEGIN\n" + "EXECUTE 'SELECT * FROM ' || table_name;\n" + "END;\n" + "$$ LANGUAGE plpgsql; \n"; Query query = getSession().createSQLQuery(queryString); List l = query.list(); In the debugger, I recieve the message: [org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:78)] : No results were returned by the query. at the line List l = criteria.list(); How can I rewrite the query to return actual result?
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/25912674
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/25911950
upvote count: 5

http://stackoverflow.com/q/25908536
type: Question
tagged with: apache-spark
answer count: 1
downvote count: 0
favorite count: 0
tagged with: machine-learning
upvote count: 1
has title: Twitter sentiment analysis using Naive Bayes in apache spark
has body: I am trying to do a basic twitter sentiment analysis, by using apache spark. The below page explains on Naive Bayes function used at apache spark which would be a candidate for the above problem. http://spark.apache.org/docs/1.0.0/mllib-naive-bayes.html when you check at the java example, the training and test set are given as JavaRDD&lt;LabeledPoint&gt; training = ... // training set JavaRDD&lt;LabeledPoint&gt; test = ... // test set I dont have any clue what datatype they are, but i can understand that they are some non english inputs. I have a list of tweets say. "I love my country." "Great day at office." "Google Chrome sucks!" How do i use the naive bayes function to process the text ? any insights on this would be helpful.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25934061
score: 1
tagged with: java
tagged with: twitter
tagged with: apache-spark-mllib
accepted answer: http://stackoverflow.com/a/25934061

http://stackoverflow.com/q/25952297
answer count: 2
has answer: http://stackoverflow.com/a/25952322
has comment: http://stackoverflow.com/comment/40634956
has body: I want 3 ways of exiting the application Key stroke CTRL-Q Select 'Exit' from menu bar Close 'x' button on JFrame What I've done so far is add the even listeners for the first two, but I cannot figure out how to have the JFrame close 'x' button to do the same thing. For now it just exits the application without prompting a confirmation, because it doesn't know how to get to that. I basically want all the frames to be disposed, after the user has confirmed that they want to exit. This happens in the first two cases, simply because their action listeners call an exit() method that confirms exiting, and then proceeds to dispose of all frames. public class MainWindow extends JFrame { ... this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener(new WindowListener() { @Override public void windowClosing(WindowEvent e) { System.exit(0); } } ... // this is part of the main menu bar (case #2) JMenuItem mntmExit = new JMenuItem("Exit"); mntmExit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MainWindow.this.exit(); } }); // this is case #1 KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() { @Override public boolean dispatchKeyEvent(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_Q &amp;&amp; e.getModifiers() == InputEvent.CTRL_MASK) { MainWindow.this.exit(); } return false; } }); } // the exit method private void exit() { int confirmed = JOptionPane.showConfirmDialog(this, "Are you sure you want to quit?", "Confirm quit", JOptionPane.YES_NO_OPTION); if(confirmed == JOptionPane.YES_OPTION) { Frame[] frames = Frame.getFrames(); for(Frame frame : frames) { frame.dispose(); } } } Is it possible to assign an action listener to the close button? If not, is there another way I should approach this?
tagged with: swing
possible better answer: http://stackoverflow.com/a/25952390
type: AnsweredQuestion
tagged with: exit
tagged with: java
has answer: http://stackoverflow.com/a/25952390
type: Question
linked to: http://stackoverflow.com/q/9554636
has title: How can I override the default listener for a JFrame close ('x') button?
accepted answer: http://stackoverflow.com/a/25952322
tagged with: windowlistener
score: 0

http://stackoverflow.com/comment/40557675
has text: look i have edited your ans :) its working
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25910905

http://stackoverflow.com/comment/40749086
type: Comment
type: QuestionComment
has text: You don't have a breaking condition in your `split` method. The method will call itself until the `next` member of your Node is empty (i.e. `null`). Also, please fix your code format. This is just horrible to look at. ;)
comment on: http://stackoverflow.com/q/26017357
score: 0

http://stackoverflow.com/comment/40771832
type: Comment
type: QuestionComment
has text: I think you're flailing. The data above is mixed binary and ASCII, and unless you know which is which you're sunk. I don't think that the stuff up through byte 0x15 is intended to be character data.
comment on: http://stackoverflow.com/q/26028174
score: 0

http://stackoverflow.com/comment/40518378
type: Comment
has text: And if a grammar is not LL(1) it is also not possible that the grammar is LL(n) for n >= 0? Am I right with that?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25886857

http://stackoverflow.com/comment/41231323
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26038634
has text: Although still unsupported, the author of the library states that it could add complex matrix support sooner than later. Source: http://goo.gl/3uf1RW
type: AnswerComment

http://stackoverflow.com/q/25966946
answer count: 1
has body: I want to have two slider menus in an android project.So i found a tutorial on androidhive.The code is as follows: MainActivity.java package info.androidhive.slidingmenu; import info.androidhive.slidingmenu.adapter.NavDrawerListAdapter; import info.androidhive.slidingmenu.model.NavDrawerItem; import java.util.ArrayList; import android.annotation.SuppressLint; import android.app.Activity; import android.content.res.Configuration; import android.content.res.TypedArray; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; public class MainActivity extends ActionBarActivity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; // nav drawer title private CharSequence mDrawerTitle; // used to store app title private CharSequence mTitle; // slide menu items private String[] navMenuTitles; private TypedArray navMenuIcons; private ArrayList&lt;NavDrawerItem&gt; navDrawerItems; private NavDrawerListAdapter adapter; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle = mDrawerTitle = getTitle(); // load slide menu items navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items); // nav drawer icons from resources navMenuIcons = getResources() .obtainTypedArray(R.array.nav_drawer_icons); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.list_slidermenu); navDrawerItems = new ArrayList&lt;NavDrawerItem&gt;(); // adding nav drawer items to array // Home navDra…
has title: Creating two slider menus in android
score: 0
has comment: http://stackoverflow.com/comment/40657642
tagged with: android
has answer: http://stackoverflow.com/a/25967066
accepted answer: http://stackoverflow.com/a/25967066
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40657662
tagged with: java
type: Question

http://stackoverflow.com/q/25913281
has body: I have a mongo document that I am trying to update before insert in mongodb. I have to put theses 3 keys document._parentId = ObjectId() document.aDictionnary.actionId = Integer document.aDictionnary.bDictionnary.id = Integer I have tried a few combinaison, but can't make it work. Here is my current code myClass.getDocument().append( "$set", new BasicDBObject().append("_parentId", myClass.getDocument.getId() ) ); myClass.getDocument().append( "$set", new BasicDBObject().append("aDictionnary", new BasicDBObject().append("actionId", actionToAttachId ) ) ); if( null == myClass.getSiteId() ) { myClass.getDocument().append( "$set", new BasicDBObject().append("aDictionnary", new BasicDBObject().append("bDictionnary", new BasicDBObject().append( "id", actionToAttach.getSiteId() )))); } I don't want to directly update my document in database, reason is I keep all the history so each entry is a new insert. Application doesn't crash, but fail on insert because of a wrong "append" syntax Also I think it's unpleasing to write that kind of code because of the nested basicdbobject.append syntax, is there another way to do so ? Here is the stack trace 163530 [http-8080-8] ERROR com.myapp.persistance.mystuff.MyClassMongo - java.lang.IllegalArgumentException: fields stored in the db can't start with '$' (Bad Key: '$set')
has answer: http://stackoverflow.com/a/26119206
has comment: http://stackoverflow.com/comment/40561712
score: 0
has comment: http://stackoverflow.com/comment/40564641
answer count: 2
has comment: http://stackoverflow.com/comment/40562332
tagged with: mongodb-java
has comment: http://stackoverflow.com/comment/40567081
has comment: http://stackoverflow.com/comment/40563753
has comment: http://stackoverflow.com/comment/40562001
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40563160
has comment: http://stackoverflow.com/comment/40563466
tagged with: nosql
has comment: http://stackoverflow.com/comment/40562934
tagged with: java
has comment: http://stackoverflow.com/comment/40569071
has comment: http://stackoverflow.com/comment/40562504
has comment: http://stackoverflow.com/comment/40564074
has comment: http://stackoverflow.com/comment/40563272
has comment: http://stackoverflow.com/comment/40563444
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/25913469
has title: How to set value in nested BasicDBObject with Java MongoDB driver

http://stackoverflow.com/a/59168633
answers question: http://stackoverflow.com/q/25954186
score: 0
has body: The above answer (about using the correct file name) is correct, however, as a clarification, make sure that you actually use the proper file path. The file path suggested above, i.e. src/package/ will not work in all circumstances. While this will be obvious to some, for those of you who need clarification, keep reading. For example (and I use NetBeans), if you have already moved the file into NetBeans, and the file is already in the folder you want it to be in, then right click on the folder itself, and click 'properties'. Then expand the 'file path' section by clicking on the three dots next to the hidden file path. You will see the actual file path in its entirety. For example, if the entire file path is: C:\Users..\NetBeansProjects\IceCream\src\icecream\icecream.dat Then, in the java code file itself, you can write: TextIo.readfile("src/icecream/icecream.dat"); In other words, make sure you include the words 'src' but also everything that follows the src as well. If it's in the same folder as the rest of the files, you won't need anything prior to the 'src'.
type: Answer

http://stackoverflow.com/comment/40547557
type: AnswerComment
score: 0
type: Comment
has text: You just need to keep track of the set of values you've processed so far - see edited answer
comment on: http://stackoverflow.com/a/25905492

http://stackoverflow.com/q/25966089
score: 0
has comment: http://stackoverflow.com/comment/40657731
answer count: 1
has comment: http://stackoverflow.com/comment/40657469
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40657632
has comment: http://stackoverflow.com/comment/40657676
tagged with: maven
has answer: http://stackoverflow.com/a/25966708
has title: add maven dependency with target java build of 1.6 or multiple
has comment: http://stackoverflow.com/comment/40657698
has comment: http://stackoverflow.com/comment/40658080
tagged with: java
has comment: http://stackoverflow.com/comment/40657830
has comment: http://stackoverflow.com/comment/40657471
type: Question
has body: I just want to state this as simple as possible, I am using RestExpress in my application now, but I am having a big problem with running this into my server. The problem is that my server runs on OPenJDK 6, but the class build of maven-dependency of RestExpress is 1.7. Is it possible to build the source files as java1.6 or is it possible to have 1.6 and 1.7 build same time? UPDATE: Im still new to maven dependency build. Im so frustrated right now. its been 3 days JRE not compatible with project .class file compatibility: 1.7 this is my pressing issue when running the code using 1.6 my pom.xml org.apache.maven.plugins maven-compiler-plugin 3.0 1.6 1.6 UTF-8 seems like i cant post an image , i need to get at least 10 rep, uploading fail. After setting up compiler and run it as java 1.6 java.lang.UnsupportedClassVersionError: org/restexpress/serialization/SerializationProvider : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Exception in thread "main" thanks
has comment: http://stackoverflow.com/comment/40657621

http://stackoverflow.com/q/25979016
accepted answer: http://stackoverflow.com/a/25979327
type: Question
has title: Print a UTC time in my local timezone
has comment: http://stackoverflow.com/comment/40679722
answer count: 1
has body: I have a timestamp coming from an API in this format: yyyy-MM-dd'T'HH:mm:ss.SSSSSS I want to format it for the user in their own timezone (on android). This is what I'm doing: String timestampFromApi = "..."; DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH); Date date = df1.parse(timestampFromApi); DateFormat df2 = new SimpleDateFormat(); Log.v(TAG, "In your timezone: " + df2.format(date)); But this prints the time in UTC. For example, if the timestamp happened at 4pm UTC time, and I am in PDT, the result is that it still prints "4pm". I checked the timezone being used: df2.getTimeZone() and it does print out PDT for my device. What have I done wrong here? Thanks
score: 0
has comment: http://stackoverflow.com/comment/40680796
tagged with: android
linked to: http://stackoverflow.com/q/2201925
favorite count: 0
linked to: http://stackoverflow.com/q/2597083
has comment: http://stackoverflow.com/comment/40680004
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25979327

http://stackoverflow.com/comment/40575162
type: AnswerComment
comment on: http://stackoverflow.com/a/25892747
score: 0
type: Comment
has text: yeah, there is max daily budget, that must be it.

http://stackoverflow.com/a/26009876
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26009674
upvote count: 1
has body: registered the Click event handler with Rating object. public final &lt;T extends Event&gt; void addEventHandler(EventType&lt;T&gt; eventType, EventHandler&lt;? super T&gt; eventHandler) write one event handler that will call when you click on rating control. and then change the value in event handler.

http://stackoverflow.com/comment/40589705
type: QuestionComment
comment on: http://stackoverflow.com/q/25928579
score: 4
has text: this is not how JTable should work. Do you have any more code you can show? This behaviour is wrong.
type: Comment

http://stackoverflow.com/comment/40519403
comment on: http://stackoverflow.com/a/25890405
has text: @WampieDriessen stop nit-picking. An OP should be able to follow from this sort of ***example***.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/26030062
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/26030183
has title: About Java framework on Node Map
has body: I am looking for a framework in collection like List, Set, Map which can create a data model like the pic show. And providing searching algorithm like search distance from one to another. Count the number of node... etc. I search on google like "Java Node Map Library" or "Node Graph framework" and I cant find any result. Is there any suggest. Thank you very mush.
answer count: 2
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26030183
possible better answer: http://stackoverflow.com/a/26030346
score: -3
has answer: http://stackoverflow.com/a/26030346
type: AnsweredQuestion
tagged with: datamodel
tagged with: java
downvote count: 3

http://stackoverflow.com/a/26016077
has comment: http://stackoverflow.com/comment/40746792
answers question: http://stackoverflow.com/q/26015827
has comment: http://stackoverflow.com/comment/40746667
has body: Your input is wrong. if 1 goto A prints If and Goto detected as it has an if and a goto. It doesn't print the colon part, as there is no colon. Next your input is A:, it has no if and no goto, so it never passes the first if and will never reach the inner if. If you enter if 1 goto A: then it will print both outputs. So either change your input or change your logic. If you want to check for the colon independently, then you have to change the code like this: public turing() { String[] input = inputArea.getText().split("\n"); for(int i=0;i&lt;input.length;i++){ if(input[i].startsWith("if") &amp;&amp; (input[i].contains("goto"))){ System.out.print("If and Goto detected"); } if(input[i].contains(":")){ System.out.print("There's a Colon"); } } }
score: 0
type: Answer

http://stackoverflow.com/q/25886545
has answer: http://stackoverflow.com/a/25886603
accepted answer: http://stackoverflow.com/a/25886603
tagged with: java
has answer: http://stackoverflow.com/a/25887829
has answer: http://stackoverflow.com/a/25887076
answer count: 3
downvote count: 0
linked to: http://stackoverflow.com/q/6115896
favorite count: 0
tagged with: exception
has body: This is something that's been bugging me for a while with regards to Program Flow. I wanted to know if it's possible to catch an error from a Method in order to stop it from executing the Method that would normally follow it like the example bellow that I can't get to work. public class MyClass { public static void main(String[] args) { // this method catches an exception and stops running method01(); // this method will continue anyway which I don't want method02(); }; }; I would normally have a static int variable that will initialize as 0 when the program is run and then if a method ever catches an exception it will increment that int and each method will only run if the int is 0. This works but I was just wondering if I could replace the int shindig with exception handling.
possible better answer: http://stackoverflow.com/a/25887076
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/729379
score: 1
has title: Catching an Exception from a called Method
upvote count: 1
tagged with: methods
type: Question

http://stackoverflow.com/comment/40502690
has text: Sorry, I thought I was going to be able to extrapolate this case to the actual problem in the project I'm working on, but I can't. I just updated the question. Thanks for your help.
comment on: http://stackoverflow.com/a/25880079
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40528815
type: Comment
comment on: http://stackoverflow.com/q/25894909
has text: No they are of different lengths with the result being a much longer string.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40598455
score: 0
type: Comment
type: QuestionComment
has text: Do you want to use HTTP protocol (what you are describing) or FTP protocol (different protocol and different port) as said in the title ?
comment on: http://stackoverflow.com/q/25931940

http://stackoverflow.com/comment/40747680
has text: thank you! regarding "manual configuration" I mean editing standalone.xml despite using wildfly web console. For file store I'm able to use web console but for jdbc store I have error as I described in my post. Moreover, adding jdbc-store in the standalone.xml is not reflected in the web console. However I will try again with file store because i think it works fine (the reported bug is relative to version 5.2.6.Final)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26014465

http://stackoverflow.com/comment/40764204
comment on: http://stackoverflow.com/q/26025188
has text: **Off-topic:** the "stack-snippet" is for runnable code in a browser. The code blocks ({}) or ctrl+k should be used for posting code. [See the meta post here](http://meta.stackoverflow.com/questions/269753/feedback-requested-runnable-code-snippets-in-questions-and-answers)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25932610
tagged with: jdbi
tagged with: mysql
type: Question
score: 5
tagged with: database
answer count: 3
has title: Are JDBI batch operation atomic?
has answer: http://stackoverflow.com/a/37967359
favorite count: 0
upvote count: 5
possible better answer: http://stackoverflow.com/a/37967359
has answer: http://stackoverflow.com/a/38225474
has answer: http://stackoverflow.com/a/27136413
accepted answer: http://stackoverflow.com/a/27136413
type: AnsweredQuestion
has body: Are JDBI batch operations (inserts or updates) atomic? Or do I need to wrap them in a transaction block?
downvote count: 0
tagged with: java

http://stackoverflow.com/q/25876962
has comment: http://stackoverflow.com/comment/40496337
tagged with: http://stackoverflow.com/tag/c
has title: Can a function end its caller's function?
has comment: http://stackoverflow.com/comment/40495868
tagged with: scope
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40496147
has comment: http://stackoverflow.com/comment/40495834
has comment: http://stackoverflow.com/comment/40496035
has comment: http://stackoverflow.com/comment/40495906
has comment: http://stackoverflow.com/comment/40495878
has comment: http://stackoverflow.com/comment/40496662
has answer: http://stackoverflow.com/a/25877176
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40496002
has comment: http://stackoverflow.com/comment/40495981
has answer: http://stackoverflow.com/a/25878145
has body: Let's say we have the following two methods: public static void repeat(){ while (1){ otherFunc(); } } public static void otherFunc(){ if (something){ //Here } } Is there a way for, in the place of //Here, to cause a break or return in the repeat function? Initially, I thought definitely not, because of the issue of scope. Also, if it was intended to be used like that, otherFunc could return a boolean and be placed in an if-statement to end the while-loop or the method. However, I could not find anything to prove that it cannot have that behavior. Is this possible? Although I wrote this in Java, it would also be helpful to know if this stays true in C-languages also.
has comment: http://stackoverflow.com/comment/40495999
tagged with: java
has comment: http://stackoverflow.com/comment/40496075
type: Question
has comment: http://stackoverflow.com/comment/40497204

http://stackoverflow.com/q/26000543
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26002401
upvote count: 2
tagged with: windows-services
downvote count: 1
type: Question
has title: make an interactive windows service
tagged with: java-service-wrapper
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26002401
answer count: 1
has body: I want my Java application to be an interactive windows service (a windows service that has GUI when the user is logged in). I searched for this and I see that the way to do it is to have 2 programs, 1st is a service, 2nd is a GUI program and make them communicate - the service will get commands from the GUI program. Just before I started to split my program, I noticed that in "Java Service Wrapper" there is a flag: wrapper.ntservice.interactive=TRUE Is this flag an automatic way to do the same as the following manual config? administrative tools -> services -> right click -> properties -> under Log On tab check allow to interact with desktop Is this way problematic? Should I go for the long way and split my program into two programs (GUI and service)? thanks
favorite count: 0

http://stackoverflow.com/q/25886663
has comment: http://stackoverflow.com/comment/40513895
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40514109
favorite count: 0
tagged with: android-volley
type: Question
has body: I am using Google Volley structure. I want to add a JsonObjectRequest. Here is my code: mQueue.add(new JsonObjectRequest(Request.Method.POST, url, jsonRequest, responseListener, errorListener)); Then I got the error: Value è¯·å¿éæ³è®¿é®ï¼ of type java.lang.String cannot be converted to JSONObject. I think it may be the UTF-8 BOM problem. But I don't know how to solve it. Anyone can help me? Thanks a lot.
tagged with: android
has title: Google Volley Structure - encoding issue in JSONObject
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has comment: http://stackoverflow.com/comment/40544678
type: UnansweredQuestion

http://stackoverflow.com/q/25975860
tagged with: jstl
has body: I want to show the timezone offset using the jstl. using the z in the format i m getting GMT or GST but i want to append the datetime with the offset (+0100) or (+0530). Sample code - &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; &lt;%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %&gt; &lt;fmt:formatDate value="${row.time}" pattern="yyyy-MM-dd HH:mm:ss z"/&gt; Regards
has answer: http://stackoverflow.com/a/25976044
has title: format datetime to show timezone offset using jstl
score: 0
tagged with: datetime
answer count: 1
accepted answer: http://stackoverflow.com/a/25976044
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/40688633
has text: You only ever store one item in a `List`. Each time through your loop you throw away the old `List` and add a new one to the map with one city in it. Also, when city is not null, you don't add *anything* to your map.
score: 1
comment on: http://stackoverflow.com/q/25983775
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25953864
tagged with: exception
type: UnansweredQuestion
has title: How to specify exception types using reflection?
tagged with: reflection
tagged with: java
has body: I am using reflection in my code, to give the user opportunity to call directly the methods, without writing tones of if...else statements or switches, but I have a problem. I have a method called Exit(), which i want to throw my custom exception, but when i add a catch statement for the method.invoke() line, the compiler tells me that that kind of exception is never thrown in that statement, but it's absolutely possible that the user will call that method, how can i find a solution for this problem? here is my reflection code try { methodName = input.nextLine(); Class&lt;?&gt; facade = StoreFacade.getInstance().getClass(); Method method = facade.getDeclaredMethod(methodName); method.setAccessible(true); method.invoke(StoreFacade.getInstance()); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); }catch (Exceptions.EndOfSessionException e){ System.out.println(e.getMessage()); }
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/25953900

file
type: Tag
tags question: http://stackoverflow.com/q/25946168
tags question: http://stackoverflow.com/q/25886358
tags question: http://stackoverflow.com/q/25878300
tags question: http://stackoverflow.com/q/25964515
tags question: http://stackoverflow.com/q/25917116
tags question: http://stackoverflow.com/q/25924656
tags question: http://stackoverflow.com/q/26009277
tags question: http://stackoverflow.com/q/26030579
tags question: http://stackoverflow.com/q/25999255
tags question: http://stackoverflow.com/q/25902487
tag name: file
tags question: http://stackoverflow.com/q/26027313
tags question: http://stackoverflow.com/q/25994505
tags question: http://stackoverflow.com/q/25947626
tags question: http://stackoverflow.com/q/25879807
tags question: http://stackoverflow.com/q/25973700
tags question: http://stackoverflow.com/q/25980237
tags question: http://stackoverflow.com/q/25875689
tags question: http://stackoverflow.com/q/26003705
tags question: http://stackoverflow.com/q/25988503
tags question: http://stackoverflow.com/q/25939030
tags question: http://stackoverflow.com/q/26001398
tags question: http://stackoverflow.com/q/25928389
tags question: http://stackoverflow.com/q/25960031
tags question: http://stackoverflow.com/q/25979883
tags question: http://stackoverflow.com/q/26007274
tags question: http://stackoverflow.com/q/25991705
tags question: http://stackoverflow.com/q/26017545
tags question: http://stackoverflow.com/q/26030788
tags question: http://stackoverflow.com/q/25889538
tags question: http://stackoverflow.com/q/25907380
tags question: http://stackoverflow.com/q/25890677
tags question: http://stackoverflow.com/q/25995969
tags question: http://stackoverflow.com/q/26026631
tags question: http://stackoverflow.com/q/25975426

http://stackoverflow.com/a/26027723
upvote count: 2
has comment: http://stackoverflow.com/comment/40768713
answers question: http://stackoverflow.com/q/26027666
has body: I think you need for(int j = 0; j &lt; centroids[maxInstance].length; j++){ } on your second for loop.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/40498489
type: Comment
type: QuestionComment
has text: Are you on Windows? Make sure your character is not `\r`. Text files on Windows have both `\r` and `\n` between each line, and if you are using a class meant for binary files, you have to worry about both.
comment on: http://stackoverflow.com/q/25878217
score: 0

http://stackoverflow.com/a/25971085
type: Answer
has comment: http://stackoverflow.com/comment/40665683
answers question: http://stackoverflow.com/q/25970943
has body: from onLocationChanged call a method to which you will pass current location in that method itself get All Location with which you want to compare.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25970943

http://stackoverflow.com/comment/40711446
has text: Should be. Why do you have MIDlet-Data-Size: 0 ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25996017

http://stackoverflow.com/q/25934188
has body: I have done something like this in my project. I rollback transaction manually, for that i have inserted try-catch block and manually rolled back transaction in catch block. Now i am calling method2 from method1 and i am saving object to database in method2() but it does not save object to the database. @Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor=Throwable.class) @Scheduled(cron = "0 5 16 * * ?") public void method1() { try{ ---try block--- } catch(Throwable t){ TransactionAspectSupport.currentTransactionStatus() .setRollbackOnly(); method2(); } } @Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) public void method2() { ---saving object to database---- someService.update(object); } I just want to know what could be the possible solution for saving object in method2() on method1()'s faliure. Thanx in advance.
has comment: http://stackoverflow.com/comment/40599545
answer count: 1
has comment: http://stackoverflow.com/comment/40599624
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40599510
tagged with: spring
has comment: http://stackoverflow.com/comment/40656347
has comment: http://stackoverflow.com/comment/40599411
score: 0
tagged with: java
has title: Spring Not commiting transaction
has comment: http://stackoverflow.com/comment/40599517
type: Question
has answer: http://stackoverflow.com/a/25934362
has comment: http://stackoverflow.com/comment/40599382
tagged with: spring-transactions

http://stackoverflow.com/q/26016372
answer count: 2
has comment: http://stackoverflow.com/comment/40797976
downvote count: 0
has comment: http://stackoverflow.com/comment/40818358
favorite count: 0
tagged with: mongodb-query
has answer: http://stackoverflow.com/a/26017909
upvote count: 1
has body: I just want to be shure when inputting new DBObject to DB that it is really unique and Collection doesn't contain key field duplicates . Here is how it looks now: public abstract class AbstractMongoDAO&lt;ID, MODEL&gt; implements GenericDAO&lt;ID, MODEL&gt; { protected Mongo client; protected Class&lt;MODEL&gt; model; protected DBCollection dbCollection; /** * Contains model data : unique key name and name of get method */ protected KeyField keyField; @SuppressWarnings("unchecked") protected AbstractMongoDAO() { ParameterizedType genericSuperclass = (ParameterizedType) this.getClass().getGenericSuperclass(); model = (Class&lt;MODEL&gt;) genericSuperclass.getActualTypeArguments()[1]; getKeyField(); } public void connect() throws UnknownHostException { client = new MongoClient(Config.getMongoHost(), Integer.parseInt(Config.getMongoPort())); DB clientDB = client.getDB(Config.getMongoDb()); clientDB.authenticate(Config.getMongoDbUser(), Config.getMongoDbPass().toCharArray()); dbCollection = clientDB.getCollection(getCollectionName(model)); } public void disconnect() { if (client != null) { client.close(); } } @Override public void create(MODEL model) { Object keyValue = get(model); try { ObjectMapper mapper = new ObjectMapper(); String requestAsString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model); // check if not presented BasicDBObject dbObject = new BasicDBObject((String) keyValue, requestAsString); dbCollection.ensureIndex(dbObject, new BasicDBObject("unique", true)); dbCollection.insert(new BasicDBObject((String) keyValue, requestAsString)); } catch (Throwable e) { throw new RuntimeException(String.format("Duplicate parameters '%s' : '%s'", keyField.id(), keyValue)); } } private Object get(MODEL model) { Object result = null; try { Method m = this.model.getMethod(this.keyField.get()); result = m.invoke(model); } catch (Exception e) { throw new RuntimeException(String.format("Couldn't find method by name '%s' at class '%s'", this.keyField.get(),…
has title: How to be avoid duplicates entries at insert to MongoDB
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26017909
possible better answer: http://stackoverflow.com/a/26044116
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/26044116

http://stackoverflow.com/q/26013412
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40742493
tagged with: java
type: Question
tagged with: performance
tagged with: javascript
has comment: http://stackoverflow.com/comment/40743653
has body: Here is the scenario: I have 4 drop downs in a JSP page in my Spring MVC application. The dropdowns (Countries, States, divisions and villages) are related to each other as on selection of a particular country loads the state dropdown with state values and selection of a particular state loads the values in divisions dropdown and so on. The maximum number of records in my application are: Countries: 75 States: 1,000 Divisions: 3,000 Villages: 30,000 Data is present in 4 hashmaps like: - Map of String CountryId key with String Name as value - Map of String CountryId key with (Map of String StateId key with String StateName) as value - Map of String StateId key with (Map of String DivisionID key with String DivisionName) as value - Map of String DivisionId key with (Map of String VillageId key with String VillageName) as value Question: Currently I am loading all 4 hashmaps on JSP page and am displaying the values in dropdown based on the selection of previous dropdown:` $("#country").on("change", function(e) { var stateMap = '${stateList}'; var jsondata = $.parseJSON(stateMap ); $.each(jsondata[$(this).val()], function (key, value) { $('#state').append($('&lt;option&gt;&lt;/option&gt;').val(key).html(value)).prop('disabled',false); }); }); Here, populating values in dropdown is handled in the javascript itself. I did this to reduce the number of hits on server. But given the large number of records in the hashmaps, is it the correct way to populate data in the dropdowns? OR Should I do an AJAX call each time a value is selected in a dropdown to populate the values in subsequent dropdown. Which one of these two approaches is more appropriate from the performance perspective.
has comment: http://stackoverflow.com/comment/40742627
score: 0
answer count: 1
tagged with: jsp
tagged with: drop-down-menu
has answer: http://stackoverflow.com/a/26017012
accepted answer: http://stackoverflow.com/a/26017012
has title: Performance impact on loading interrelated dropdowns with max of arounf 30,000 records

http://stackoverflow.com/comment/40507243
type: QuestionComment
comment on: http://stackoverflow.com/q/25883296
has text: your class is lacking a method that executes this code. You can declare and even assign the fields inside the class, but if you want to execute code, you'll either have to do it within a constructor or (preferably) inside a method / getter / setter
type: Comment
score: 1

http://stackoverflow.com/a/33550328
accepted answer of: http://stackoverflow.com/q/25938560
answers question: http://stackoverflow.com/q/25938560
type: Answer
score: 34
downvote count: 0
has body: If you are using Java 7 or earlier you can refer to this post. If you are using Java 8 you could do: DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_DATE_TIME; TemporalAccessor accessor = timeFormatter.parse("2015-10-27T16:22:27.605-07:00"); Date date = Date.from(Instant.from(accessor)); System.out.println(date); Update As pointed out by @BasilBourque in the comment, TemporalAccessor is java framework level interface, and is not advisable to use in the application code and it is advisable to use concrete classes rather than the interfaces. This interface is a framework-level interface that should not be widely used in application code. Instead, applications should create and pass around instances of concrete types, such as LocalDate. There are many reasons for this, part of which is that implementations of this interface may be in calendar systems other than ISO. See ChronoLocalDate for a fuller discussion of the issues. There a few concrete classes available to use, like LocalDate, LocalDateTime, OffsetDateTime, ZonedDateTime and etc.. DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_DATE_TIME; OffsetDateTime offsetDateTime = OffsetDateTime.parse("2015-10-27T16:22:27.605-07:00", timeFormatter); Date date = Date.from(Instant.from(offsetDateTime)); System.out.println(date);
upvote count: 34
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/88507772
has comment: http://stackoverflow.com/comment/88540205

http://stackoverflow.com/comment/85718579
comment on: http://stackoverflow.com/a/26157868
score: 1
has text: Facing the similar issue. Did you got any working solution?
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25968592
has answer: http://stackoverflow.com/a/75926398
answer count: 5
has body: What is the difference between createIndex() and ensureIndex() in Java using MongoDB? I googled this but didn't get a satisfactory answer.
upvote count: 52
has comment: http://stackoverflow.com/comment/40661223
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25968802
has answer: http://stackoverflow.com/a/33264415
type: Question
tagged with: mongodb
has title: Difference between createIndex() and ensureIndex() in java using mongodb
has answer: http://stackoverflow.com/a/51341725
accepted answer: http://stackoverflow.com/a/25968802
tagged with: mongodb-java
possible better answer: http://stackoverflow.com/a/26403150
downvote count: 0
has answer: http://stackoverflow.com/a/26403150
favorite count: 0
score: 52

http://stackoverflow.com/a/25909205
score: 0
type: Answer
has body: In case of synchronized block say First thread enters first synchronized (SyncBlock.class) {--&gt; // here First thread takes the lock now no other thread can enter Now when First thread reaches here System.out.println(getName() + " is done."); } ---&gt; here First thread releases the lock . So this gives chance to other thread which are waiting for this lock . so in ur case Second thread takes it and then executes it and when it reaches here it will release and then again other thread can take over. Note : This behavior is not definite Threads can execute in any manner Depends upon CPU scheduling policy And what happens in synchronized method is as soon as one thread enters this method it will complete its task and then release the lock .After this other thread gets the chance to execute . Also note that sleep doesnt release the LOCK . at that stage thread is in wait state
answers question: http://stackoverflow.com/q/25908775
has comment: http://stackoverflow.com/comment/40554594

http://stackoverflow.com/comment/40532527
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25897234
has text: "When making a `new ActionListener`" -- do you perhaps mean `ActionEvent`?

http://stackoverflow.com/a/25907230
has body: I actually edited one of my for loops such that I have to force to store an actual white space character when a non-breaking space is encountered. Thus, when the char array is converted into a string, I can later remove the white space from the string using the text.replace(" ",""); Now, it works as expected. However, in the IDE (Netbeans), "isJavaLetter" is crossed out. I am not sure if it means it is deprecated, but it helped me do what I want. Below is my updated for loop: for (int col = 0; col &lt; 8; col++) { System.out.println(); for (int rows = 0; rows &lt; 6; rows++) { ch = TArray[rows][col]; if(Character.isJavaLetter(ch))// NewTChar[k] = ch; //storing all the columns into a 1d array to obtain a new text (new cipher) else NewTChar[k] =' '; //storing an actual white space character k++; } }
answers question: http://stackoverflow.com/q/25904144
score: 0
type: Answer

http://stackoverflow.com/q/26000195
score: 1
tagged with: java
has body: I'm stuck with a mess of a web application. The previous developer started porting the Spring MVC/Apache Tiles application to Backbone, there wasn't a RESTful API to support the port however and it's stuck in this funky state where JSPs are rendering the HTML and some JS which then loads a Backbone View. About half the API has been ported to REST but the application is still far being a true SPA and even further from being done properly. I've got a strong background in Angular and little with Backbone but next to nothing with Spring &amp; Apache Tiles. The application either needs to go back to server side templating or be rewritten to truly become a SPA with proper organization/testing. If I start (properly) porting to Angular or Backbone, is it possible for the two frameworks to work together (Spring / Angular or Backbone)? I've done a port like this in the past from Django to Angular on Google App Engine and it wasn't too bad but the application has significantly smaller. Has anyone done something similar to this, if so I've been unable to find anything on how to go about doing so or if I should even try.
has comment: http://stackoverflow.com/comment/40718477
type: Question
has title: Spring MVC & Apache Tiles port to AngularJS/Backbone
tagged with: apache-tiles
upvote count: 1
accepted answer: http://stackoverflow.com/a/26009245
answer count: 1
has comment: http://stackoverflow.com/comment/40718495
favorite count: 0
tagged with: backbone.js
has comment: http://stackoverflow.com/comment/40718373
tagged with: angularjs
has answer: http://stackoverflow.com/a/26009245
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/40714501
type: QuestionComment
type: Comment
has text: @ChrisK it looks like this may not be a duplicate.
score: 0
comment on: http://stackoverflow.com/q/25997631

http://stackoverflow.com/q/25876859
answer count: 1
has comment: http://stackoverflow.com/comment/40495748
favorite count: 0
has comment: http://stackoverflow.com/comment/40495674
tagged with: equals
has title: How to extract object from set by part of fields in its class
accepted answer: http://stackoverflow.com/a/25876922
has body: Assume I have some class public class CashCard { private String lastName; private int pinCode; private int balance; public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getPinCode() { return pinCode; } public void setPinCode(int pinCode) { this.pinCode = pinCode; } public int getBalance() { return balance; } public int takeMoney(int money) throws NotEnoughMoneyException { if (money &gt; balance) throw new NotEnoughMoneyException(); balance -= money; return money; } public int putMoney(int money) { balance += money; return money; } public CashCard(String lastName, int pinCode, int balance) { this.lastName = lastName; this.pinCode = pinCode; this.balance = balance; } @Override public boolean equals(Object o) { if (o == null || o.getClass() != this.getClass()) return false; if (o == this) return true; CashCard that = (CashCard) o; return this.lastName.equals(that.lastName) &amp;&amp; this.pinCode == that.pinCode; } @Override public int hashCode() { int result = 17; int prime = 31; result = result * prime + lastName.hashCode(); result = result * prime + pinCode; return result; } } the main point in this class is that it has 3 fields but for 2 objects of this class if they have same(equivalent) two fields they are equal no matter what third field is for each of them Next, for example I have some set of this objects CashCard card1 = new CashCard("Goldman", 1111, 9000); CashCard card2 = new CashCard("Miranda", 1234, 100); CashCard card3 = new CashCard("Grey", 6969, 1000000); Set&lt;CashCard&gt; cashCards = new HashSet&lt;CashCard&gt;(); cashCards.add(card1); cashCards.add(card2); cashCards.add(card3); The last thing - I have last name and pincode String lastName = "Goldman"; int pincode = 1111; I need to figure out if set contains element with such name and pincode AND if it is so, change that element in set in some way.
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: set
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25876922

http://stackoverflow.com/q/25874764
tagged with: java
has answer: http://stackoverflow.com/a/32126150
type: Question
has answer: http://stackoverflow.com/a/25874925
tagged with: enums
possible better answer: http://stackoverflow.com/a/32126150
score: 0
has title: Cannot find source of "class, interface, or enum expected" error
answer count: 2
has body: While trying to build this project, I continue to receive an error class, interface, or enum expected. I have moved things about all over the place, but I can't seem to work out what's wrong. Can somebody help, please? The error as displayed in the console is: ant -f C:\\Users\\x\\Documents\\NetBeansProjects\\DisplayDataUsingJTable -Dnb.internal.action.name=rebuild clean jar init: deps-clean: Updating property file: C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\build\built-clean.properties Deleting directory C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\build clean: init: deps-jar: Created dir: C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\build Updating property file: C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\build\built-jar.properties Created dir: C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\build\classes Created dir: C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\build\empty Created dir: C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\build\generated-sources\ap-source-output Compiling 3 source files to C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\build\classes C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\src\pack1\DisplayPerson.java:245: error: class, interface, or enum expected private void initComponents() { C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\src\pack1\DisplayPerson.java:248: error: class, interface, or enum expected setFocusable(false); C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\src\pack1\DisplayPerson.java:250: error: class, interface, or enum expected javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); C:\Users\Imtiaaz\Documents\NetBeansProjects\DisplayDataUsingJTable\src\pack1\DisplayPerson.java:251: error: class, interface, or enum expected getContentPane().setLayout(layout); C:\Users\x\Documents\NetBeansProjects\DisplayDataUsingJTable\src\pack1\Dis…
accepted answer: http://stackoverflow.com/a/25874925
has comment: http://stackoverflow.com/comment/40491767
type: AnsweredQuestion

http://stackoverflow.com/q/26012735
type: UnansweredQuestion
tagged with: maven
tagged with: playframework-2.0
upvote count: 0
tagged with: java
type: Question
answer count: 2
tagged with: intellij-idea
score: -1
tagged with: typesafe-activator
has answer: http://stackoverflow.com/a/28720770
downvote count: 1
has title: Integrate play framework with maven
favorite count: 0
has body: I trying to integrate play framework (java version) with maven and intellij idea. For that i use play2-maven-plugin (https://code.google.com/p/play2-maven-plugin/); I create pom file, as it described in the manual. Now pom file looks like that: <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 org.sigmaps afrodita 1.0.0-SNAPSHOT play2 Afrodita typesafe Typesafe - releases http://repo.typesafe.com/typesafe/releases/ false <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <play2.version>2.3.3</play2.version> <scala.version>2.10.4</scala.version> <play2.plugin.version>1.0.0-alpha8</play2.plugin.version> <sbt-compiler.plugin.version>1.0.0-beta4</sbt-compiler.plugin.version> org.scala-lang scala-library ${scala.version} com.typesafe.play play_2.10 ${play2.version} com.typesafe.play play-java_2.10 ${play2.version} ${basedir}/app ${basedir}/conf ${basedir} public/** com.google.code.play2-maven-plugin play2-maven-plugin ${play2.plugin.version} true In intellij Idea, on Maven projects tab I click plugins => play2 => paly2:run And then give an error: [INFO] [play2:run {execution: default-cli}] [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] null [INFO] ------------------------------------------------------------------------ [INFO] Trace java.lang.NullPointerException at com.google.code.play2.plugin.AbstractPlay2ServerMojo.getProjectClassPath(AbstractPlay2ServerMojo.java:151) [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Afrodita [INFO] task-segment: [com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-a…
has answer: http://stackoverflow.com/a/26029013

http://stackoverflow.com/comment/40662095
type: Comment
type: QuestionComment
has text: I increase the radius of 200-300 times. And I wrote 20 instead of 180 because Math.sin and cos works with radians, not with degrees. Actually it is PI/2/10*i. PI/2 is a first quarter of circle (from 0 to 90 degrees).
comment on: http://stackoverflow.com/q/25967906
score: 0

http://stackoverflow.com/q/25929633
accepted answer: http://stackoverflow.com/a/25929766
has comment: http://stackoverflow.com/comment/40592887
has comment: http://stackoverflow.com/comment/40591615
tagged with: java
has comment: http://stackoverflow.com/comment/40593331
has title: Is there any method in Java Date-Time API to get collection of all days in a week?
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/38922754
has comment: http://stackoverflow.com/comment/40591571
downvote count: 0
has comment: http://stackoverflow.com/comment/40591706
has answer: http://stackoverflow.com/a/42870756
favorite count: 0
has answer: http://stackoverflow.com/a/25929766
type: Question
tagged with: java-6
has comment: http://stackoverflow.com/comment/40592531
tagged with: datetime
has comment: http://stackoverflow.com/comment/40593065
possible better answer: http://stackoverflow.com/a/25929730
has comment: http://stackoverflow.com/comment/40592074
has comment: http://stackoverflow.com/comment/40593202
has comment: http://stackoverflow.com/comment/40593184
has body: I want names of all days in a week, but i have to create Enum(can be achieved by other ways too). Another way is to get the constant from calendar class and store them manually in Collection. But, Is there any method in Java Date-Time API to get Collection of all Days name in a week or Collection of all months name in year.
has answer: http://stackoverflow.com/a/25929730
has comment: http://stackoverflow.com/comment/40592776
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/40591646

http://stackoverflow.com/comment/40695970
score: 0
type: Comment
type: QuestionComment
has text: @KickButtowski - yup on both counts, but instead of deriding the OP for mixing up his data structures i was trying to take this someplace constructive
comment on: http://stackoverflow.com/q/25987265

http://stackoverflow.com/a/52034772
has body: We got the same problem in a project right after modifying the pom.xml to add some plugins and configurations. Deleting the project folders from maven local repository cache solved it.
score: 3
answers question: http://stackoverflow.com/q/26024582
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/q/25950782
type: Question
has body: I need to design an efficient algorithm for a scheduling problem and I really don't have a clue. There's a machine that produces pills in a certain rate. For example, the machine might be capable to produce 1 pill if it is allowed to continuously work for one day, 4 pills, if it is allowed to work for 3 days, 16 pills if it works for 5 days, and so on. If I stop the machine and take out all the pills then the machine will start from day 1 again. All pills that I took out from the machine must be used on the same day. There is a certain amount of patients come and take pills everyday. The patients must be treated on the same day, untreated patients are ignored. The goal is to decide which days to stop the machine and treat as many patients as possible in n days. Suppose the number of days n = 5, given example input int[] machineRate = {1,2,4,8,16}; int[] patients = {1,2,3,0,2}; In this case, if I stop the machine on day 3, I will have 4 pills. I can treat 3 patients and throw away 1 pill. Then I stop the machine on day 5 again, since it was stopped on day 3, it has been working for 2 days, therefore I have 2 pills to treat 2 patients. In the end 3+2=5, the output = 5 patients. If I stop the machine on day 2, day 3, day 5. Then the output will be (2 pills for 2 patients on day 2) +(1 pill for 3 patients on day 3) +（2 pills for 2 patients on day 5）. That equals to 5 patients as well. The machineRate[] and patients[] vary according to input. What's the algorithm that finds the maximum number of treated patients?
tagged with: scheduling
answer count: 3
has title: Job Scheduling Algorithm in Java
has comment: http://stackoverflow.com/comment/40627909
has answer: http://stackoverflow.com/a/25957936
has answer: http://stackoverflow.com/a/25951555
favorite count: 0
upvote count: 8
tagged with: dynamic-programming
accepted answer: http://stackoverflow.com/a/25951555
downvote count: 1
has comment: http://stackoverflow.com/comment/40627799
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25951814
tagged with: algorithm
has comment: http://stackoverflow.com/comment/40627792
has comment: http://stackoverflow.com/comment/40627800
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/25951814
has comment: http://stackoverflow.com/comment/40627715

adapter
tags question: http://stackoverflow.com/q/25920913
tags question: http://stackoverflow.com/q/25949767
tag name: adapter
tags question: http://stackoverflow.com/q/25966262
type: Tag
tags question: http://stackoverflow.com/q/25933697

http://stackoverflow.com/comment/40775354
has text: what is the problem???
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26031347

http://stackoverflow.com/q/25931549
tagged with: android
has answer: http://stackoverflow.com/a/25931890
type: UnansweredQuestion
tagged with: android-actionbar
tagged with: android-tabs
upvote count: 1
score: 1
tagged with: java
type: Question
downvote count: 0
answer count: 1
has body: I have added Action Tabs and Action Buttons to my Action Bar. Here is what I want to accomplish - But here's what I have - Note the action bar at the bottom. The action buttons which I've added are showing up as overflow even after adding XXX:showAsAction="always" Here is my Activity code - public class MainActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; private String[] tabs = { "Top Rated", "Games", "Movies" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); for (String tab_name : tabs) { actionBar.addTab(actionBar.newTab().setText(tab_name) .setTabListener(this)); } viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); getActionBar().setDisplayShowHomeEnabled(false); getActionBar().setDisplayShowTitleEnabled(false); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.lol, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } Menu file - &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:TOB="http://schemas.android.com/apk/res-auto"&gt; &lt;item android:id="@+id/…
favorite count: 0
has title: Action Buttons showing up as Overflow

http://stackoverflow.com/a/25922782
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25905941
has body: If you use jersey < 2.5 it could be a bug while component package scanning: @see: https://java.net/jira/browse/JERSEY-2175 Otherwise, you properly missed to add the package of your MyExceptionHandler for component scans. The @Provider annotation means, that the implementation "should be discoverable by JAX-RS runtime during a provider scanning phase", but in fact it does'nt did it like we thought. Probably a bug, but i'm not sure. Meaning: Afaig, you have to register package or mapper by yourself - otherwise it will not work for now! Note: I did not tested this with servlet 3.x without Application subclass and basic web.xml @see 4.7.2.3.1. JAX-RS application without an Application subclass link Maybe also interesting: Disable MBW, MBR, ExceptionMapper automatic registration via META-INF/services The jersey-metainf-services (Jersey extension module enabling automatic registration of JAX-RS providers (MBW/MBR/EM) via META-INF/services mechanism) was added @since 2.9.x For the sake of completeness: You can do the registration by using ResourceConfig.packages(String...packages): import org.glassfish.jersey.server.ResourceConfig; public class MyResourceConfig extends ResourceConfig { public MyResourceConfig() { packages(new String[] { "path.to.foo", "path.to.bar" }); } } Alternative in web.xml servlet config ...for packages: jersey.config.server.provider.packages path.to.foo,path.to.bar ...for classes jersey.config.server.provider.classnames path.to.foo.MyExceptionHandler, path.to.bar.FooBar
accepted answer of: http://stackoverflow.com/q/25905941
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/25944506
answers question: http://stackoverflow.com/q/25943977
has body: Seems I just misunderstood the purpose of some methods. Changing revertSelectedItem() to look like this: public void revertSelectedItem() { list.setItemChecked( selected_item, true ); } behaves exactly like I want. It looks like ListView uses the item's "checked" state, rather than the selection, to decide which items are marked. When in choiceMode="singleChoice", calling setItemChecked() also unchecks all other items automatically.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25943977

http://stackoverflow.com/a/26011846
has comment: http://stackoverflow.com/comment/42830098
has comment: http://stackoverflow.com/comment/42823210
accepted answer of: http://stackoverflow.com/q/25996148
upvote count: 2
has body: I'm just elaborating rentires idea. So what you need to do is to divide your Min- and Max-Range by 500 and right in your onRangeSeekBarValuesChanged you multiply it by 500. Code int startValue = 1000; int endValue = 100000; final int factor = 500; RangeSeekBar&lt;Integer&gt; seekBar = new RangeSeekBar&lt;Integer&gt;(startValue/factor, endValue/factor, this); seekBar.setOnRangeSeekBarChangeListener(new RangeSeekBar.OnRangeSeekBarChangeListener&lt;Integer&gt;() { @Override public void onRangeSeekBarValuesChanged(RangeSeekBar&lt;?&gt; bar, Integer minValue, Integer maxValue) { minValue = minValue*factor maxValue *= factor; value.setText(minValue + " : " + maxValue); } }); In order to make it for the user more transparent which range he has selected you should also enable notifyWhileDragging. (This ensures that the onRangeSeekBarValuesChanged method is called all the time while the user is dragging the RangeSeekBar). seekBar.setNotifyWhileDragging(true);
answers question: http://stackoverflow.com/q/25996148
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42825503
has comment: http://stackoverflow.com/comment/42824787
score: 2
downvote count: 0

http://stackoverflow.com/a/30223201
upvote count: 1
answers question: http://stackoverflow.com/q/25949303
score: 1
downvote count: 0
has body: @tony is right, HitBuilders.AppViewBuilder class is deprecated, but there is no need to implement onStart/Stop methods if you don't want to. As stated on GA's V4 tutorial (section 4), you can replace the AppViewBuilder class by HitBuilders.ScreenViewBuilder() and you'll get the desired result in all platforms. See further details on the class reference API here: https://developer.android.com/reference/com/google/android/gms/analytics/HitBuilders.ScreenViewBuilder.html
type: Answer

http://stackoverflow.com/a/79332202
has body: this is php code for bd phone numbers if ( !function_exists( 'getOperator' ) ) { function getOperator( $mobile = '' ) { $prefix = substr( $mobile, 0, 3 ); $operator = ''; // Default value switch ( $prefix ) { case '018': $operator = 'robi'; break; case '017': case '013': $operator = 'gp'; break; case '016': $operator = 'airtel'; break; case '019': case '014': $operator = 'bl'; break; case '015': $operator = 'teletalk'; break; // Add more cases as needed for additional prefixes default: // Handle unknown prefixes if needed break; } return $operator; } }
score: 0
has comment: http://stackoverflow.com/comment/139895754
type: Answer
answers question: http://stackoverflow.com/q/25948781

http://stackoverflow.com/a/26011901
type: Answer
answers question: http://stackoverflow.com/q/26011652
score: 0
has body: int depth = 3; for (int r = depth + 1; r &gt;= 0; r--) { for (int c = 0; c &lt; r; c++) for (int b = 0; b &lt; c; b++) System.out.print("*"); System.out.println(); }

http://stackoverflow.com/comment/40543506
comment on: http://stackoverflow.com/q/25903148
type: Comment
type: QuestionComment
has text: You move the result set pointer to the end on the very first iteration. Is there a reason?
score: 0

http://stackoverflow.com/comment/40526374
has text: Yes, it can give you insight into when some connectivity issue occurs when using the failover uri, but not limited to a broker being down. I've updated the response to reflect this. Why do you want your clients to know this? What are you trying to solve? Logging and/or statistics?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25892955

http://stackoverflow.com/comment/40647638
score: 1
has text: I've written an answer with a summary of ways to avoid operations on arguments of the raw Class type. Most of the time, as @HovercraftFullOfEels already mentioned you don't need to do those because Java provides ways to let the compiler do the checking for you.
type: QuestionComment
comment on: http://stackoverflow.com/q/25961327
type: Comment

http://stackoverflow.com/q/25942455
has title: ehcache Get the running time of timeToIdleSeconds
accepted answer: http://stackoverflow.com/a/25980398
has body: Is there a way to get the current running value of ehcache's timeToIdleSeconds? Let me clarify my question. For example you set the timeToIdleSeconds to 60 seconds. Assuming 40 seconds have passed, is it possible to get the value of the remaining time which is 20 secs? I am trying to use this value in my Java code. Thanks!
tagged with: ehcache
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25980398
answer count: 1
score: 0

http://stackoverflow.com/q/26020812
downvote count: 1
type: Question
score: -1
has answer: http://stackoverflow.com/a/26021871
has answer: http://stackoverflow.com/a/26020984
answer count: 2
upvote count: 0
favorite count: 0
has body: This is a spam bot it writes a string that you input when you press the button, but when I press the run button the JFrame freezes and I can't press it to stop it and it keeps on running. I want to be able to toggle the button while its running, any suggestions? import java.awt.AWTException; import java.awt.FlowLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.JToggleButton; import javax.swing.SwingWorker; import javax.swing.UIManager; public class Main extends JFrame{ private static final long serialVersionUID = 1L; JFrame frame = new JFrame("SPAM BOT"); JTextField txt = new JTextField(20); JToggleButton btn = new JToggleButton("START"); Font font = new Font("Calibri", Font.PLAIN, 20); Font font2 = new Font("Wildcard", Font.BOLD, 20); public Main(){ sendUI(); } public void sendUI(){ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new FlowLayout()); frame.setSize(375, 115); frame.setVisible(true); frame.add(txt); frame.add(btn); txt.setFont(font); btn.setFont(font2); btn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String str = txt.getText().toString(); if(btn.isSelected()){ btn.setText("STOP"); write(true, str); btn.setSelected(false); }else{ btn.setText("START"); write(false, str); } } }); } public void write(boolean typing, final String str){ while(typing==true){ SwingWorker&lt;Void, Void&gt; worker = new SwingWorker&lt;Void, Void&gt;(){ @Override protected Void doInBackground() throws Exception { try { Bot bot = new Bot(); //bot.type(str + " "); System.out.println("done"); Thread.sleep(1000); }catch (AWTException e) {} return null; } }; worker.execute(); } } public static void main(String args[]){ try{ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }catch(Exception e){} Main mo = new Main(); } }
has title: JFrame freezes when I run a bot
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/25900292
downvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25900226
has body: The main difference is that Dictionary is an abstract class and Map is a interface. Collections API uses interfaces like Map, List, Set.
type: Answer
upvote count: 2

http://stackoverflow.com/a/26966206
answers question: http://stackoverflow.com/q/25927093
type: Answer
has body: Make sure the directory and files all have the same file/directory ownership. I had this issue while upgrading gerrit and tried all possibilities and finally found that some of the directories and files under gerrit were owner by root and not the user with which am starting gerrit. chmod -R user:group *
score: 0

http://stackoverflow.com/q/26017055
favorite count: 0
has answer: http://stackoverflow.com/a/26017283
answer count: 5
accepted answer: http://stackoverflow.com/a/26017650
tagged with: count
has body: I want to make a program to count characters, words and lines from an input text and stops when read a point(.) This i what i have done so far... import java.util.Scanner; import java.io.*; public class HelloWorld { public static void main(String[] args) throws FileNotFoundException { System.out.print ("Enter your text: "); Scanner input=new Scanner(System.in); String str=input.nextLine(); int ch=0; int nlines=0; int nwords=0; while(!str.equals(".")) { ch+=str.length(); nlines++; String[] words = str.split(" "); nwords = words.length; str=input.next(); } System.out.println("Number of words :"+nwords); System.out.println("Number ofcharacters: "+ch); System.out.println("Number of lines: "+nlines); } } What is wrong with my program?
tagged with: text
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40748557
tagged with: java
has comment: http://stackoverflow.com/comment/40748573
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26017442
score: -1
tagged with: eclipse
has title: Java counting program
has comment: http://stackoverflow.com/comment/40748605
upvote count: 0
possible better answer: http://stackoverflow.com/a/26017245
has answer: http://stackoverflow.com/a/26017361
has answer: http://stackoverflow.com/a/26017650
has answer: http://stackoverflow.com/a/26017245
tagged with: string

http://stackoverflow.com/comment/40606503
has text: yes compiling worked in every single case I tried. I copied the manifest code from http://stackoverflow.com/a/10202654/1260792 and I've tried pre-existing files as well as build-time generation.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25936604
type: AnswerComment

http://stackoverflow.com/comment/45395581
comment on: http://stackoverflow.com/a/26008010
score: 0
type: Comment
has text: This is a bad answer; never use absolute paths w.r.t your own personal computer, EVER!
type: AnswerComment

http://stackoverflow.com/q/25880084
has title: Four Color Theorem
accepted answer: http://stackoverflow.com/a/25880565
answer count: 1
downvote count: 0
favorite count: 0
has body: I have been trying to write a code that would use the four color theorem to color regions defined by an adjacency matrix. An adjacency matrix would look like: A B C D A 0 1 0 1 B 1 0 1 0 C 0 1 0 1 D 1 0 1 0 So for this example A is not adjacent to itself or C, but it is adjacent to B and D. The program I am writing has to use recursion and back-tracing to assign 4 colors (or less) to the defined regions. So far my algorithm is as follows: global int[] colors = &lt;region one color,region two, region three, region four &gt; public static int color(row,column) if out of bounds ?? loop(!colored) { case 1: are any adjacent regions this color? assign case 2: are any adjacent regions this color? assign. case 3: are any adjacent regions this color? assign. case 4: are any adjacent regions this color? assign. case 5: if nothing found, steal closest (in #) region's color and call method from there } But I have a few questions: What would this method return? Would this work and have recursion/backtracing like it should? What would I output if the given row/column are out of bounds? Thank you!
type: AnsweredQuestion
tagged with: recursion
has comment: http://stackoverflow.com/comment/40501914
has answer: http://stackoverflow.com/a/25880565
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/40501874

http://stackoverflow.com/q/25937609
has comment: http://stackoverflow.com/comment/40606162
has body: I'm trying to check a password with the following constraint: at least 9 characters at least 1 upper case at least 1 lower case at least 1 special character into the following list: ~ ! @ # $ % ^ &amp; * ( ) _ - + = { } [ ] | : ; " ' &lt; &gt; , . ? no accentuated letter Here's the code I wrote: Pattern pattern = Pattern.compile( "(?!.*[âêôûÄéÆÇàèÊùÌÍÎÏÐîÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ€£])" + "(?=.*\\d)" + "(?=.*[a-z])" + "(?=.*[A-Z])" + "(?=.*[`~!@#$%^&amp;*()_\\-+={}\\[\\]\\\\|:;\"'&lt;&gt;,.?/])" + ".{9,}"); Matcher matcher = pattern.matcher(myNewPassword); if (matcher.matches()) { //do what you've got to do when you } The issue is that some characters like € or £ doesn't make the password wrong. I don't understand why this is working that way since I explicitly exclude € and £ from the authorized list.
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25937849
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25937849
score: -1
possible better answer: http://stackoverflow.com/a/25938147
has answer: http://stackoverflow.com/a/25938147
has comment: http://stackoverflow.com/comment/40606813
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40606269
favorite count: 0
has comment: http://stackoverflow.com/comment/40607306
has title: Weird password check matching using regex in Java
has comment: http://stackoverflow.com/comment/40607401
tagged with: symbols
tagged with: regex

http://stackoverflow.com/comment/40689600
score: 0
has text: Hi, thank you for the comment here - I am still learning all this! I have edited my OP to include the `onCreateView` method from `FragmentTab3.java`
type: AnswerComment
comment on: http://stackoverflow.com/a/25984193
type: Comment

http://stackoverflow.com/comment/40510159
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25881729
has text: post some example strings.
type: AnswerComment

http://stackoverflow.com/comment/40630449
comment on: http://stackoverflow.com/a/25952362
type: Comment
has text: Try this: http://stackoverflow.com/questions/10424528/changing-java-version-from-within-eclipse
score: 0
type: AnswerComment

http://stackoverflow.com/q/25964298
upvote count: 1
has body: I am trying to install preon and run it within IntelliJ. I have downloaded the source code from https://github.com/preon/preon. Then I open the project with IntelliJ. Then I download pecia and import it as a module into the preon project. Then I try to run the BitmapFileTest program at ...preon-master/preon-samples/preon-sample-bmp/src/test/java/org/codehaus/preon/sample/bmp/BitmapFileTest.java Here are the first few errors that I get: ...preon-master/preon-el/src/main/java/org/codehaus/preon/el/Expressions.java Error:(151, 24) java: cannot find symbol symbol: class LimboWalker location: class org.codehaus.preon.el.Expressions Error:(154, 9) java: cannot find symbol symbol: class LimboLexer location: class org.codehaus.preon.el.Expressions Error:(154, 32) java: cannot find symbol symbol: class LimboLexer location: class org.codehaus.preon.el.Expressions Error:(156, 9) java: cannot find symbol symbol: class LimboParser location: class org.codehaus.preon.el.Expressions Error:(156, 34) java: cannot find symbol symbol: class LimboParser location: class org.codehaus.preon.el.Expressions Error:(160, 9) java: cannot find symbol symbol: class LimboWalker location: class org.codehaus.preon.el.Expressions Error:(160, 55) java: cannot find symbol symbol: class LimboWalker location: package org.codehaus.preon.el For some reason the compiler cannot find the Limbo classes in its own project. What do I need to do to be able to build and run this sample project?
type: AnsweredQuestion
score: 1
tagged with: java
has title: How do I install Preon?
type: Question
has answer: http://stackoverflow.com/a/25964771
tagged with: intellij-idea
downvote count: 0
answer count: 1
tagged with: preon
accepted answer: http://stackoverflow.com/a/25964771
favorite count: 0

http://stackoverflow.com/comment/40729674
score: 0
type: AnswerComment
has text: Oh sorry, I forgot to specify the way in which I added new connections. I have edited the code for adding connections. Not sure if that makes any difference.
type: Comment
comment on: http://stackoverflow.com/a/26005775

http://stackoverflow.com/comment/40505216
comment on: http://stackoverflow.com/a/25881706
type: AnswerComment
score: 1
has text: Yes,sorry,it threw an exception: local class incompatible: stream classdesc serialVersionUID = 1360826667802527544, local class serialVersionUID = 1360826667806852920
type: Comment

http://stackoverflow.com/a/25937314
answers question: http://stackoverflow.com/q/25936694
type: Answer
accepted answer of: http://stackoverflow.com/q/25936694
downvote count: 0
score: 3
has body: It may be because of BMP files expects row lengths to be a multiple of 4 bytes. This changes the size you specified in header offset 34 and therefore the size in offset 2. Please refer to the following for details: http://en.wikipedia.org/wiki/BMP_file_format Related Part: For file storage purposes, only the size of each row must be a multiple of 4 bytes while the file offset can be arbitrary You can compare file by creating a 970x970 Red BMP file using MS Paint.
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/comment/40549681
type: QuestionComment
has text: `dog.setName = "Rex";` Won't work. Do you mean `dog.setName("Rex");`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25906618

http://stackoverflow.com/comment/40735470
has text: Please put more effort into formatting your posts. Your code is really hard to read at the moment, due to a lack of indentation and random blank lines.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26009692

http://stackoverflow.com/a/25939901
answers question: http://stackoverflow.com/q/25937819
type: Answer
has body: I looked and saw one problem with your "int s;" (was outside of method before) int s; startWin.text.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER){ start = setup.StrToInt(startWin.text.getText()); //start is static s = start; } } }); return s;
score: 0

http://stackoverflow.com/q/25953377
has comment: http://stackoverflow.com/comment/40632401
tagged with: java
has answer: http://stackoverflow.com/a/25953436
type: Question
tagged with: actionlistener
has title: Listening for a keystroke OR a button press
has body: I am building a calculator app to get my head around building GUIs with Swing. I want to be able to click on the calculator buttons, but also to type them in on the keyboard. I've been looking at KeyStroke but I'm not entirely sure how to implement it in my current JButton ActionListener. Here's a sample of a button press: public void actionPerformed(ActionEvent e) { if(e.getSource()==btn1){ if(calcOperatorActive){display.setText("1");calcOperatorActive=false;} else if(calcOperator=="equals"){display.setText("1");calcTempMem=0;calcOperator="none";} else{display.setText(display.getText()+"1");} } I want to be able to add a key listener on the if statement, something along the lines of: if((e.getSource()==btn1)|(KeyStroke.getKeyStroke("1")){ //the code } But I get an error saying can't compare boolean and KeyStroke.
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/25839356
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/a/25903956
has body: You are getting ArrayIndexOutOfBoundException, it means your file has more than 5 lines and String array is just of length 5 so exception is thrown. If you want to read 5 names from file 'Input.txt' then break the loop when k>5 while (inputFile.hasNext()) { if(k&gt;5) break; String str = inputFile.nextLine(); input[k]=str; k++; } or if you want to read whole file, then you need to use array whose size is not defined when created, something like dynamic array: ArrayList List&lt;String&gt; input = new ArrayList&lt;String&gt;(); while (inputFile.hasNext()) { String str = inputFile.nextLine(); input.add(str); }
type: Answer
answers question: http://stackoverflow.com/q/25903898
score: 0

http://stackoverflow.com/a/26025910
score: 1
answers question: http://stackoverflow.com/q/26020306
upvote count: 1
has comment: http://stackoverflow.com/comment/40779732
downvote count: 0
has body: You can try maybe the below xml output if you want to return multiple errors? 1 Null field 2 Null field
type: Answer

http://stackoverflow.com/q/25931370
upvote count: 1
tagged with: sqlite
has body: I've been away from java for a while and as a warmup, decided to run a basic database/list-keeping app to help me keep track of things I need as I move. I'm largely finished with the app, it runs roughly but well enough for my purposes, but I'm having a lot of issues with the SQLite database functions. The only one I've yet to sort out is the "update" function. Here is my current code, within my SQLITE Helper class: public int updateObject(HomeObject originalObject, HomeObject updatedObject) { // 1. get reference to writable DB SQLiteDatabase db = this.getWritableDatabase(); // 2. create ContentValues to add key "column"/value ContentValues values = new ContentValues(); values.put("name", updatedObject.getName()); values.put("room", updatedObject.getRoom()); // get title values.put("have", updatedObject.getHave()); // get author // 3. updating row int i = db.update(TABLE_HomeObjects, //table values, // column/value KEY_ID+" = "+String.valueOf(originalObject.getId()), // selections null ); //selection args // 4. close db.close(); return i; } However, when I use the modify button which is meant to call this method and update the object correspondingly, it appears to simply delete the object. It disappears off of all lists and in-app searches reveal it to be no longer in the database. Here's what the relevant code I use to call it looks like: MySQLiteHelper db = new MySQLiteHelper(this); Intent intent = getIntent(); String itemName = intent.getStringExtra(LivingRoom.EXTRA_MESSAGE); // Redacted... There is a large section of code here // which deals with pulling the newlyEditedName, newlyEditedHave, // and newlyEditedRoom variables from different places in the view. HomeObject newlyEditedObject = new HomeObject(newlyEditedName, newlyEditedHave, newlyEditedRoom); HomeObject originalObject = db.getObject(itemName); int test = db.updateObject(originalObject, newlyEditedObject); I'm very new to SQLite, so maybe I'm missing something basic... But what's going wrong here? The…
answer count: 1
has answer: http://stackoverflow.com/a/25931887
downvote count: 1
favorite count: 0
score: 0
tagged with: android
has title: Android SQLite Update Method Won't Update
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: database
tagged with: eclipse

http://stackoverflow.com/comment/40574257
comment on: http://stackoverflow.com/a/25919969
has text: http://stackoverflow.com/questions/2134784/why-filename-in-java-should-be-same-as-class-name
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/34820963
type: Answer
score: 3
downvote count: 0
has body: For completion's sake, here's the snippet that creates the transport client using proper static method provided by InetSocketTransportAddress: Client esClient = TransportClient.builder() .settings(settings) .build() .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("143.79.236.xxx"), 9300));
answers question: http://stackoverflow.com/q/25912572
has comment: http://stackoverflow.com/comment/100812676
upvote count: 3

http://stackoverflow.com/comment/40692635
has text: I highly recommend using a microbenchmark framework like Caliper (from Google, maker of fast things) to do A/B algorithm comparisons. JIT can radically affect results. See https://code.google.com/p/caliper/wiki/JavaMicrobenchmarks
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25985613

http://stackoverflow.com/comment/40706239
score: 0
has text: Is it serializing to XML and not at all to json or just to json and uses the XML name?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25993922

http://stackoverflow.com/comment/40762333
comment on: http://stackoverflow.com/q/26024350
has text: Create a minimal self contained test case that exhibits the odd behaviour.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40649729
has text: Never mind the server, what about the five connect timeout exceptions?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25961652
score: 0

http://stackoverflow.com/q/25989815
has comment: http://stackoverflow.com/comment/40700287
tagged with: java
has comment: http://stackoverflow.com/comment/40699485
tagged with: servlets
score: 0
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/40699607
has title: Where to load Driver for PostgreSQL on JAX-RS 2 (Servlet 3) no web.xml
answer count: 0
has comment: http://stackoverflow.com/comment/40699566
type: UnansweredQuestion
has body: currently i'm trying to play with Servlet 3.0 and JAX-RS 2.0. I tried to setup a PostgreSQL database but I don't know where to load the driver? I only have a Application class and no web.xml Also I don't know where to put any initial code?!
type: Question

http://stackoverflow.com/a/29798849
type: Answer
answers question: http://stackoverflow.com/q/25910341
upvote count: 4
downvote count: 0
score: 4
has body: I think the accepted answer is not the recommended solution. In Luna you should install Web Tools Platform via the Luna download site, not the WTC download site. Here are the instructions: https://wiki.eclipse.org/WTP_FAQ#How_do_I_install_WTP.3F Here is what happens if you use WTP site: Can&#39;t install WTP (Web Tools Platform) in Eclipse - something about missing dependencies...? Yes, I see that the asker says he has done this, so I guess the accepted answer worked for him, but I think people should try this recommended method first.

http://stackoverflow.com/q/25911649
type: UnansweredQuestion
tagged with: dependencies
has body: I've two jars, Jar1 used in compilation and Jar2 is not used at compile time.However both Jar1 and Jar2 are present on the classpath. I tried finding the references of classes for Jar2 but did not find any of the classes used in the application. But what if the Jar1 uses some classes of Jar2 at runtime ? How can I be sure enough to delete the Jar2 from the library and the classpath that it is used by Jar1 at run time ? Is there any tool available which can tell if any jar is not used in any scenarios at run-time with 100% surety ? [Little background : I am upgrading to newer version of POI, previously distribution had contrib.jar, now this jar is not present in the recent version. I tried compiling the project after removing the contrib.jar and it compiled successfully. But I want to be doubly sure that removing this from the libraires should not have any adverse effect at runtime.] Regards, JE.
score: 2
tagged with: apache-poi
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25912420
has title: Resolving runtime dependencies in Java
has comment: http://stackoverflow.com/comment/40559158
downvote count: 0
answer count: 1
tagged with: jar
favorite count: 0

http://stackoverflow.com/comment/40619304
type: QuestionComment
has text: Java GUIs have to work on different OS', screen size, screen resolution etc. As such, they are not conducive to pixel perfect layout. Instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556) along with layout padding and borders for [white space](http://stackoverflow.com/a/17874718/418556).
score: 1
comment on: http://stackoverflow.com/q/25945061
type: Comment

http://stackoverflow.com/comment/40766000
type: AnswerComment
comment on: http://stackoverflow.com/a/26025749
score: 0
has text: Okay. I am updating my question with more insight. I guess it may yeild a different solution from you. :-).
type: Comment

http://stackoverflow.com/comment/40718317
has text: Can you assist me with also how to obtain them to different activity?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25993303

http://stackoverflow.com/a/25916962
downvote count: 0
has body: You can do create two Thread objects inside your main() like this: Thread thread1 = new Thread () { public void run () { reporting("one","Starting"); } }; Thread thread2 = new Thread () { public void run () { reporting("two","Starting"); } }; Then start the 2 threads like: thread1.start(); thread2.start(); Read more about the Thread Class and also check out some useful examples.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25916887
type: Answer

http://stackoverflow.com/comment/40890448
type: Comment
type: AnswerComment
has text: You are indeed a rockstar . Let me try it out once. In case of any issue , will get back to you ( I hope I am not annoying you too much :-) )
comment on: http://stackoverflow.com/a/26056910
score: 0

http://stackoverflow.com/q/25893786
has answer: http://stackoverflow.com/a/25893874
has comment: http://stackoverflow.com/comment/40527651
has title: Cannot resolve symbol AlertDialogActivity
has comment: http://stackoverflow.com/comment/40525998
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40531744
has answer: http://stackoverflow.com/a/25894037
has body: So I'm just trying to create an Alert Dialog that is just a message (no buttons or titles). I want to display an alert dialog when a background task is running. The alert dialog will run on the UI thread. Here's what I have done so far: protected void onPreExecute() { super.onPreExecute(); AlertDialog altDlg; altDlg = new AlertDialog.Builder(AlertDialogActivity.this).create(); altDlg.setMessage("Retrieving Information. Please Wait"); altDlg.show(); } I also tried doing this: AlertDialog.Builder builder = new AlertDialog.Builder(this) .setMessage("Retrieve Info. Please Wait").show(); The error I am getting with the first one is: cannot find symbol 'AlertDialogActivity' symbol: class AlertDialogActivity location: class com.example.Device.Activity The second attempt error says: incompatible types: com.example.Device.Activity cannot be converted to android.content.Context I'm not sure what I am doing wrong in either scenario. I just want to display a basic message when a background task is running and I was hoping the closest thing I can use is AlertDialog. EDIT for how to set up AsyncTask properly: Small background of what I want to do. I just want to read in a file, deserialize it and save it's contents to a db. Right now I'm assuming I only need two activities. One is my main activity: public class MainActivity extends Activity { /** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.setup); final Button setup_button = (Button) findViewById(R.id.setup_button); setup_button.setOnClickListener (new View.OnClickListener() { public void onClick(View view){ setContentView(R.layout.retrieve_info); } }); } } Now the onClick event just moves to the new view that is supposed to display the message or alert dialog that says retrieving information. Please Wait. It displays the message while reading a file and saving to db. Once the file is read and saved, The mes…
type: UnansweredQuestion
tagged with: android
tagged with: android-alertdialog
has comment: http://stackoverflow.com/comment/40526405
has answer: http://stackoverflow.com/a/25894178
tagged with: java
type: Question

http://stackoverflow.com/a/26001013
has comment: http://stackoverflow.com/comment/102189359
has body: The purpose of validation is to reduce the functionality calling with invalid data. So Option 1 would be the better. If Userid and image is not in a correct format dont call the further functionality.
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26000342
answers question: http://stackoverflow.com/q/26000342
score: 0
type: AcceptedAnswer
type: Answer
upvote count: 1

http://stackoverflow.com/comment/66517372
comment on: http://stackoverflow.com/a/25941064
has text: @Denny If you don't use `new`, you don't instantiate a new reference. Thus, each `Object` is actually the same `Object`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40509780
comment on: http://stackoverflow.com/a/25876922
has text: A) You're wrong, read [the documentation for add](http://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#add-E-) B) It's not relevant here considering the title: *How to extract object from set by part of fields in its class*.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25885902
type: Answer
has body: The equality comparator in Java is ==, not =. And the int variable you want to check is named object, not input Replace if (input = with if (object ==
score: 0
answers question: http://stackoverflow.com/q/25885790

http://stackoverflow.com/a/26507153
score: 0
has body: Update on the question, Upon changing to spring bom and spring data bom dependency management, the problem persisted. However, removing the "@PersistenceConstructor" tag from the first constructor, and then switching around the order of the constructors fixed the issue. So the default constructor has to be first one in the file by the look of things. Not sure why, but there you go!
answers question: http://stackoverflow.com/q/25992986
type: Answer

http://stackoverflow.com/comment/40555936
comment on: http://stackoverflow.com/a/25910200
type: AnswerComment
score: 0
type: Comment
has text: @JBNizet Imagine that `MyObj` is `Number`. Both `ArrayList<Integer> foo = Util.generateRandomList(2)` and `ArrayList<Double> foo = Util.generateRandomList(2)` will compile, yet because of type erasure the method itself has no way of knowing which case is happening.

http://stackoverflow.com/q/25910070
has answer: http://stackoverflow.com/a/25910771
tagged with: swing
tagged with: java
type: Question
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/40556380
has title: How to use JScrollPane with JTabbedPane?
score: 0
answer count: 1
has body: public RoteLearnerTabbedPanePage() throws IOException, SAXException, ErrorCondition { JFrame frm=new JFrame(); tabbedPane=new JTabbedPane(); Document doc=rx.readXmlFile(); if(!rx.validateClassIds()) { JOptionPane.showMessageDialog(panel1,"Check Xml file. Duplicate 'Class Ids' are present","Error", JOptionPane.ERROR_MESSAGE); System.exit(0); } if(!rx.validateAttributeIds()) { JOptionPane.showMessageDialog(panel1,"Check Xml file. Duplicate 'Attribute Ids' are present","Error", JOptionPane.ERROR_MESSAGE); System.exit(0); } if(!rx.isValidMainClass()) { JOptionPane.showMessageDialog(panel1,"Check Xml File. Main-class declaration for one of the domain classes seems invalid","Error", JOptionPane.ERROR_MESSAGE); System.exit(0); } Hashtable&lt;String,String&gt; mainclasnames=rx.getMainClassNames(doc, doc.getChildNodes()); Set&lt;XmlClass&gt; guiAttrVals=rx.getGuiAttributeValues(doc, doc.getChildNodes()); int j=0; int i=0; Iterator&lt;Entry&lt;String, String&gt;&gt; mainclass_it = mainclasnames.entrySet().iterator(); while(mainclass_it.hasNext()) { Entry&lt;String, String&gt; classDet = mainclass_it.next(); String classname = classDet.getValue(); final Hashtable&lt;JLabel,JTextField&gt; uiParams=new Hashtable&lt;JLabel,JTextField&gt;(); JButton buttonLearn = new JButton("Learn"); panel1= new JPanel(); panel1.setLayout(new BoxLayout(panel1, BoxLayout.PAGE_AXIS)); transientPanel=new JPanel(new GridBagLayout()); // Create a sequential group for the vertical axis. nonTransientPanel=new JPanel(new GridBagLayout()); JScrollPane scroll1 = new JScrollPane(panel1); tabbedPane.add(scroll1); // Create a sequential group for the horizontal axis. GridBagConstraints constraints = new GridBagConstraints(); GridBagConstraints nontranconstraints = new GridBagConstraints(); Iterator&lt;XmlClass&gt; guiItr=guiAttrVals.iterator(); while(guiItr.hasNext()) { XmlClass xmlclasss=guiItr.next(); if(classname.equals(xmlclasss.getName())) { Set&lt;XmlAttributes&gt; xmlAttrs=xmlclasss.getAttributes(); It…
tagged with: jtabbedpane
type: UnansweredQuestion

http://stackoverflow.com/comment/40604967
type: Comment
type: QuestionComment
has text: How are the `set`, `intToDWord`, and `intToWord` methods defined?
comment on: http://stackoverflow.com/q/25936694
score: 0

http://stackoverflow.com/q/25933560
type: Question
has answer: http://stackoverflow.com/a/33732500
accepted answer: http://stackoverflow.com/a/33732500
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/1727668
favorite count: 0
has body: Currently I'm facing strange problem. I have one demo application which just authenticate user from database and shows welcome page. The problem is if I keep login page open and then after restarting server, try to login using the same page which is opened earlier, screen shown me HTTP Status 408 - The time allowed for the login process has been exceeded. error. I tried the suggested changed in HTTP Status 408 error during login with domain forwarding set up link but it's not working. This is my login page : Login <form method="post" action='<%= response.encodeURL("j_security_check") %>' id="login" > Username Password Log in I tried to debug but request is not coming through server to controller. So I'm guessing something is wrong with jboss server. Any help will be appreciated. Thanks
has comment: http://stackoverflow.com/comment/44992344
has title: http status 408 in j_security_check using JBoss
tagged with: http-error
downvote count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/44999045
score: 1
tagged with: java
tagged with: hibernate
tagged with: jboss
tagged with: struts

http://stackoverflow.com/comment/40585101
has text: Could you explain a little more about this JNI/JNA solution?
type: AnswerComment
comment on: http://stackoverflow.com/a/25926029
score: 0
type: Comment

http://stackoverflow.com/comment/40686447
has text: This question appears to be off-topic because it is asking for code review.
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25982650

http://stackoverflow.com/q/25898503
favorite count: 0
upvote count: 2
has body: I've tried to solve this question for the past couple of hours and I just don't understand it. I know there must be a sort of mathematical calculation to calculate this but I don't know how to exactly calculate it. I know this code does not make sense because I'm completely lost, I would appreciate any hints or help for this to help me get closer to the solution. I asked my professor and he told me a hint about it being similar to a permutation/combination using alphabet such as 26^3 for 3 different combinations but this did not help me much. What I know: There are 796 characters for the input given in the string and I must find ALL possible ways that 796 characters can be in a balanced parenthesis form. Since it must start with '(' and end with ')' there must be 2 brackets for each case. So it can be '()()(xc)(cvs)'. Thus that means the mathematical calculation must involve 2*(something) per char(s) since it has to be balanced. I need to use the remainder(%) operator to recursively find every case but how do I do that when I take a char in not an int? What I don't know: How will I analyze each case? Won't that take a long time or a lot of code without a simple formula to calculate the input? Would I need a lot of if-statements or recursion? Question: Let Σ = {), (}. Let L ⊆ Σ* be the set of strings of correctly balanced parentheses. For example, (())() is in L and (()))( is not in L. Formally, L is defined recursively as follows. ε ∈ L A string x ≠ ε is in L if and only if x is of the form (y)z, where y and z are in L. n is a specific 3 digit number between 0 and 999. Compute f(n) mod 997 Some facts you might find useful: if n1, n2 is a member of N(natural number) then, (n1 x n2) mod 997 and (n1 + n2) mod 997 n = 796 (this is specific for me and this will be the given input in this case) So I must "compute f(796) mod 997 = ?" using a program. In this case I will simply use java for this question. Code: import java.util.*; public class findBrackets { public static v…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40534898
has comment: http://stackoverflow.com/comment/40543677
has comment: http://stackoverflow.com/comment/40536182
has title: Finding Balanced Parenthesis Involving Math
tagged with: catalan
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/25899816
type: Question
tagged with: discrete-mathematics
tagged with: math
has answer: http://stackoverflow.com/a/25898743
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25898684
has comment: http://stackoverflow.com/comment/40534940

http://stackoverflow.com/q/26018730
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40781375
has answer: http://stackoverflow.com/a/26064161
has comment: http://stackoverflow.com/comment/40779366
type: AnsweredQuestion
has body: I have a single activity with a navigation drawer (the basic one provided by Eclipse new app wizard). I have a FrameLayout as a container for the different fragments of the app, which are replaced when selecting an item in the navigation drawer. They are also added to the BackStack. These fragments contain a LinearLayout, which has some EditTexts and a Button. If the button is pressed, a new LinearLayout is created and a couple TextViews are added to it with the content of the EditTexts. The user can repeat this option more than once, so I cannot tell how many LinearLayouts I'll need, therefore I need to add them programmatically. One of these fragments xml: &lt;LinearLayout android:id="@+id/pen_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;LinearLayout android:id="@+id/new_pen_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/activity_vertical_margin" android:background="@drawable/border" android:orientation="vertical" android:paddingBottom="@dimen/home_section_margin_bottom" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/home_section_margin_top" &gt; &lt;EditText android:id="@+id/new_pen_round" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="number" android:hint="@string/new_pen_round_hint" android:textSize="@dimen/normal_text_size" /&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightSum="2" &gt; &lt;Button android:id="@+id/new_pen_cancel_button" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginRight="@dimen/new_item_button_margin_right" android:layout_weight="1" android:background="@drawable/button_bg" android:paddingBottom="@dimen/new_item_button_padding_bottom" andr…
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40781629
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40779635
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/40778604
tagged with: android-fragments
accepted answer: http://stackoverflow.com/a/26064161
has title: Restore views in a fragment added programmatically
linked to: http://stackoverflow.com/q/1714297
answer count: 1
has comment: http://stackoverflow.com/comment/40782154

http://stackoverflow.com/a/25959041
accepted answer of: http://stackoverflow.com/q/25958896
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25958896
has body: Try to define the application name in your string.xml file and then replace this line : <application android:allowBackup="true" android:icon="@drawable/app_logo" android:label="@string/appname" android:theme="@style/AppTheme" > Where "appname" is a string in string.xml like : Umall

wikipedia-api
tag name: wikipedia-api
type: Tag
tags question: http://stackoverflow.com/q/26023180

http://stackoverflow.com/q/25934666
tagged with: mysql
type: Question
tagged with: character-encoding
has body: I'm doing an example Java application that uses JDBC to extract some data from MySQL. It works bad with the characters á, é, í, ó and ú, when these caracters are in the database my application shows strange characters such "," or "?". For example, if in the database there is the é character, when my application extracts it through jdbc as a byte, I get the byte 130. I have tried to find what character set is using my application when extracting data from my database. I have not found any character set which encodes the "é" with the 130 number in decimal. ¿Can you help me to find it? I only need the character set name.
accepted answer: http://stackoverflow.com/a/25934706
answer count: 1
has comment: http://stackoverflow.com/comment/40600317
has comment: http://stackoverflow.com/comment/40600185
tagged with: jdbc
type: AnsweredQuestion
has title: What character set does encode the "é" character as 130 in decimal?
has answer: http://stackoverflow.com/a/25934706
score: 0
tagged with: java

http://stackoverflow.com/q/25882256
tagged with: android
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26003934
type: Question
has title: Retrofit: How to get request properties in requestInterceptor
has answer: http://stackoverflow.com/a/26003934
score: 0
tagged with: retrofit
answer count: 1
has body: I need to apply an Authorization header in a request interceptor, but I need to sign the request method, URI, and date. Inside the request interceptor I get a RequestInterceptor.RequestFacade, which only has "setter methods" Is there any way I can get request properties inside a request interceptor?

http://stackoverflow.com/comment/107477281
has text: Thanks, I faced the same problem, now you helped me to solve.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/59751830

http://stackoverflow.com/a/25899278
downvote count: 0
type: Answer
has body: Of course it doesn't! setText sets new text. The solution is very simple. textView.setText("This: "); textView.append("works"); textView should say "This: works" Hope this helps, good luck :)
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25899219

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/25876736
type: Tag
tags question: http://stackoverflow.com/q/25960968

http://stackoverflow.com/comment/40664318
score: 0
has text: Bah... I certainly feel silly. I don't need the `jena-jdbc-core` dependency, I also don't need the `jena-jdbc` dependency as it's POM only. Everything is A-OK with just the flavor of the driver that I need (`jena-jdbc-driver-remote` in my case). Thanks for catching my boneheaded mistake. DOH!
type: Comment
comment on: http://stackoverflow.com/a/25970300
type: AnswerComment

http://stackoverflow.com/comment/40667758
score: 0
type: Comment
has text: Thanks for the suggestion. Will check about MDC.
comment on: http://stackoverflow.com/a/25972161
type: AnswerComment

http://stackoverflow.com/q/25921904
upvote count: 0
score: -5
has body: I am trying to find the bug in the following code which I purposely screwed only to explore concept in depth. import java.util.ArrayList; import java.util.Iterator; class typeAnimal&lt;String&gt; implements Iterable&lt;String&gt; //// (1) { ArrayList&lt;String&gt; listAnimal = new ArrayList&lt;String&gt;(); typeAnimal(ArrayList&lt;String&gt; listAnimal) { this.listAnimal = listAnimal; } @Override public Iterator&lt;String&gt; iterator() { return new Iterator&lt;String&gt;() { int position; @Override public boolean hasNext() { if(position&lt;listAnimal.size()) return true; else return false; } @Override public String next() { String aniPos = listAnimal.get(position); position ++; return aniPos; } @Override public void remove() { // TODO Auto-generated method stub } }; } } public class newIterator { public static void main(String[] args) { ArrayList&lt;String&gt; animalList = new ArrayList&lt;String&gt;(); animalList.add("priyank"); animalList.add("kannu"); typeAnimal&lt;Object&gt; animalName= new typeAnimal(animalList); for(String name:animalName) //// &lt;-- Error { System.out.println(name); } } } The error is Type mismatch: cannot convert from element type Object to String. But if I replace typeAnimal&lt;String&gt; in (1) with typeAnimal&lt;Object&gt; the error will go away. I know this is worth less code but still wish to know what exactly causing error.
tagged with: java
has answer: http://stackoverflow.com/a/25921972
type: Question
answer count: 1
has title: Need help in understanding java generics concept
favorite count: 0
downvote count: 5
type: UnansweredQuestion

http://stackoverflow.com/comment/40566882
type: Comment
type: QuestionComment
has text: That's perfectly fine, but The writer is where you will send your information, right? So, where does it come from?
score: 0
comment on: http://stackoverflow.com/q/25915073

http://stackoverflow.com/comment/40582557
has text: @Pshemo That's a good point. I usually just put the package name in front of the class name in these situations, i.e. `java.util.List list ...`
comment on: http://stackoverflow.com/a/25924554
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40693054
type: QuestionComment
has text: LogCat didn't show anything out of the ordinary.
comment on: http://stackoverflow.com/q/25986060
score: 0
type: Comment

http://stackoverflow.com/comment/40684951
type: AnswerComment
comment on: http://stackoverflow.com/a/25980916
type: Comment
has text: someFunctionforWait never gives you the result of the Callable
score: 0

http://stackoverflow.com/comment/40574616
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25920015
has text: I think on `Orientation` change your `Activity` is restarting so `AsyncTast` is called again.
score: 0

http://stackoverflow.com/q/26018079
has answer: http://stackoverflow.com/a/26160555
tagged with: java
tagged with: eclipse
tagged with: apache-tiles
type: Question
answer count: 3
has body: I have had a bit of a look around and can't seem to find a post with the scenario that i've come across. I have written a small web app that utilises Spring MVC 4 and apache tiles 3. I am using apache tiles as I wanted to create a master page template in order to keep the application look and feel constant. I have been developing this in eclipse and running it on and apache 8 server through the IDE. This has all been running absolutely fine through eclipse and the templating was working well. When I have exported the project as a .war file and run it up on the same apache 8 server outside of the IDE I am receiving the following stack trace when trying to view pages that use the tiles templating: 2: <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> 3: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 4: pageEncoding="ISO-8859-1"%> 5: <tiles:insertDefinition name="defaultTemplate"> 6: <tiles:putAttribute name="body"> 7: 8: Hi <c:out value="${uacc_fname}"></c:out> <c:out value="${uacc_sname}"></c:out> welcome to the home page!! Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1221) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:95…
downvote count: 0
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/29094711
has title: Spring Framework 4 & Apache Tiles 3 - no such definition error
tagged with: spring-mvc
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27120854

http://stackoverflow.com/a/26019212
type: Answer
has comment: http://stackoverflow.com/comment/40819183
has comment: http://stackoverflow.com/comment/40793792
answers question: http://stackoverflow.com/q/26018704
score: 0
has body: Get the div element and then change its visbility. As per the code,you get a input element instead get the div element and then change the visibilty. Give an id attribute to your div element and write a script to get element by document.getElementById and give it to JavascriptExecutor for changing the visibility.

http://stackoverflow.com/q/25907780
has answer: http://stackoverflow.com/a/25907884
has answer: http://stackoverflow.com/a/25907889
has comment: http://stackoverflow.com/comment/40552095
has answer: http://stackoverflow.com/a/25907960
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/1906445
has answer: http://stackoverflow.com/a/25907916
type: Question
accepted answer: http://stackoverflow.com/a/25907916
has title: JRE JDK and IDE revisited
possible better answer: http://stackoverflow.com/a/25907884
tagged with: ide
has body: I know this question must've been asked alot of times already, but I've got some specific questions that need answering to. The underlying question I am trying to ask here is What's the difference between JRE/JDK/IDE. I understand that JRE has the run time libraries, JDK contains the compiler/debugger and everything else that JRE has. IDE is my Eclipse. Question 1 : If I am trying to develop something in Java, is it necessary that I need JDK for it? Because as I understand, I can make do with IDE + JRE. My IDE provides me with compiler/debugger, and I will refer the JRE from my IDE. So, it should be alright right? Question 2 : From the above question, is it safe to say that IDE contains JDK in it already? Question 3 : When exactly will I need just the JRE and nothing else? i.e. under what circumstances will only having JRE suffice. If I were to emulate such behaviour, what are the necessary steps required. (I can make it more clear if you have not understood it. ) Thanks
score: 0
has comment: http://stackoverflow.com/comment/40551631
has comment: http://stackoverflow.com/comment/40551795
has answer: http://stackoverflow.com/a/25907885
answer count: 5

http://stackoverflow.com/a/25980674
has body: Can you please break the statements as shown below, if possible please post your complete code. at least the db part. To write it in a simplified manner. its easier to debug in your case. Connection con=DriverManager.getConnection(DB_URL,USER,PASS); String sql = "Your Query"; PreparedStatement ps= conn.prepareStatement(sql); ps.setXXX;--&gt; binding values ps.setXXX;
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25979974

http://stackoverflow.com/comment/40634600
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25954556
has text: 1 error found: [line: 21] Error: non-static method alternate(java.lang.String,java.lang.String) cannot be referenced from a static context <-----This is at "String s = alternate(a,b);"
type: AnswerComment

http://stackoverflow.com/comment/40589010
score: 0
has text: grails.plugin.springsecurity.controllerAnnotations.staticRules = [ ..... '/MediaSenseEvents/SessionEvents': ['permitAll'], .... ] I have specified as follow but not authenticating. I get response un-authorized
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25928238

http://stackoverflow.com/a/25929047
downvote count: 0
type: Answer
has body: This could be explained if defVal is null. With ternary expressions, both options must be of exactly the same type and if not some coercion is applied: The JLS 15.25 "Conditional operator ? :" says: If one of the second and third operands is of primitive type T, and the type of the other is the result of applying boxing conversion (§5.1.7) to T, then the type of the conditional expression is T. In the case of this expression: val == null ? defVal : "true".equalsIgnoreCase(val) The Boolean value for defVal is auto-unboxed to match the boolean result of the string comparison. This is despite the fact that the result of the ternary is then auto-boxed back to a Boolean - when deciding how to cast, a ternary does not consider anything outside itself.
upvote count: 3
answers question: http://stackoverflow.com/q/25928896
score: 3

http://stackoverflow.com/comment/40515040
type: QuestionComment
has text: There is no "special" CSV format. It is only `CSV` or something other, `not-CSV`. You will have big troubles with strings inside file which should be correctly escaped.
comment on: http://stackoverflow.com/q/25887780
score: 0
type: Comment

http://stackoverflow.com/a/35317562
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/74512718
answers question: http://stackoverflow.com/q/25888817
downvote count: 0
has body: In my case, I needed to reuse the active Gatt connection in a new activity but wasn't able to and was constantly disconnecting with error 133. So, I resorted to calling BluetoothGatt.close() before startActivity(), and (re)connect in onStart(). If anyone has a better idea on how to keep the connection, please post.

http://stackoverflow.com/comment/40533282
comment on: http://stackoverflow.com/q/25897677
type: Comment
type: QuestionComment
has text: Can you post the stacktrace of the exception and add a note in the code telling us on which line it happens?
score: 3

http://stackoverflow.com/comment/40579225
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25921961
has text: >>you must have a mapping or something even before spring starts handling the request that returns 302. But how i can do that?

http://stackoverflow.com/a/25897926
has comment: http://stackoverflow.com/comment/40534347
has comment: http://stackoverflow.com/comment/40533987
has comment: http://stackoverflow.com/comment/40534122
has comment: http://stackoverflow.com/comment/40534321
has comment: http://stackoverflow.com/comment/40534771
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40533892
has comment: http://stackoverflow.com/comment/40533993
has comment: http://stackoverflow.com/comment/40535447
has comment: http://stackoverflow.com/comment/40535365
has comment: http://stackoverflow.com/comment/40534451
type: Answer
answers question: http://stackoverflow.com/q/25897841
has comment: http://stackoverflow.com/comment/40534815
accepted answer of: http://stackoverflow.com/q/25897841
upvote count: 2
has comment: http://stackoverflow.com/comment/40534608
has comment: http://stackoverflow.com/comment/40533983
has comment: http://stackoverflow.com/comment/40533964
has comment: http://stackoverflow.com/comment/40534937
has body: Try cleaning your project, this will rebuild your R file. If there is still no R file in your file-tree then you may have an error in one your xml layout files. Eclipse may not tell you this so be vigilant and check through all the files in the /res folder. Also, never import R when this happens.
has comment: http://stackoverflow.com/comment/40533771
has comment: http://stackoverflow.com/comment/40534836
score: 2

http://stackoverflow.com/q/25995084
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25995110
has title: Java returning int from ArrayList<Integer> method
tagged with: java
has answer: http://stackoverflow.com/a/25995101
has body: I've created a simple method that receives an ArrayList&lt;Integer&gt;, and then returns the average number as a double. The code: public static ArrayList&lt;Integer&gt; tempGsnitt(ArrayList&lt;Integer&gt; temperatur){ double sum = 0; for(int i = 1; i &lt; temperatur.size(); i++) sum += temperatur.get(i); sum = sum/temperatur.size(); return sum; } But i'm getting an error that the method expects an ArrayList to return. So my question is; How can i return an double from an ArrayList method?
has answer: http://stackoverflow.com/a/25995117
type: Question
downvote count: 4
tagged with: for-loop
has answer: http://stackoverflow.com/a/25995102
score: -2
has answer: http://stackoverflow.com/a/25995106
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40708812
favorite count: 0
tagged with: return
upvote count: 2
answer count: 5

http://stackoverflow.com/comment/40674935
type: Comment
type: QuestionComment
has text: Works for me. If you're using the sample on github, change the layout so that it only contains the ListView. No ScrollView or TextViews.
comment on: http://stackoverflow.com/q/25971653
score: 0

http://stackoverflow.com/comment/40611768
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25940720
has text: Yes it is depending on what is important in that you can use mockito to verify if a implementation was called or you can verify the object that it mutates.

saml
tags question: http://stackoverflow.com/q/25999429
type: Tag
tag name: saml
tags question: http://stackoverflow.com/q/25921840

http://stackoverflow.com/comment/63236412
has text: #2: Use the mediator the same way -- in fact, it will resemble the Composite Pattern a little. Just have everything constructed with a *director* -- even *sub-directors*. When a module calls `director.fire()` on a sub-director, that director calls `director.fire()` (global/high-level director). Nobody should care if their *director* is *globalDirector* or *subDirector* -- they just know it as "`director`".
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26019794
type: QuestionComment

http://stackoverflow.com/a/25899692
downvote count: 0
answers question: http://stackoverflow.com/q/25899324
has comment: http://stackoverflow.com/comment/40538629
upvote count: 2
has body: Use java NumberFormat class : import java.text.NumberFormat; import java.text.ParseException; public class Solution { public static void main(String[] args) throws ParseException{ String num = "80,00.34"; NumberFormat form = NumberFormat.getInstance(); System.out.println(form.parse(num).doubleValue()); } } This will work for all cases except for #6 which I don't think is any valid mathematical format. You can also get the NumberFormat instance according to your Locale by : NumberFormat form = NumberFormat.getInstance(Locale.UK);
type: Answer
score: 2

http://stackoverflow.com/comment/40698839
score: 1
comment on: http://stackoverflow.com/q/25983027
type: Comment
type: QuestionComment
has text: You aren't updating the progress. Use [`updateProgress()`](http://docs.oracle.com/javafx/2/api/javafx/concurrent/Task.html#updateProgress%28long,%20long%29) inside your call to update the progress

http://stackoverflow.com/q/25929112
has title: Extract Tags from a html file using Jsoup
type: Question
upvote count: 2
tagged with: jsoup
answer count: 1
tagged with: http://stackoverflow.com/tag/html
tagged with: parsing
favorite count: 0
has body: I am doing a structural analysis on web documents. For this i need to extract only the structure of a web document(only the tags). I found a html parser for java called Jsoup. But I don't know how to use it to extract tags. Example: &lt;html&gt; &lt;head&gt; this is head &lt;/head&gt; &lt;body&gt; this is body &lt;/body&gt; &lt;/html&gt; Output: html,head,head,body,body,html
has answer: http://stackoverflow.com/a/25929782
accepted answer: http://stackoverflow.com/a/25929782
has comment: http://stackoverflow.com/comment/40818720
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/40590477
has text: @SarahWeinberger Not sure which SWT version you're using, but it might be worth a try to use the [latest one](http://download.eclipse.org/eclipse/downloads/drops4/R-4.4-201406061215/#SWT) (if you aren't already).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25901117
score: 0

http://stackoverflow.com/comment/40678710
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25978052
has text: Be aware of the fact that not every editor will be associated with an actual file, or with only 1 file. Some editors can be working on either a) no file at all (a "logical" structure that is backed by something other than a file), or b) more than one file. @greg-449's answer handles those by just returning null; depending on your requirements you might have to do something else.
score: 0

http://stackoverflow.com/comment/41064526
type: Comment
has text: I have no idea what you changed from MimeMessage to MimeMultipart because those classes are in no way interchangable. But if you've got it working now that's great.
type: AnswerComment
comment on: http://stackoverflow.com/a/26110211
score: 0

http://stackoverflow.com/q/25964734
has body: For testing/benchmarking purposes, I want to write a Java program that does the following tasks in a loop: load data via HTTP GET from a server ( generate an answer based on the received data - not important at this point ) send the answer via HTTP POST to the same server This cycle runs on multiple threads at the same time. After having started, the program runs fine for a short period of time and is able to perform ~300 cycles per thread per second (the webserver runs on the same machine). But after 5-7 seconds, I'm getting BindException: Address already in use. Restarting the program after a 20-30 second cool-down time results in the same behavior; when I restart it immediately without waiting, it crashes immediately... so I suppose it could be a problem with bound resources. It's a quick and dirty approach using HttpURLConnection. The relevant parts: Getting data from the webserver public String fetchData() throws IOException { HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setUseCaches(false); conn.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); conn.disconnect(); return response.toString(); } Sending the answer public void sendData(byte[] data) throws IOException { HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setUseCaches(false); conn.setRequestMethod("POST"); conn.setDoOutput(true); OutputStream os = conn.getOutputStream(); os.write(data); os.close(); conn.disconnect(); } Calling both methods inside the thread @Override public void run() { while(true) { try { String data = fetchData(); String answer = // ... generating answer sendData(answer.getBytes("UTF-8")); } catch (IOException e) { // ... } } } There is not a single URL object that is shared between threads - every thread has its own URL instance…
tagged with: network-programming
has answer: http://stackoverflow.com/a/25965340
downvote count: 0
has answer: http://stackoverflow.com/a/26136835
linked to: http://stackoverflow.com/q/4851535
has answer: http://stackoverflow.com/a/26080172
has comment: http://stackoverflow.com/comment/40653563
has comment: http://stackoverflow.com/comment/40816329
favorite count: 0
score: 8
upvote count: 8
linked to: http://stackoverflow.com/q/4205210
has answer: http://stackoverflow.com/a/26117578
answer count: 5
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
has title: HttpURLConnection: BindException when creating many connections
has comment: http://stackoverflow.com/comment/40667026
has comment: http://stackoverflow.com/comment/40820565
tagged with: java
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/26139452

http://stackoverflow.com/comment/40601515
score: 0
has text: There is http://softwarerecs.stackexchange.com/ Another option is to rephrase your question so you are not asking for a library (although given your question, that might then be considered too broad).
type: Comment
comment on: http://stackoverflow.com/q/25930946
type: QuestionComment

http://stackoverflow.com/a/25906905
has comment: http://stackoverflow.com/comment/40562545
type: Answer
answers question: http://stackoverflow.com/q/25893567
upvote count: 2
downvote count: 2
score: 0
has body: Try @OneToMany(mappedBy = "parent", cascade={CascadeType.PERSIST}) private List&lt;Child&gt; childs = new ArrayList&lt;&gt;(); (see also JPA @ManyToOne with CascadeType.ALL for example)

http://stackoverflow.com/a/26013627
has comment: http://stackoverflow.com/comment/40760072
has comment: http://stackoverflow.com/comment/40755865
answers question: http://stackoverflow.com/q/26013411
has body: e.g. javadoc tells you how to run a runnable in a thread (third example in doc). You just give the Runnable to the Thread constructor and start the Thread. However, i would suggest to work on your java rudiments and read some literatur on game programming before spending to much time on a non-sense project (excuse me). edit: "non-sense project" seems to be, in fact, to be too offensive. What i meant, was, that you wont finish successfully if you dont understand the basics and your code/question tells me, you dont. I may be wrong however.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40929679
has comment: http://stackoverflow.com/comment/40910090

http://stackoverflow.com/a/25939020
type: Answer
has body: Just a hint won't be writing code for you until you show some more effort Implement you own Comparator and pass this as an argument to Collections.sort Another thing to consider make sure you don't do new Comparator as this will keep making new instances of you comparator. You want to make it singleton.
has comment: http://stackoverflow.com/comment/40608438
has comment: http://stackoverflow.com/comment/40608467
answers question: http://stackoverflow.com/q/25938973
score: 0

http://stackoverflow.com/q/26005924
has body: I am making an IoC Container in java, using reflection, to auto instantiate dependencies. I've got it working, recursively, but the instantiation is clumsy and not very intuitive. import java.lang.reflect.Constructor; import java.util.ArrayList; public class IoC { public void register(Object type) { } public Object resolve(String type) throws Exception { // Get class Class c = Class.forName(type); // Get class constructors Constructor[] constructors = c.getConstructors(); if (constructors.length &gt; 1) { throw new Exception(type + " has more than one constructor. Can't auto instantiate!"); } // The one constructor Constructor constructor = constructors[0]; // Get constructor parameter types Class[] parameters = constructor.getParameterTypes(); // ArrayList to hold dependencies Object[] dependencies = new Object[parameters.length]; if (parameters.length &gt; 0) { // Get dependencies recursively for (int i = 0; i &lt; parameters.length; i++) { dependencies[i] = resolve( parameters[i].getName() ); } } if(dependencies.length &gt; 4) { throw new Exception("Too many dependencies, consider refactoring!"); } else if(dependencies.length == 1) { return constructor.newInstance(dependencies[0]); } else if(dependencies.length == 2) { return constructor.newInstance(dependencies[0], dependencies[1]); } else if(dependencies.length == 3) { return constructor.newInstance(dependencies[0], dependencies[1], dependencies[2]); } else if(dependencies.length == 4) { return constructor.newInstance(dependencies[0], dependencies[1], dependencies[2], dependencies[3]); } return constructor.newInstance(); } } As you can see, what i'm doing, is checking the length of the dependencies array, and then passing in the corresponding number of arguments. So what i'm asking is, is there a way to just pass in the dependencies array when instantiating, and the array elements are automatically passed as separate arguments? Hope it makes sense :)
has answer: http://stackoverflow.com/a/26005975
tagged with: ioc-container
score: 0
has answer: http://stackoverflow.com/a/26006161
accepted answer: http://stackoverflow.com/a/26006161
answer count: 2
has title: instantiate object with array elements as parameters java
possible better answer: http://stackoverflow.com/a/26005975
type: AnsweredQuestion
tagged with: reflection
tagged with: java
type: Question
tagged with: instantiation

http://stackoverflow.com/q/25963157
accepted answer: http://stackoverflow.com/a/25963261
possible better answer: http://stackoverflow.com/a/25963352
has title: Is there a way to use Java generic types to write sorting algorithms?
tagged with: generics
type: AnsweredQuestion
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40650686
linked to: http://stackoverflow.com/q/2071929
has comment: http://stackoverflow.com/comment/40658794
type: Question
has body: I've been relearning Java after a long time, and I'm trying out writing some sorting algorithms. The (rather outdated) textbook I have uses the Comparable interface to sort objects. Since Comparables are now generic types, doing this gives me a lot of warnings about raw types when compiling. After some research, it looks like I can do something like, for example: public class Sorting { public static &lt;T extends Comparable&lt;T&gt;&gt; void quickSort(T[] list, int start, int end) { /*...*/ while((list[left].compareTo(list[pivot]) &lt; 0) &amp;&amp; (left != right)) // for example left++; /*...*/ } } The problem with this is that the naive way of calling this method does not work: public class SortingTest { public static void main(String[] args) { // Produces an error, cannot create arrays of generic types Comparable&lt;Integer&gt;[] list = new Comparable&lt;Integer&gt;[100]; /* fill the array somehow */ Sorting.quickSort(list, 0, 99); } } It is illegal to create an array of generic types in Java. The problem only gets worse if I try to implement a merge sort, since that requires creating arrays of Comparable types inside the merge sort method itself. Is there any way to handle this situation elegantly?
has answer: http://stackoverflow.com/a/25963261
tagged with: java
has comment: http://stackoverflow.com/comment/40650760
answer count: 2
has comment: http://stackoverflow.com/comment/40650631
downvote count: 0
has answer: http://stackoverflow.com/a/25963352
tagged with: sorting
favorite count: 0

http://stackoverflow.com/q/26017147
type: Question
tagged with: java
tagged with: aws-opsworks
score: 0
has answer: http://stackoverflow.com/a/26019606
answer count: 1
tagged with: amazon-web-services
type: UnansweredQuestion
has title: Opsworks Java Deploy Hooks
has body: I have my application currently deploying in AWS Opsworks via a mix of TeamCity and Gradle but I need to utilize the deploy hooks to performs some tasks such as Liquibase migrations, symlinks, etc. It appears I have Opsworks recognizing the proper RB files are there in the deploy folder but when it goes to run them, I get implicit type conversion errors for what appears to be missing attributes. I have tried manually adding these to the custom JSON as a workaround to no avail. Below is the error, the deploy JSON, and the param which seems to be causing issues. I am just wondering how to fill out the attribute value and get past the error. Thanks in advance. TypeError --------- no implicit conversion of nil into String Cookbook Trace: --------------- /var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:154:in `block (3 levels) in from_file' Resource Declaration: --------------------- # In /var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb 65: deploy deploy[:deploy_to] do 66: provider Chef::Provider::Deploy.const_get(deploy[:chef_provider]) 67: keep_releases deploy[:keep_releases] 68: repository deploy[:scm][:repository] 69: user deploy[:user] 70: group deploy[:group] 71: revision deploy[:scm][:revision] 72: migrate deploy[:migrate] 73: migration_command deploy[:migrate_command] 74: environment deploy[:environment].to_hash 75: create_dirs_before_symlink( deploy[:create_dirs_before_symlink] ) 76: symlink_before_migrate( deploy[:symlink_before_migrate] ) 77: action deploy[:action] 78: 79: if deploy[:application_type] == 'rails' &amp;&amp; node[:opsworks][:instance][:layers].include?('rails-app') 80: restart_command "sleep #{deploy[:sleep_before_restart]} &amp;&amp; #{node[:opsworks][:rails_stack][:restart_command]}" 81: end 82: The attribute which seems to be generating the issue: params {:deploy_data=&gt;{"deploy_to"=&gt;"/srv/www/deploy-name", (tons of skipped params) ..., :name=&gt;nil} Current JSON under …

http://stackoverflow.com/a/25947345
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25947298
has body: count+1 is an expression, resulting in a value, but not changing count. count++ also changes count itself.

http://stackoverflow.com/comment/40776471
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26031756
has text: thank you.it creates me 3 jars.can't we make a single jar or main and dependencies one jar and test cases other jar

variables
tag name: variables
tags question: http://stackoverflow.com/q/25966064
tags question: http://stackoverflow.com/q/25985933
tags question: http://stackoverflow.com/q/25973726
tags question: http://stackoverflow.com/q/25944063
tags question: http://stackoverflow.com/q/25900130
tags question: http://stackoverflow.com/q/25986177
type: Tag
tags question: http://stackoverflow.com/q/25880893
tags question: http://stackoverflow.com/q/25902853
tags question: http://stackoverflow.com/q/25944044
tags question: http://stackoverflow.com/q/25917372
tags question: http://stackoverflow.com/q/25982781
tags question: http://stackoverflow.com/q/25917534
tags question: http://stackoverflow.com/q/25961585

http://stackoverflow.com/comment/40609367
comment on: http://stackoverflow.com/q/25939129
score: 0
type: QuestionComment
type: Comment
has text: @MarsAtomic, you says to close connection, execute backup and after start connection again ?

http://stackoverflow.com/q/26014947
favorite count: 0
has answer: http://stackoverflow.com/a/26606629
type: UnansweredQuestion
has title: Add dependencies to jar Class-Path manifest
has body: When I try to add dependencies to jar manifest class-path it is throwing an exception: Use: gradle 2.1 build: apply plugin: 'java' jar { manifest { attributes 'Implementation-Title': 'Main', 'Implementation-Version': version, 'Main-Class': 'com.apl.Main', 'Class-Path': configurations.compile.collect { it.getName() }.join(' ') } } repositories { flatDir { dirs 'libs','test_libs' } } dependencies { compile name: 'bcmail-jdk16-dss' compile name: 'bcprov-jdk16-dss' compile name: 'bctsp-jdk16-dss' } Exception: Caused by: org.gradle.api.InvalidUserDataException: You can't change configuration 'compile' because it is already resolved! Can anyone help me resolve this issue please?
downvote count: 0
score: 1
tagged with: java
tagged with: gradle
tagged with: classpath
type: Question
upvote count: 1
answer count: 1
tagged with: dependencies
tagged with: build.gradle

http://stackoverflow.com/q/25940981
has comment: http://stackoverflow.com/comment/40612466
tagged with: jlist
answer count: 1
favorite count: 0
has title: Delete selected items from JList in Java
type: UnansweredQuestion
has body: How can I remove something I've selected in a Left list, to the Right list? I watched a tutorial in YouTube, where the guy did this code, but it's not looking nice. I mean, when I add something of the Left list to the Right list, I need to remove what was selected of the left list. button = new JButton("Move --&gt;"); button.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent event){ rightlist.setListData(leftlist.getSelectedValues()); } } ); So, this button puts what I selected in the left list, to the right list. But as I said, I want to remove the items that are selected from the left list. So it will only appear at the right list, and not in the left list. How can I do that?
downvote count: 1
has answer: http://stackoverflow.com/a/25941279
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40612394
type: Question
linked to: http://stackoverflow.com/q/9402658
has comment: http://stackoverflow.com/comment/40613141
upvote count: 0

http://stackoverflow.com/comment/40674147
has text: you parse json string, see above
type: AnswerComment
comment on: http://stackoverflow.com/a/25975822
type: Comment
score: 1

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/25893247
type: Tag

http://stackoverflow.com/comment/40780539
type: QuestionComment
comment on: http://stackoverflow.com/q/26033966
has text: Does it fire when you use the button to select a different file or is it just when you type in the text field?
score: 0
type: Comment

http://stackoverflow.com/comment/40643841
type: QuestionComment
has text: You want the list of only duplicate `Costomer`'s ??
score: 0
comment on: http://stackoverflow.com/q/25959662
type: Comment

http://stackoverflow.com/comment/40686510
score: 0
has text: Why do you need the value before hand? The old value will be passed to the tree cell editor and the new value will be passed back to the model
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25970137

http://stackoverflow.com/comment/115157789
has text: Hi @GowthamiReddy did you get a solution?
type: Comment
comment on: http://stackoverflow.com/a/39377905
score: 0
type: AnswerComment

http://stackoverflow.com/q/25914758
has comment: http://stackoverflow.com/comment/40570829
tagged with: knime
possible better answer: http://stackoverflow.com/a/25989533
type: Question
tagged with: java
tagged with: listcellrenderer
has body: I have a problem with node containing this column type: ListCell (Collection of: ListCell (Collection of: DoubleCell)) Data looks like this: [[-0.518, -1.431], [-1.431, -0.518]] Next node is Java Snippet. In input options, the only Java type option for this column is String, which is wrong as you can see: ERROR Java Snippet Execute failed: java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object; Is there any solution for this problem? Thanks for help.
score: 0
has answer: http://stackoverflow.com/a/26016888
answer count: 2
has title: KNIME - Java snippet - DoubleCell/Java type double []
tagged with: double
accepted answer: http://stackoverflow.com/a/26016888
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25989533
has comment: http://stackoverflow.com/comment/40571080

http://stackoverflow.com/comment/40718666
type: QuestionComment
score: 0
has text: From the stack trace, `javax.swing.JProgressBar cannot be cast to javax.swing.JMenuItem`, it seems that a brogress bas is in a menu? If so, does removing it from the menu help?
type: Comment
comment on: http://stackoverflow.com/q/26000242

http://stackoverflow.com/q/25917630
tagged with: listview
score: 0
possible better answer: http://stackoverflow.com/a/25917871
has body: i have a list view which contains 2 text views and 3 buttons, and i want to do something when click on one of thoses buttons but where to write OnclickListener of thoses buttons ?! my java class public class AdminGlossary extends ListActivity { // Progress Dialog private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jParser = new JSONParser(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; productsList; // url to get all products list private static String url_all_products = "http://www.lamia.byethost18.com/get_all_glossaries.php"; private static final String url_delete_product = "http://www.lamia.byethost18.com/delete_product.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_PRODUCTS = "products"; private static final String TAG_PID = "ID_glossary"; private static final String TAG_NAME = "name"; private static final String TAG_DES = "description"; private static final String TAG_CHA = "ID_chapter"; String pid="0"; // products JSONArray JSONArray products = null; JSONParser jsonParser = new JSONParser(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_admin_glossary); // Hashmap for ListView productsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Loading products in Background Thread new LoadAllProducts().execute(); // Get listview ListView lv = getListView(); // on seleting single product // launching Edit Product Screen /*lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // getting values from selected ListItem String pid = ((TextView) view.findViewById(R.id.pid)).getText() .toString(); // Starting new intent Intent in = new Intent(getApplicationContext(), EditProductActivity.class); // sending pid to next activity in.putExtra(TAG_PID, pid); // starting new activity and expecting some resp…
has answer: http://stackoverflow.com/a/25917871
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25917809
has comment: http://stackoverflow.com/comment/40569841
tagged with: android
has comment: http://stackoverflow.com/comment/40570036
has comment: http://stackoverflow.com/comment/40569718
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has title: Items inside a ListView - android
type: Question
accepted answer: http://stackoverflow.com/a/25917809
answer count: 2
has comment: http://stackoverflow.com/comment/40569659

http://stackoverflow.com/a/26022891
score: 13
answers question: http://stackoverflow.com/q/26022233
type: AcceptedAnswer
downvote count: 0
has body: Try this: import java.util.Scanner; class Easter { public static void main(String[] args) { System.out.print("Please enter a year to calculate Easter Sunday\n&gt;"); Scanner s = new Scanner(System.in); int inputted = getResult(s); while(inputted &lt;= 0) { System.out.print("Expected a positive year. Please try again:\n&gt;"); inputted = getResult(s); } System.out.println(getEasterSundayDate(inputted)); } private static int getResult(Scanner s) { while(!s.hasNextInt()) { System.out.print("Expected a valid year. Please try again:\n&gt;"); s.nextLine(); } return s.nextInt(); } public static String getEasterSundayDate(int year) { int a = year % 19, b = year / 100, c = year % 100, d = b / 4, e = b % 4, g = (8 * b + 13) / 25, h = (19 * a + b - d - g + 15) % 30, j = c / 4, k = c % 4, m = (a + 11 * h) / 319, r = (2 * e + 2 * j - k - h + m + 32) % 7, n = (h - m + r + 90) / 25, p = (h - m + r + n + 19) % 32; String result; switch(n) { case 1: result = "January "; break; case 2: result = "February "; break; case 3: result = "March "; break; case 4: result = "April "; break; case 5: result = "May "; break; case 6: result = "June "; break; case 7: result = "July "; break; case 8: result = "August "; break; case 9: result = "September "; break; case 10: result = "October "; break; case 11: result = "November "; break; case 12: result = "December "; break; default: result = "error"; } return result + p; } } An input of 2001 results in April 15 as the output.
has comment: http://stackoverflow.com/comment/42901824
type: Answer
upvote count: 13
accepted answer of: http://stackoverflow.com/q/26022233

http://stackoverflow.com/a/25881706
has body: Define it before the try catch: MyOwnObject deserializedObject = null; Inside the try/catch, make sure you remove the declaration, and change it to: deserializedObject = (MyOwnObject)ois.readObject();
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25881694
has comment: http://stackoverflow.com/comment/40505216
answers question: http://stackoverflow.com/q/25881694
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40504741
upvote count: 1
has comment: http://stackoverflow.com/comment/40504644

http://stackoverflow.com/comment/40490697
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25873636
score: 0
has text: You do understand that `h` and `H`, and `m` and `M` have a different meaning?

http://stackoverflow.com/comment/40736432
type: AnswerComment
score: 0
has text: check if no course. because course is not essential in this case.
type: Comment
comment on: http://stackoverflow.com/a/26009816

http://stackoverflow.com/comment/40575340
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25920330
type: QuestionComment
has text: I am not sure weather overload works 'through' classes or just in one.

http://stackoverflow.com/comment/40700781
type: QuestionComment
comment on: http://stackoverflow.com/q/25976791
score: 0
has text: Yes it's right , if I put a System.out.println(loadLogButton.getText()); in the chargeI18nValues function of the LoadLogController after the set, show me that the button change the text fine but it's not showed on the view. It's like the view is not refreshed...
type: Comment

http://stackoverflow.com/comment/40509417
score: 0
type: Comment
type: QuestionComment
has text: Sorry, I should have specified, I started a new IT position. I inherited a lot of problems from the last guy and this company only has one IT position to I can't ask anyone how this stuff works, normally not an issue but I am still working at 2am my time so I really don;t have time to dive that deep into every problem. My hope is that someone has seen this before and can point to a possible solution and save me a little time.
comment on: http://stackoverflow.com/q/25884487

http://stackoverflow.com/a/25984990
score: 0
has body: your code need lot of changes to make it work, first you need continuous loop which will run continuously and wait for the user input. Then you have to catch a InputMismathexeption if the input is other than integer, that you have to do in the beginning of the code. it is bad idea to supply the code, which will stop from you trying different ways. Still I am attaching the code. import java.util.InputMismatchException; import java.util.Scanner; public class Test { public static void main(String[] args) { System.out.println("My First Java program can do many things!"); System.out.println("1.Estimate population\n2.Generate random integer\n3. Print ASCII table\n4. Approximate pi by iteration"); System.out.println("What would you like to do? (1-4)"); System.out.print("Your choice: "); Scanner keyboard = new Scanner(System.in); while (true) { int input = 0; try { input = keyboard.nextInt(); } catch (InputMismatchException e) { System.out .println("Sorry, only integers allowed for this menu. Good-bye!"); System.exit(0); } switch (input) { case 1: System.out.println("You chose to estimate population."); break; case 2: System.out.println("You chose to generate random integer."); break; case 3: System.out.println("You chose to print ASCII table."); break; case 4: System.out.println("You chose to approximate pi by iteration."); break; } if (input &gt; 4 || input &lt; 1) { System.out .println("Sorry, I don't know what to do. Please try again."); } } } }
type: Answer
answers question: http://stackoverflow.com/q/25984140

http://stackoverflow.com/comment/40493094
has text: I gave the downvote. These methods will count the number of times the comma appears in the entire string, and will not tell you whether or not they appear consecutively. Please edit your answer to meet this requirement.
type: AnswerComment
comment on: http://stackoverflow.com/a/25875185
type: Comment
score: 2

http://stackoverflow.com/a/41318179
has body: Here is the solution to resolve the wrong ips issue of one of the above solutions private static List&lt;String&gt; ips = new ArrayList&lt;&gt;(); public static void main(String[] args) { Date d = new Date(); System.out.println(posIps("19216801")); System.out.println(new Date().getTime() - d.getTime()); } private static List&lt;String&gt; posIps(String number) { int l = number.length() - 3; for (int a = 0; a &lt; 3 &amp;&amp; a &lt; l; a++) { for (int b = 0; b &lt; 3 &amp;&amp; b &lt; l - a; b++) { for (int c = 0; c &lt; 3 &amp;&amp; c &lt; l - a - b; c++) { StringBuilder sb = new StringBuilder(number); if (Integer.parseInt(sb.substring(0, a + 1 )) &lt; 256 &amp;&amp; Integer.parseInt(sb.substring(a + 1, a + b + 2)) &lt; 256 &amp;&amp; Integer.parseInt(sb.substring(a + b + 2, a + b + c + 3)) &lt; 256 &amp;&amp; Integer.parseInt(sb.substring(a + b + c + 3)) &lt; 256) { sb.insert(a + 1, "."); sb.insert(a + b + 3, "."); sb.insert(a + b + c + 5, "."); ips.add(sb.toString()); } } } } return ips; }
answers question: http://stackoverflow.com/q/25884250
type: Answer
score: 0

http://stackoverflow.com/comment/40704084
type: QuestionComment
type: Comment
score: 2
has text: Do the same for existing answer.
comment on: http://stackoverflow.com/q/25992635

http://stackoverflow.com/comment/40721692
type: AnswerComment
score: 0
type: Comment
has text: But now I have another problem. in this program,the number of JTable columns will be determined by user. so when I'm designing the report using iReport-5.6.0, I don't know how may fields must be added. (one field is needed for each column.) any idea?
comment on: http://stackoverflow.com/a/25984779

http://stackoverflow.com/a/25978041
downvote count: 0
answers question: http://stackoverflow.com/q/25977858
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25977858
type: Answer
score: 3
upvote count: 3
has body: Your printing occurs after the recursion. Using (25, 2) as an example, the order of your calls with printing looks like decToBin(25, 2): decToBin(12,2): decToBin(6,2): decToBin(3,2): decToBin(1,2): decToBin(0,2): print(0) print(1%2) print(3%2) print(6%2) print(12%2) print(25%2) Removing the recursive calls and just leaving the print statements shows the order you are getting: decToBin(25, 2): print(0) print(1%2) print(3%2) print(6%2) print(12%2) print(25%2) If you want the printing to be in the reverse order, move the print statement before the recursive call: public static void decToBin(int num, int base) { if (num == 0) { System.out.print(0); } else if (num &gt; 0) { System.out.print(num % base); decToBin(num / base, base); } } New recursion with printing: decToBin(25, 2): print(25%2) decToBin(12,2): print(12%2) decToBin(6,2): print(6%2) decToBin(3,2): print(3%2) decToBin(1,2): print(1%2) decToBin(0,2): print(0) New output: decToBin(25, 2): print(25%2) print(12%2) print(6%2) print(3%2) print(1%2) print(0)

http://stackoverflow.com/q/25944300
tagged with: methods
tagged with: arrays
type: UnansweredQuestion
has body: For example, I want to create an array that have pointers to call a method. This is what I'm trying to say: import java.util.Scanner; public class BlankSlate { public static void main(String[] args) { Scanner kb = new Scanner(System.in); System.out.println("Enter a number."); int k = kb.nextInt(); Array[] = //Each section will call a method }; Array[1] = number(); if (k==1){ Array[1]; //calls the method } } private static void number(){ System.out.println("You have called this method through an array"); } } I'm sorry if I'm not being descriptive enough or if my formatting is wrong. Thank you for your inputs.
has answer: http://stackoverflow.com/a/25944938
score: 3
has title: Can I call a method through an array?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25944346
type: Question
has answer: http://stackoverflow.com/a/25944670
has comment: http://stackoverflow.com/comment/40618100
tagged with: call
upvote count: 3
tagged with: java
answer count: 3

http://stackoverflow.com/a/30199085
answers question: http://stackoverflow.com/q/25919428
upvote count: 1
has body: To answer the question directly... Sure, you just need to scan for ClassGenerator and generate the missing class. Here's a basic working processor: @SupportedAnnotationTypes("ClassGenerator") @SupportedSourceVersion(SourceVersion.RELEASE_6) public class BaseClassProcessor extends AbstractProcessor { private Elements elements; @Override public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); elements = processingEnv.getElementUtils(); } @Override public boolean process(Set&lt;? extends TypeElement&gt; annotations, RoundEnvironment roundEnv) { for (Element element : roundEnv.getElementsAnnotatedWith(ClassGenerator.class)) { TypeMirror mirror = ((TypeElement) element).getSuperclass(); PackageElement pacakgeElement = elements.getPackageOf(element); String packageName = pacakgeElement.getQualifiedName().toString(); String superClassName = ((DeclaredType) mirror).asElement().getSimpleName().toString(); try { Writer file = processingEnv.getFiler().createSourceFile(packageName + "." + superClassName).openWriter(); file.write(String.format("package %s; public class %s {}", packageName, superClassName)); file.flush(); file.close(); } catch (IOException ex) { Logger.getLogger(BaseClassProcessor.class.getName()).log(Level.SEVERE, null, ex); } } return true; } } As for whether this pattern is advisable or best, you'd have to analyze your requirements and determine if this satisfies your needs.
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/25887346
has comment: http://stackoverflow.com/comment/40524020
has comment: http://stackoverflow.com/comment/40522542
score: 0
tagged with: java
has title: NoSuchMethodException: org.springframework.social.facebook.connect.FacebookConnectionFactory.<init>() in Social Spring
has comment: http://stackoverflow.com/comment/40522599
tagged with: spring-social
has comment: http://stackoverflow.com/comment/40523216
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40523542
has comment: http://stackoverflow.com/comment/40522181
has comment: http://stackoverflow.com/comment/40522936
has comment: http://stackoverflow.com/comment/40521524
has comment: http://stackoverflow.com/comment/40523093
has comment: http://stackoverflow.com/comment/40545586
has comment: http://stackoverflow.com/comment/40523820
type: Question
tagged with: facebook
has body: I am Trying to Configure Spring-Social into the XML file into my spring framework but i am getting this exception. and i am getting NoSuchmethod error while i have loaded all the class and i am trying to configure it to the xml so i can prevent this errors so please can anybody give me suggestion for the same. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactoryRegistry' defined in ServletContext resource [/WEB-INF/BookServletmvc-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.social.facebook.connect.FacebookConnectionFactory]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.social.facebook.connect.FacebookConnectionFactory.<init>() Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.social.facebook.connect.FacebookConnectionFactory]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.social.facebook.connect.FacebookConnectionFactory.<init>() at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:83) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1030) ... 49 more Caused by: java.lang.NoSuchMethodException: org.springframework.social.facebook.connect.FacebookConnectionFactory.<init>() at java.lang.Class.getConstructor0(Class.java:2849) at java.lang.Class.getDeclaredConstructor(Class.java:2053) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:78) ... 50 more java.lang.NoSuchMethodException: org.springframework.social.facebook.connect.FacebookConnectionFactory.<init>() at java.lang.Class.getConstructor0(Cla…
tagged with: spring
has comment: http://stackoverflow.com/comment/40522447
tagged with: spring-mvc

http://stackoverflow.com/q/25899149
type: Question
tagged with: jar
score: 0
answer count: 1
tagged with: path
has answer: http://stackoverflow.com/a/25901979
accepted answer: http://stackoverflow.com/a/25901979
type: AnsweredQuestion
tagged with: java
tagged with: ivy
linked to: http://stackoverflow.com/q/11612549
tagged with: eclipse
has body: I have a java project in eclipse and I'm using ivy dependency manager outside of eclipse, so I have directory structures full of various jar files. Is there a simple way to point my eclipse project's path to the ivy dirs and pick up all the jars? I'm trying to avoid pulling out each individual jar into my eclipse project directory and hope there's a better way.
has title: Including jars in project path from ivy in Eclipse

http://stackoverflow.com/comment/40524203
score: 1
has text: If I have several queries, I prefer to store mine in an XML Properties file, and read them in with a Properties object. When you wrap the value contents with a CDATA block, formatting is exactly preserved.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25892850

http://stackoverflow.com/comment/121994657
type: QuestionComment
comment on: http://stackoverflow.com/q/25893476
has text: [Depends on how you are creating session object ,see this answer here](https://stackoverflow.com/a/45733794/11775515) [Also check this ](https://stackoverflow.com/q/64527494/11775515)
score: 0
type: Comment

http://stackoverflow.com/a/26013300
score: 1
type: Answer
upvote count: 1
has body: Try this solution for your problem. import java.util.*; class Hello { public static void main(String[] args) { int[] arr = {5, 2, 7, 2, 4, 7, 8, 2, 3}; Set&lt;Integer&gt; set = new HashSet&lt;Integer&gt;(); for(int i = 0; i &lt; arr.length; i++){ set.add(arr[i]); } //now if you will iterate through this set, it will contain only unique values. Iterator it = set.iterator(); while(it.hasNext()) { System.out.println(it.next()); } } }
answers question: http://stackoverflow.com/q/26012942
downvote count: 0

http://stackoverflow.com/q/25972910
has comment: http://stackoverflow.com/comment/40668022
has comment: http://stackoverflow.com/comment/40668230
favorite count: 0
score: 41
tagged with: extract
accepted answer: http://stackoverflow.com/a/25973296
has answer: http://stackoverflow.com/a/78434342
possible better answer: http://stackoverflow.com/a/25973035
type: AnsweredQuestion
tagged with: java
tagged with: archive
has answer: http://stackoverflow.com/a/25973296
has body: I have .class and .java files in JAR archive. Is there any way to extract only .java files from it? I've tried this command but it doesn't work: jar xf jar-file.jar *.java
type: Question
has title: JAR - extracting specific files
upvote count: 41
tagged with: jar
downvote count: 0
has answer: http://stackoverflow.com/a/25973035
has comment: http://stackoverflow.com/comment/40668123
answer count: 3

http://stackoverflow.com/a/26001004
downvote count: 0
answers question: http://stackoverflow.com/q/26000758
type: Answer
has body: Instead of creating an array and then creating a list, create the list directly from your values: List&lt;Integer&gt; paco = Arrays.asList(1, 2, 3, 4, 5, 5); Set&lt;Integer&gt; set = new HashSet&lt;Integer&gt;(paco); The other problem was that you weren't saving the return value of Arrays.asList anywhere. If you just try to do Arrays.asList(paco) on an int[], it will return a List&lt;int[]&gt; (a list of int arrays) with a single element. That cannot be used to initialize a set. If you really want to also have an array of the values in addition to the set, you can declare them as Integer rather than int, which will cause them to be boxed and then Arrays.asList will create a List&lt;Integer&gt; from them, instead of a List&lt;int[]&gt;: Integer[] paco = { 1, 2, 3, 4, 5, 5 }; Set&lt;Integer&gt; set = new HashSet&lt;Integer&gt;(Arrays.asList(paco)); If you need to convert an int[] into an Integer[] it can be done with ArrayUtils from Apache Commons in the following way: Integer[] boxedArray = ArrayUtils.toObject(primitiveArray); Thanks to Tomek for the tip.
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/40737861
has comment: http://stackoverflow.com/comment/40721839

http://stackoverflow.com/comment/40494458
has text: Yes. You can do that but how do you convert LKJS987SLKJS987HSUS98789HSUHSUSH back to C:\imagens\image.jpg. It must be two-way conversion.
comment on: http://stackoverflow.com/a/25876040
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/25934663
possible better answer: http://stackoverflow.com/a/25934747
type: AnsweredQuestion
tagged with: oop
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40600335
upvote count: 1
has answer: http://stackoverflow.com/a/25934769
has comment: http://stackoverflow.com/comment/40600224
type: Question
has comment: http://stackoverflow.com/comment/40600268
accepted answer: http://stackoverflow.com/a/25934887
has comment: http://stackoverflow.com/comment/40600282
has answer: http://stackoverflow.com/a/25934867
answer count: 6
has body: I was reviewing my OOP and I have a little question about objects. Well I have a super class Ship which is also an abstract class. Ship has some subclasses namely Submarine, Destroyer and so on. I know I cannot create an object of the Ship class because it's abstract. But why does the following still work? Ship s1 = new Submarine("ship 1");
tagged with: abstract
downvote count: 0
linked to: http://stackoverflow.com/q/4321386
favorite count: 0
has answer: http://stackoverflow.com/a/25934810
has answer: http://stackoverflow.com/a/25934747
has title: Creating Object for abstract class
has answer: http://stackoverflow.com/a/25934887
has comment: http://stackoverflow.com/comment/40600246
has answer: http://stackoverflow.com/a/25934772

http://stackoverflow.com/comment/93167523
type: Comment
comment on: http://stackoverflow.com/a/26147788
has text: @OrangeDog Precedence != priority
score: 4
type: AnswerComment

http://stackoverflow.com/q/25914643
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40563870
has answer: http://stackoverflow.com/a/25914746
downvote count: 6
has body: when i compile my program i receive this error: String cannot be converted to String[] my program is in 2 classes: main: import java.util.*; import java.math.*; public class esa{ public static void main(String[]args){ int [] numeri= new int[4]; String [] text =new String[4]; for(int i=0;i&lt;4;i++){ text[i] = args[i]; System.out.println(text[i]); } text=est.conv(text); } } import java.util.*; import java.math.*; public class est{ public static String conv(String [] valori){ } }
score: -6
tagged with: java
type: Question
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40563868
has comment: http://stackoverflow.com/comment/40563801
has comment: http://stackoverflow.com/comment/40563899
has title: String cannot be converted to String[]

wildcard-expansion
type: Tag
tag name: wildcard-expansion
tags question: http://stackoverflow.com/q/25948706

http://stackoverflow.com/comment/43657536
comment on: http://stackoverflow.com/a/25997646
type: Comment
score: 1
has text: 2.10.1 is available and seems to fix this problem.
type: AnswerComment

http://stackoverflow.com/a/25882264
downvote count: 0
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/25882094
has comment: http://stackoverflow.com/comment/131719044
type: Answer
has body: To add to Jason's answer, if you're going to use num.doubleValue() then don't use == since it doesn't handle edge cases like when the double value is NaN or Infinity. Please use Double.compare(num.doubleValue(), 0.0);.

http://stackoverflow.com/comment/40489657
type: QuestionComment
comment on: http://stackoverflow.com/q/25873692
has text: What is the output you are expecting? The digit in between the square brackets? The `param[digit]` idiom? Note that your `.` should be double-escaped in the `Pattern`.
score: 0
type: Comment

http://stackoverflow.com/a/25961340
has comment: http://stackoverflow.com/comment/40648308
has comment: http://stackoverflow.com/comment/40647094
has body: Quick solution: public static double getSalary(double rate, double hours, String status) { if(status.equalsIgnoreCase("o") &amp;&amp; hours &gt; 40) return 40 * rate + (1.5 * rate) * (hours-40); return rate * hours; }
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40647124
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40647616
answers question: http://stackoverflow.com/q/25961279
has comment: http://stackoverflow.com/comment/40647143

http://stackoverflow.com/comment/40616870
type: QuestionComment
comment on: http://stackoverflow.com/q/25943522
score: 0
type: Comment
has text: Yes. Good point. The order of removal is right to left. so abbccbd should remove all three bs giving (ad)

http://stackoverflow.com/a/26003947
has comment: http://stackoverflow.com/comment/40725647
answers question: http://stackoverflow.com/q/26003927
upvote count: 1
has comment: http://stackoverflow.com/comment/40725431
downvote count: 0
has comment: http://stackoverflow.com/comment/40725611
score: 1
has comment: http://stackoverflow.com/comment/40725386
has body: You ask: so how come it's actually assigned to the variable name? It's not, you're assigning nothing currently to any variable at present. In particular, you're not assigning anything within your constructor, although you may be fooled into thinking that you are due to that println in the constructor. Solve this by first giving Puppy a name field, and then by making an assignment to that name field from the parameter in the constructor public class Puppy { // give Puppy a name field private String name; public Puppy(String name) { // assign the field in the constructor this.name = name; } //.... getters and setters go here public String getName() { return name; } // you can do the setter method... Also, you'll want to remove the System.out.println(...) from within the Puppy constructor as it doesn't belong there, unless it's there only to test the code, with plan to remove it later. The println statement should be in the main method: public static void main(String []args){ // Following statement would create an object myPuppy Puppy myPuppy = new Puppy( "tommy" ); System.out.println("myPuppy's name: " + myPuppy.getName()); } You asked: But it said passed name is NAME. But nothing is assigned to name, so how did name turned into tommy? name is a String variable, and in your code its a specialized type of variable, a parameter. In the println statement it holds the value "tommy" because you passed that into the constructor when you called it, so the output will be "Name is tommy". Again this is because the name variable holds the value "tommy". The variable name will not be displayed and almost doesn't even exist in compiled code.
has comment: http://stackoverflow.com/comment/40725411
type: Answer
has comment: http://stackoverflow.com/comment/40725457
has comment: http://stackoverflow.com/comment/40725514

http://stackoverflow.com/comment/40742355
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26012866
has text: The exception implies you do not have row 2.That's why it returning null so nullpointerexception.

http://stackoverflow.com/comment/40802391
has text: I wish I can change it. But I just have to deal with it :-(. Any work around? Here is the [detailed question](http://stackoverflow.com/questions/26046275/hibernate-mapping-joining-two-tables-with-an-association-table-but-with-a-tw)
type: Comment
comment on: http://stackoverflow.com/a/26028080
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40666829
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25971691
type: AnswerComment
has text: I edited as per your code but happens same as previous

http://stackoverflow.com/comment/40751527
has text: How do you express it using XML Schema? Write this, compile with xjc, and that will be the answer.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26014358

http://stackoverflow.com/a/25990035
score: 0
has body: If you really need do this that way (with regex &amp; array as output) write code like this: public class StringResolve { public static void main(String[] args) { try { // read data from some source URL exampleTxt = StringResolve.class.getClassLoader().getResource("me/markoutte/sandbox/_25989334/example.txt"); Path path = Paths.get(exampleTxt.toURI()); List&lt;String&gt; strings = Files.readAllLines(path, Charset.forName("UTF8")); // init all my patterns &amp; arrays Pattern ham = getPatternFor("ham"); List&lt;String&gt; hams = new LinkedList&lt;&gt;(); Pattern spam = getPatternFor("spam"); List&lt;String&gt; spams = new LinkedList&lt;&gt;(); // check all of them for (String string : strings) { Matcher hamMatcher = ham.matcher(string); if (hamMatcher.matches()) { // we choose only text without label here hams.add(hamMatcher.group(1)); } Matcher spamMatcher = spam.matcher(string); if (spamMatcher.matches()) { // we choose only text without label here spams.add(spamMatcher.group(1)); } } // output data through arrays String[] hamArray = hams.toArray(new String[hams.size()]); System.out.println("Ham array"); for (String s : hamArray) { System.out.println(s); } System.out.println(); String[] spamArray = spams.toArray(new String[spams.size()]); System.out.println("Spam array"); for (String s : spamArray) { System.out.println(s); } } catch (URISyntaxException | IOException e) { e.printStackTrace(); } } private static Pattern getPatternFor(String label) { // Regex pattern for string with same kind: some text [label] return Pattern.compile(String.format("(.+?)\\s(\\[%s\\])", label)); } } You can use Paths.get("some/path/to/file") if you need to read it from somewhere in your drive.
answers question: http://stackoverflow.com/q/25989334
type: Answer

http://stackoverflow.com/a/26003616
has comment: http://stackoverflow.com/comment/40724492
has comment: http://stackoverflow.com/comment/40724571
type: Answer
has body: uh... print whitespace. System.out.print(x); for(j = 2; j &lt;= width-1; j++) { System.out.print(" "); } System.out.print(x);
has comment: http://stackoverflow.com/comment/40724463
upvote count: 1
answers question: http://stackoverflow.com/q/26003580
has comment: http://stackoverflow.com/comment/40724437
downvote count: 0
score: 1

http://stackoverflow.com/a/25995005
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25994505
accepted answer of: http://stackoverflow.com/q/25994505
has comment: http://stackoverflow.com/comment/40708487
upvote count: 1
score: 1
has body: Probably: res.getLocation().toOSString(); The location should always be absolute so no need to call makeAbsolute (although it will not cost much when the path is already absolute). Use toOSString() to get the path in the format used by the OS (so \ on Windows, / on Mac, Linux). You can also use toPortableString() to get a standard format path which is useful for data interchange but is not suitable for use with File.
type: AcceptedAnswer

http://stackoverflow.com/comment/40658183
score: 1
has text: `for` loops (among other branching constructs) often use `{ }` braces for clarity, correctness, or necessity. But they are not strictly required when used with a _single_ statement line.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25967177

http://stackoverflow.com/q/25947680
type: Question
score: 1
tagged with: java
tagged with: bufferunderflowexception
tagged with: int
tagged with: arrays
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40622919
tagged with: bytebuffer
favorite count: 0
has body: I came across a problem when sending data over TCP with a custom protocol which relies on knowing the length of data so I decided that I could not send an int due to the size of the int could be different lengths (the int 10 has a length of 2 whereas the int 100 has a length of 3) so I decided to send a 4 byte representation of the int instead and thus I came across ByteBuffer. With the following example I get a BufferUnderflowException try { int send = 2147483642; byte[] bytes = ByteBuffer.allocate(4).putInt(send).array(); // gets [127, -1, -1, -6] int recieve = ByteBuffer.allocate(4).put(bytes).getInt(); // expected 2147483642; throws BufferUnderflowException if (send == recieve) { System.out.println("WOOHOO"); } } catch (BufferUnderflowException bufe) { bufe.printStackTrace(); }
type: AnsweredQuestion
has title: ByteBuffer causing underflow exception
has answer: http://stackoverflow.com/a/25947779
accepted answer: http://stackoverflow.com/a/25947779
upvote count: 1

http://stackoverflow.com/comment/40604582
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25931750
has text: If you are connecting through a tunnel, then it is the server side of that tunnel that is effectively doing the request to your server. THAT is the reason you are getting the local ip.

http://stackoverflow.com/comment/40596978
score: 0
type: AnswerComment
type: Comment
has text: Might be worth mentioning the spam implications of this code, in case anyone else thinks its a good idea (its certainly **NOT**)
comment on: http://stackoverflow.com/a/25932608

http://stackoverflow.com/q/25883866
type: UnansweredQuestion
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40510769
has title: When I Click the Run Button, Apps Stops running with an error- Android App
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/40509044
has comment: http://stackoverflow.com/comment/40508720
has comment: http://stackoverflow.com/comment/40508719
has comment: http://stackoverflow.com/comment/40509022
type: Question
linked to: http://stackoverflow.com/q/23353173
tagged with: mobile
has comment: http://stackoverflow.com/comment/40509101
has body: I am programming a mortgage calculator app. I thought I have finished the app and it should work now. However every time I click the button "Calculate Monthly Payment", the app stops and exit immediately with the error message "Unfortunately, your app has stopped". Here is my code fragment for the MainActivity.java: public class MainActivity extends ActionBarActivity { Button button; EditText borrowedAmt; SeekBar interestRate; RadioGroup loanTerm; RadioButton termChosen; CheckBox taxAndInsur; TextView monthlyPay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); borrowedAmt = (EditText) findViewById(R.id.editText1); loanTerm = (RadioGroup) findViewById(R.id.radioGroup1); monthlyPay = (TextView) findViewById(R.id.textView4); taxAndInsur = (CheckBox) findViewById(R.id.checkBox1); interestRate = (SeekBar) findViewById(R.id.seekBar1); button = (Button) findViewById(R.id.button1); // SeekBar interestRate.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { int progressChanged = 0; public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { progressChanged = progress; } public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } public void onStopTrackingTouch(SeekBar seekBar) { Toast.makeText(MainActivity.this,"Rate chosen = " + progressChanged, Toast.LENGTH_SHORT).show(); } }); //Button button.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { double borrowedAmtValue = 0.0; double rateValue = 0.0; int noOfLoanMonth = 0; double taxAndInsurValue = 0.0; double monthlyPayValue = 0.0; // Borrowed amount processing borrowedAmtValue = Double.parseDouble(borrowedAmt.getText().toString()); // Interest Rate processing rateValue = interestRate.getProgress() / 1200; // Loan Term processing int[] termGroup = {180, 240, 360}; int selectedTerm = loanTerm.getCheckedRadioButtonId(); noOfLoanMonth = termGroup[select…
score: -2
answer count: 2
has comment: http://stackoverflow.com/comment/40508110
upvote count: 0
has comment: http://stackoverflow.com/comment/40508442
has answer: http://stackoverflow.com/a/25883975
has answer: http://stackoverflow.com/a/25883938
favorite count: 0

http://stackoverflow.com/comment/40594524
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25931305
score: 0
has text: You were close: http://developer.android.com/reference/android/text/Html.html#fromHtml(java.lang.String) is what you probably want.

http://stackoverflow.com/a/25950665
answers question: http://stackoverflow.com/q/25950557
type: AcceptedAnswer
downvote count: 0
has body: The setData(Object) and setData(String, Object) methods are used to add additional data to a Widget. This data can later be accessed. Examples for this use are if you want to identify the widget later on or if you need this additional information someplace else. The setControl(Control) method assigns the content to the item. This means if you call item.setControl(myContent), this myContent will be shown if item is selected by the user. Example answers that suggest using setData(): Swt combobox name/key pair How to attach data to TreeItem in SWT/Java? HTML "getElementByID" implementation for SWT widget
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/25950557
upvote count: 3

http://stackoverflow.com/comment/40732417
has text: okay and if I want to show the first three colors as RGB, would I just put system.out.print("The RGB is")?
comment on: http://stackoverflow.com/a/26007810
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40658758
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25935099
has text: I dont really understand. You want to get information from node, many time ( you already did the code) and you want to send data to node as answer (you already did it with socket.emit and socket.send)

http://stackoverflow.com/comment/40641545
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25926860
type: Comment
has text: The problem was with creating server, I didnt set certificate for it, cause I though certificate is nessecary just for implicit connection, but I was wrong

http://stackoverflow.com/comment/40698692
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25989413
has text: thanks. I was having problem in pasting the code. posted first time

http://stackoverflow.com/a/26070482
answers question: http://stackoverflow.com/q/25973034
score: 0
has body: Try this.^_^ public void newListView(){ listAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1,listView2); listView1.setAdapter(listAdapter); } listView2[0] = "zz"; newListView();
type: Answer

http://stackoverflow.com/q/25882719
downvote count: 0
tagged with: java
has title: java.lang.NoSuchMethodError in Genexus
has answer: http://stackoverflow.com/a/28114987
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25883268
has answer: http://stackoverflow.com/a/45375537
has body: I am using GeneXus Evolution 2 for my project. While I was developing, I got the following error: HTTPステータス 500 -java.lang.NoSuchMethodError:com.genexus.ModelContext.server2webcli(Ljava/util/Date;)Ljava/util/Date; I don't know what it is and how to solve this. Any ideas?
tagged with: genexus
has answer: http://stackoverflow.com/a/26180125
upvote count: 2
type: UnansweredQuestion
answer count: 4
score: 2

http://stackoverflow.com/q/25906274
score: 0
has comment: http://stackoverflow.com/comment/40560523
answer count: 1
tagged with: owl
has answer: http://stackoverflow.com/a/25920226
has body: I have created an ontology in protege and want to display the values of object properties and save the values in an array so that i can use the value to perform reasoning .The problem is i am not able to retrieve the datatype values only the domain and range are being displayed ,but no errors are there please help to find the solution import java.io.IOException; import com.hp.hpl.jena.ontology.DatatypeProperty; import com.hp.hpl.jena.ontology.EnumeratedClass; import com.hp.hpl.jena.ontology.Individual; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.util.FileManager; import com.hp.hpl.jena.util.iterator.ExtendedIterator; public class GetStartedSemWeb { static String defaultNameSpace ="http://semanticweb.org/ontologies#"; Model schema = null; public static void main(String[] args) throws IOException { GetStartedSemWeb getsemweb = new GetStartedSemWeb(); System.out.println(" Adding student ontology "); getsemweb.loadontology(); } private void loadontology() throws IOException { schema = ModelFactory.createOntologyModel(); java.io.InputStream inschema = FileManager.get().open("C:/Users/Desktop/Documents/Extracting knowledge from ontology using jena/getstarted.owl"); schema.read(inschema,defaultNameSpace); System.out.println("new ontology added"); ExtendedIterator it = ((OntModel) schema).listClasses(); while(it.hasNext()) { OntClass cls= (OntClass)it.next(); System.out.println("URI of classes of Merged University Ontology are "+cls.getURI()); ExtendedIterator pinstance = ((OntClass)cls).listInstances(); while(pinstance.hasNext()) { Individual pinstance1= (Individual)pinstance.next(); System.out.println("Individual of " +cls.getLocalName() + pinstance1.getLocalName()); ExtendedIterator dp = ((OntModel) schema).listDatatypeProperties(); while…
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: jena
has title: display datatype properties values for the ontology created in protege in jena
tagged with: protege

http://stackoverflow.com/comment/40597913
has text: That code looks like an example from C#, uppercase first letter and the use of `var` to lazy type a variable. If that is an example from C#, the solution is to replace `var` with the correct type for each attribute.
score: 1
comment on: http://stackoverflow.com/q/25933059
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40584886
comment on: http://stackoverflow.com/a/25902121
score: 0
type: AnswerComment
has text: I've accepted this answer not because it has solved my problem (it's still unsolved). But because you gave some hints to solve it. It still looks like a haiku to me. I am asking: should I add more salt for the recipe to work and the master replies : it depends on the state of the quarks at the subatomic level. No offense though. Too much abstract for my current state of hurry.
type: Comment

http://stackoverflow.com/a/26003683
answers question: http://stackoverflow.com/q/26003580
score: 0
has comment: http://stackoverflow.com/comment/40724629
type: Answer
has body: for(int i=0;i&lt;width;i++){ System.out.println(x); } for(int i=0;i&lt;height;i++){ System.out.println(x); for(int j=0;j&lt;width-2;j++){ System.out.println(" "); } System.out.println(x); } for(int i=0;i&lt;width;i++){ System.out.println(x); }

http://stackoverflow.com/q/25983839
tagged with: jpa
has answer: http://stackoverflow.com/a/25997836
tagged with: mappedsuperclass
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25997836
has title: JPA inheritance - how to select 3 entities of each child type?
type: Question
possible better answer: http://stackoverflow.com/a/25991782
has answer: http://stackoverflow.com/a/25991782
tagged with: java
tagged with: hibernate
score: 0
answer count: 2
has body: If you have this type of a JPA entity setup with a super class and a few child classes (see below), how do you write a JPA Query that would select say first 3 (ordered by created date) of each child class? Writing two separate queries and asking for specific subclass works fine, but I'd like to get it down to one query if possible. @MappedSuperclass public class Parent { @Temporal(TIMESTAMP) @Column(name = "created") private Date created; ... } @Entity @DiscriminatorValue("A") public class ChildA extends Parent { ... } @Entity @DiscriminatorValue("B") public class ChildB extends Parent { ... }

http://stackoverflow.com/comment/40762706
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26023997
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61856/discussion-between-kick-buttowski-and-user1356042).

http://stackoverflow.com/comment/40603002
score: 0
type: Comment
has text: @VrijendraKumarSingh Just check minor update. I accidentally put `ht.put` outside the `if` statement, which is unnecessary.
comment on: http://stackoverflow.com/a/25935570
type: AnswerComment

http://stackoverflow.com/q/25882232
has comment: http://stackoverflow.com/comment/40505895
type: Question
has body: I am adding few item on finalMapNode using map for creating json for d3. and i dont want any duplicates item. how to check.finalmapNode put the duplicates item on map.I dont want duplicated item.if item is avalible then it should not put on map . if id is avalable then item should not put in the finalmapnode. Note::if id is avalable then item should not put in the finalmapnode. List&lt;Map&lt;String, Object&gt;&gt; listNodeMap = new ArrayList&lt;Map&lt;String, Object&gt;&gt;(); Map&lt;String, Object&gt; finalMapNode2 = new TreeMap&lt;String, Object&gt;(); Map&lt;String, Object&gt; finalMapNode = new TreeMap&lt;String, Object&gt;(); //if id is avalable then item should not put in the finalmapnode. finalMapNode.put("id", Integer.parseInt(source2.get(z))+""); finalMapNode.put("name",source.get(z)); finalMapNode.put("displayname", source.get(z)); finalMapNode.put("image", "/xxxxx/resources/icon/location.png"); finalMapNode.put("type", "location"); finalMapNode.put("group", 0); finalMapNode.put("opacity", 100); finalMapNode2.put("id", Integer.parseInt(target2.get(z))+""); finalMapNode2.put("name",target.get(z)); finalMapNode2.put("displayname", target.get(z)); finalMapNode2.put("image", "/xxxxx/resources/icon/location.png"); finalMapNode2.put("type", "location"); finalMapNode2.put("group", 0); finalMapNode2.put("opacity", 100); listNodeMap.add(finalMapNode); listNodeMap.add(finalMapNode2);
has comment: http://stackoverflow.com/comment/40505548
score: -2
has comment: http://stackoverflow.com/comment/40505576
answer count: 2
has comment: http://stackoverflow.com/comment/40505498
possible better answer: http://stackoverflow.com/a/73626733
has comment: http://stackoverflow.com/comment/40505678
upvote count: 0
has answer: http://stackoverflow.com/a/73626733
has answer: http://stackoverflow.com/a/25882748
favorite count: 0
accepted answer: http://stackoverflow.com/a/25882748
has title: how to remove duplicates from the map using java
has comment: http://stackoverflow.com/comment/40505595
has comment: http://stackoverflow.com/comment/40505556
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40505563
tagged with: java
has comment: http://stackoverflow.com/comment/40505650
downvote count: 2
has comment: http://stackoverflow.com/comment/40505495
has comment: http://stackoverflow.com/comment/40505468
has comment: http://stackoverflow.com/comment/40505541

http://stackoverflow.com/a/25933727
upvote count: 4
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/40601496
type: AcceptedAnswer
has body: Most OSs (or rather the UI frameworks which they use) don't support concurrent access. Simply put, you can't render two strings of text at the same time. That's why Swing runs all rendering operations in the UI thread. Calling rendering functions (like paint()) outside of the UI thread can cause all kinds of problems. So when you do it, Swing will just remember "I should repaint" and return (instead of doing any actual work). That way, Swing protects you but most people would prefer to get an error with a useful message. A timer always also means that there is a thread somewhere which executes when the timer runs out. This is not the UI thread of Swing. So any paing operations there must be wrapped with EventQueue.invokeLater() or similar. Another common bug is to hog the UI thread (so no rendering happens because you do complex calculations there). That's what the SwingWorker is for. Again, in most methods of the SwingWorker, calling methods which would render something is forbidden (-> use invokeLater()). So my guess is that the UI thread waits for the lock and the lock simply isn't unlocked early or often enough. See this demo how to do a simple animation in Swing. public class TimerBasedAnimation extends JPanel implements ActionListener { public void paint(Graphics g) { // setup // do some first-run init stuff // calculate the next frame // render frame } public void actionPerformed(ActionEvent e) { repaint(); } public static void main(String[] args) { JFrame frame = new JFrame("TimerBasedAnimation"); frame.add(new TimerBasedAnimation()); ... } } As you can see in the code doesn't lock. Instead, you just send "render now" events from actionPerformed to Swing. Some time later, Swing will call paint(). There is no telling (and no way to make sure or force Swing) when this will happen. So good animation code will take the current time, calculate the animation state at that time and then render it. So it doesn't blindly step through N phases in M seconds. Instead, i…
has comment: http://stackoverflow.com/comment/40601871
accepted answer of: http://stackoverflow.com/q/25933331
has comment: http://stackoverflow.com/comment/40600597
type: Answer
has comment: http://stackoverflow.com/comment/40599082
answers question: http://stackoverflow.com/q/25933331

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/26018684
tag name: csv
tags question: http://stackoverflow.com/q/25922747
tags question: http://stackoverflow.com/q/25889993
tags question: http://stackoverflow.com/q/25887780
tags question: http://stackoverflow.com/q/26010221
tags question: http://stackoverflow.com/q/25912394
tags question: http://stackoverflow.com/q/25889127
tags question: http://stackoverflow.com/q/25973181
tags question: http://stackoverflow.com/q/25932971
tags question: http://stackoverflow.com/q/26029333
tags question: http://stackoverflow.com/q/25914945
tags question: http://stackoverflow.com/q/26025047
tags question: http://stackoverflow.com/q/25891283
tags question: http://stackoverflow.com/q/26033737
tags question: http://stackoverflow.com/q/26033985

http://stackoverflow.com/q/25994788
has answer: http://stackoverflow.com/a/25998384
tagged with: hadoop
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25998384
has body: I am trying to install HBase v0.98.6 on ubuntu. I already have Hadoop YARN running on the OS. Should I stop the existing Hadoop processes and rely solely on HBase or configure HBase with existing YARN setup? I can share more information if needed. I am trying to run HBase first on pseudo-distributed and then in distributed mode. To be clear - I am asking whether I need Hadoop YARN running before I install HBase (in a distributed manner - not on a single computer). If not, and I still have Hadoop YARN on those computers, will it cause any issues for HBase to run on those servers.
tagged with: hbase
upvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has title: HBase installation with Hadoop YARN

http://stackoverflow.com/comment/69700389
type: QuestionComment
comment on: http://stackoverflow.com/q/25921840
score: 0
has text: I am facing the exact same issue as described above. This is 2 years old however I do not want to ask the same question. I'm using WSO2 IS 5.2. I researched the source code and found the error occurs in the SAMLProcessorImpl class. Specifically here: if (samlContext.getPeerEntityMetadata() == null) { throw new MetadataProviderException("Metadata for issuer " + samlContext.getInboundMessageIssuer() + " wasn't found"); Did you find an answer?
type: Comment

http://stackoverflow.com/q/25982998
tagged with: sorting
has comment: http://stackoverflow.com/comment/40688009
has body: I'm trying to sort a polynomial linked list where the degree is contained in the node. For example, the poly.term.degrees of the polynomial 5x^2 + 5x + 5 would be 2,1,0. Unfortunately I have a method that adds polynomials but returns them in the opposite fashion (5 + 5x + 5x^2) which won't get me credit on this assignment I'm trying to complete, so I need to make a sort method for it. I tried a few times but I can't seem to get the hang of it - passing the head of a linked list through this method returns only the head I passed through and deletes the rest of the nodes. Can anybody help me out? Alternatively I could use an addToRear method while adding the polynomials instead of an addToFront, but I can't seem to get one working... I posted both my in-progress sort method and in-progress addToRear below, any input would be appreciated! private void sort(Node head) // CURRENTLY BROKEN!!!!!!!!!! { Node temp; Node curr = head; while(curr.next != null) { if(curr.term.degree &lt; curr.next.term.degree) //either degree is smaller or greater {//swap temp = curr; //save first element curr = curr.next; //set first element to second temp.next = curr.next; //set next of first to third curr.next = temp; //set second element to the first that we saved before } curr = curr.next; //move to next element } } private void addToBack(float coeff, int deg, Node head) { if(head==null) { // System.out.println("List empty, creating new node"); Node n = new Node(coeff,deg,head); head = n; System.out.println(head.term.coeff); } else { Node n = new Node(coeff,deg,head); Node temp = head; while(temp.next!=null) { System.out.println("a"); temp.next=temp; } head = n; } }
has comment: http://stackoverflow.com/comment/40688129
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40688348
has answer: http://stackoverflow.com/a/25984678
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40687594
has title: Sorting this linked lists?
tagged with: linked-list
has comment: http://stackoverflow.com/comment/40688537
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25983875

http://stackoverflow.com/comment/40690535
has text: David, i tried what you just said and it really returns a tab, but while running my code it isnt visually a tab. Maybe there is something to do with what Louis said I guess. Thanks all anyway.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25984457

http://stackoverflow.com/comment/40506129
type: QuestionComment
comment on: http://stackoverflow.com/q/25882631
type: Comment
has text: No difference. In the olden days, well perhaps still today ;-), `constant != x` was often recommended in languages like C. This was called [Yoda Conditions](http://en.wikipedia.org/wiki/Yoda_conditions) and helped to avoid cases like `x = constant` as `constant = x` would raise a compiler error. (However, in Java the only case when this matters is when doing a comparison with a `boolean` which should be avoided anyway.)
score: 4

http://stackoverflow.com/q/26007178
downvote count: 0
has title: log4j DailyRollingFileAppender does not create file with date pattern
has body: Using org.apache.log4j in a Java 8 application, I want a new log file to be created every hour with name e.g.: "mylog.log.2014-09-24-18". I read I need to use DailyRollingFileAppender, but when I start the application the log file is named "mylog.log". This is the content of my log4j.properties file: # Set root logger level and its appenders log4j.rootLogger=DEBUG, file # Direct log messages to a log file log4j.appender.file=org.apache.log4j.DailyRollingFileAppender log4j.appender.file.DatePattern='.'yyyy-MM-dd-HH log4j.appender.file.Append=true log4j.appender.file.File=mylog.log log4j.appender.file.encoding=UTF-8 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n Can you please let me know how I can achieve this?
tagged with: log4j
favorite count: 0
tagged with: logging
possible better answer: http://stackoverflow.com/a/26008113
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26007755
accepted answer: http://stackoverflow.com/a/26007755
type: Question
upvote count: 4
answer count: 2
score: 4
has answer: http://stackoverflow.com/a/26008113

http://stackoverflow.com/a/26006560
accepted answer of: http://stackoverflow.com/q/26006543
type: Answer
answers question: http://stackoverflow.com/q/26006543
upvote count: 5
score: 5
has body: While there is no such thing as a while-not loop, you can always invert the condition: while (!(string.equals("y") || string.equals("n"))){ This is read, "while the string is not equal to "y" or "n"". You could also apply DeMorgan's identity to rewrite this as: while (!(string.equals("y")) &amp;&amp; !(string.equals("n"))){ which is a bit clearer as "While the string isn't equal to "y" and isn't equal to "n"".
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26032154
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26032100
type: Answer
score: 1
has body: (.*?)\\s*\\((.*?)\\) Try this.Grab the match1 and match2. See demo. http://regex101.com/r/qC9cH4/7

http://stackoverflow.com/comment/40683527
comment on: http://stackoverflow.com/a/25981145
has text: @user3907211 - The same principle applies. You should not call `getView()` until after `onCreateView()` has returned. Note that according to the docs, `onCreateView()` is not called until after `onAttach()` has returned. We can provide more help if you explain when this code is executing in the lifecycle of the fragment.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/36371676
score: 0
answers question: http://stackoverflow.com/q/25966482
has body: Save the Person file and then try again. It should work then XD
type: Answer

http://stackoverflow.com/comment/40699169
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25989663
type: AnswerComment
has text: because I want to show "-" symbol in case of fuel equal 0

http://stackoverflow.com/comment/40746706
type: Comment
type: AnswerComment
has text: Nearly there. Have a look in your target directory - you should have a `test-fft-with-dependencies.jar`. That is the one to run. (See also http://stackoverflow.com/questions/1814526/problem-building-executable-jar-with-maven)
score: 1
comment on: http://stackoverflow.com/a/26015045

http://stackoverflow.com/q/26023820
has comment: http://stackoverflow.com/comment/40762592
upvote count: 3
has body: I have a class that calls one of its own methods internally several times. All of these methods take a generic parameter (Guava's Predicate). Eclipse compiles this fine and reports no errors and has no warning indicators, with compiler settings set to Java 1.6 compatibility. Gradle (using JDK 1.6.0_37) reports that one of these times the method is called it cannot find the symbol for that method, but the other times it can. This seems to involve the use of Guava's Predicates#and() static method. But a similar call with Guava's Predicates#not() works. I have simplified the code down to the following: import static com.google.common.base.Predicates.and; import static com.google.common.base.Predicates.not; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.FluentIterable; public class MyClass { public List&lt;String&gt; doStuffAnd(List&lt;String&gt; l, Predicate&lt;String&gt; p1, Predicate&lt;String&gt; p2) { // eclipse fine, gradle complains it can't find symbol doStuff return doStuff(l, and(p1, p2)); } public List&lt;String&gt; doStuffNot(List&lt;String&gt; l, Predicate&lt;String&gt; p) { // both eclipse and gradle compile fine return doStuff(l, not(p)); } public List&lt;String&gt; doStuff(List&lt;String&gt; l, Predicate&lt;String&gt; p) { return FluentIterable.from(l).filter(p).toList(); } } Resulting compile error is: doStuff(java.util.List,com.google.common.base.Predicate) in MyClass cannot be applied to (java.util.List,com.google.common.base.Predicate) return doStuff(l, and(p1, p2)); ^ If I explicitly type the call to Predicates.and() as follows return doStuff(l, Predicates.&lt;String&gt;and(p1, p2)); then it is fine. But I don't have to do that with the call to Predicates.not() It also works if I extract the #and expression as a local variable. What is the difference between the call using #and and the call using #not? Is there anything I can do avoid this that involves neither typing the and call …
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40833244
type: Question
has comment: http://stackoverflow.com/comment/41476940
downvote count: 0
has comment: http://stackoverflow.com/comment/40771678
has comment: http://stackoverflow.com/comment/40792628
score: 3
has title: Error compiling generics with javac but not Eclipse
answer count: 1
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/37606745
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/62697504

http://stackoverflow.com/a/26026217
accepted answer of: http://stackoverflow.com/q/25962311
score: 0
answers question: http://stackoverflow.com/q/25962311
has body: I have found the solution that works. I post it here, because it is cleaner (in my opinion) and different than the other proposed. I set the launch mode of the second activity to singleTask in the manifest file: android:launchMode="singleTask" ... <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.tutorial1.MainActivity" /> ... If there is a better solution for the stated problem, I am open for discussion :)
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/25999265
has comment: http://stackoverflow.com/comment/40716465
score: 3
tagged with: python
has body: I have two .jar files that I want to call from a Python script. However, after I call the first jar, the terminal sits and doesn't process anything after that point as the server is running. The server starts fine, but I want to start another process that will run until I ask them to stop. I've had trouble searching for possible solutions because I'm unsure of what terminology to use. from subprocess import call import glob import sys h2 = glob.glob("h2*.jar") reasoner = glob.glob("reasoner*.jar") h2 = h2.pop() reasoner = reasoner.pop() call(["java", "-jar", h2, "-tcp"]) # Any call commands after this point don't execute
has answer: http://stackoverflow.com/a/25999304
upvote count: 3
has title: Running Concurrent .jar Processes within Python
type: AnsweredQuestion
tagged with: java
tagged with: concurrency
type: Question
accepted answer: http://stackoverflow.com/a/25999304
downvote count: 0
answer count: 1
tagged with: jar
favorite count: 0

http://stackoverflow.com/q/25961987
has answer: http://stackoverflow.com/a/25962035
has title: class DuplicateItemException is public, should be declared in a file named DuplicateItemException.java
has comment: http://stackoverflow.com/comment/40648418
score: -1
tagged with: java
linked to: http://stackoverflow.com/q/13811020
answer count: 1
downvote count: 1
duplicate of: http://stackoverflow.com/q/13811020
type: UnansweredQuestion
has body: Why am I getting this error "class DuplicateItemException is public, should be declared in a file named DuplicateItemException.java", when I try to compile? Can anyone help me through this?
upvote count: 0
tagged with: applet
favorite count: 0
type: Question

http://stackoverflow.com/comment/40747191
has text: This is exactly what I was looking for. It looks like it is really cumbersome to define the type though. For instance I cannot use `@GatewayHeader` because the `ParameterizedTypeReference` instance is not considered a [Java constant expression](http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.28) and I cannot find a way to define the type token bean directly in XML, which even if possible would look ugly since in XML I'd have to escape `<` and `>`. Having to define a method or field that exposes the type is not very nice, but at least there is a way.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26010802

http://stackoverflow.com/comment/40568083
comment on: http://stackoverflow.com/q/25916796
type: Comment
type: QuestionComment
score: 0
has text: @SotiriosDelimanolis I updated the question to show where that comes from. It looks like Netbeans manages that for some reason I do not fully understand. I will say though, when I implemented this without inheritance, it did work at that URL.

http://stackoverflow.com/q/25953819
has answer: http://stackoverflow.com/a/50598946
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/37653458
type: Question
has comment: http://stackoverflow.com/comment/57823158
possible better answer: http://stackoverflow.com/a/34762061
tagged with: timeout
has answer: http://stackoverflow.com/a/34762061
has answer: http://stackoverflow.com/a/52366984
answer count: 11
upvote count: 222
has answer: http://stackoverflow.com/a/39383456
has answer: http://stackoverflow.com/a/49924520
has answer: http://stackoverflow.com/a/46263398
accepted answer: http://stackoverflow.com/a/25973778
favorite count: 0
has answer: http://stackoverflow.com/a/35620730
has body: I am developing app using OkHttp library and my trouble is I cannot find how to set connection timeout and socket timeout. OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder().url(url).build(); Response response = client.newCall(request).execute();
has answer: http://stackoverflow.com/a/57067306
has answer: http://stackoverflow.com/a/25973778
tagged with: okhttp
has answer: http://stackoverflow.com/a/33388631
score: 222
has title: How to set connection timeout with OkHttp
type: AnsweredQuestion

http://stackoverflow.com/comment/40652165
comment on: http://stackoverflow.com/q/25963891
type: Comment
type: QuestionComment
has text: @immibis Nope, the clients each have their own ObjectOutputStream.
score: 0

http://stackoverflow.com/comment/40663837
score: 0
type: Comment
type: QuestionComment
has text: at this point am just inserting a string without special symbol like apostrophe or underscore. just a String like john to the username. But my where clause is not supporting it.
comment on: http://stackoverflow.com/q/25969716

http://stackoverflow.com/a/25923335
upvote count: 3
has comment: http://stackoverflow.com/comment/40580375
accepted answer of: http://stackoverflow.com/q/25922912
score: 3
answers question: http://stackoverflow.com/q/25922912
type: AcceptedAnswer
downvote count: 0
has body: You define viewText twice. Once on class level, and once in onCreate(). In onCreate(), replace TextView viewText = (TextView)findViewById(R.id.textView4); with viewText = (TextView)findViewById(R.id.textView4);
type: Answer

http://stackoverflow.com/q/25975365
type: Question
has body: I have a basic doubt in java. Assume there is a Class A with a synchronised method M in it. If i create an object A1 for Class A and access that synchronised method M, then the object A1 is locked by the synchronised method M. I am creating a method with return type of Hashtable(which is internally a synchronised one) Does it act in the similar way like above method? Will the entire object become inaccessible till it is executing the method with return type of Hashtable?
has comment: http://stackoverflow.com/comment/40674019
score: 0
has answer: http://stackoverflow.com/a/25975485
answer count: 1
has title: does synchronisation on hashtable applies for whole class
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/40740802
has text: Have you made sure you're using the latest version of Apache POI? And that you have the same jars at runtime that you had at compile time?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25994772
score: 0

http://stackoverflow.com/a/76761947
upvote count: 1
has body: Try this: instead of using File, use InputStream. For example: XSSFWorkbook workbook = new XSSFWorkbook(new ClassPathResource("/apiLogDtlsReport.xlsx").getInputStream());
downvote count: 0
answers question: http://stackoverflow.com/q/25945900
type: Answer
score: 1

http://stackoverflow.com/comment/40728233
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26005536
has text: No this code is not borrowed. I went to different sites and made this code myself. But now stucked :(

http://stackoverflow.com/a/26000707
answers question: http://stackoverflow.com/q/25996988
score: -1
downvote count: 1
has body: Even if you put the cascade, it will not work. I see from your question that you would like to delete all the Publications which are of a certain category then your query should change to the following. (you were trying to delete Categories earlier) delete from Publication p where p.category.id = :categoryId; then if you would like to delete the Categories also. (Now you are safe to delete the categories because there are no references in the Publication table. delete from Category c where c.id = :categoryId;
type: Answer
upvote count: 0

http://stackoverflow.com/q/25886760
tagged with: apache-felix
tagged with: osgi
has title: Error "Could not find wsdl:binding operation info for web method" in OSGi Karaf
tagged with: wsdl
favorite count: 0
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/40558455
type: UnansweredQuestion
tagged with: karaf
score: 1
tagged with: java
type: Question
upvote count: 1
has body: I'm developing a client which should run in OSGi container. I'm using the stubs generated by cxf-codegen-plugin. The following Standalone application works fine: public class MyClient { public static void main(String args[]) throws java.lang.Exception{ String endpointT = "http://myService/endpoint/"; MyServicess = new MyService( ); MyServicePortType port = ss.MyServicePort(); BindingProvider provider = (BindingProvider) port; Client client = ClientProxy.getClient(port); client.getRequestContext().put(Message.ENDPOINT_ADDRESS, endpointT) ; System.out.println("Invoking findEventManager..."); System.out.println(port.callService()); } } When I try the same thing in an OSGi container (I'm using karaf which use the felix implementation of OSGi). It doesn't work! and show me this excepption javax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method callService. . The code looks as following: @Component(name="RemoteExample", immediate=true) @Service public class RemoteExampleImpl extends Thread implements IRemoteExample { private Boolean running =false; @Activate protected void activate(ComponentContext context) { running =true; this.start(); } public void run() { boolean cont = true; while (cont &amp;&amp; running) { String endpointT = "http://myService/endpoint/"; MyServicess = new MyService( ); MyServicePortType port = ss.MyServicePort(); BindingProvider provider = (BindingProvider) port; Client client = ClientProxy.getClient(port); client.getRequestContext().put(Message.ENDPOINT_ADDRESS, endpointT) ; System.out.println("Invoking findEventManager..."); System.out.println(port.callService()); } } @Deactivate protected void deactivate(ComponentContext context) { running = false; mLogger.info("LocalExampleImpl deactivated"); } } How I can make this code work?
has comment: http://stackoverflow.com/comment/40661260

lombok
type: Tag
tags question: http://stackoverflow.com/q/25903686
tag name: lombok
tags question: http://stackoverflow.com/q/25903504

http://stackoverflow.com/a/26033433
has comment: http://stackoverflow.com/comment/40792336
has body: Threads use memory on the heap (surprise!) You can fix your problem by supplying more heap to your Java program: java -Xmx1024m &lt;whatever comes for your application&gt; for 1gib of memory. A rule of thumb was 1mb for a thread, so if you want 50k threads, you need 50gb of memory. To lower this, you can decrease the stack size per thread java -Xss512k for 512k of stack, for your particular example you might get away with only 1k or even less. The default for Linux x64 seems 256k. BUT I would rather question why you need so many threads to do stuff. You should rather use a threadpool that matches whatever you have in processor cores and then just schedule work to do on this pool.
downvote count: 0
answers question: http://stackoverflow.com/q/26033269
has comment: http://stackoverflow.com/comment/40793686
has comment: http://stackoverflow.com/comment/40778866
has comment: http://stackoverflow.com/comment/40792800
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/40779031
upvote count: 3

http://stackoverflow.com/q/25962695
has body: I have the following model. A TabFragment which extends Fragment. A ListFragment which extends Fragment. And a DetailFragment which extends Fragment. TabFragment hosts ListFragment which will launch a DetailFragment. When I call getActivity().setResult(Activity.RESULT_OK, i); from DetailFragment, onActivityResult is called, but only in TabFragment. I pass from Detail Fragment, one String identifier to TabFragment. My only problem is that I would like to pass this String from TabFragment back up to ListFragment. What is the best way to do this?
downvote count: 0
answer count: 1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40649888
has answer: http://stackoverflow.com/a/25962815
favorite count: 0
has title: Pass a String from a Fragment to another Fragment
has comment: http://stackoverflow.com/comment/40649753
linked to: http://stackoverflow.com/q/22568339
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40671474
has comment: http://stackoverflow.com/comment/40690302
tagged with: android-intent
has comment: http://stackoverflow.com/comment/40649831
tagged with: android-fragments
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40649740
linked to: http://stackoverflow.com/q/16036572
upvote count: 1
type: Question

http://stackoverflow.com/a/28283311
has body: this problem happened to me, too. I assume you are on a debian or some other linux box. The problem is Oracle JDK's use of the linux random number generator. In order to make it work, run your application like this: java -Djava.security.egd=file:/dev/./urandom -jar foo.jar ... meaning, you have to specify the java.security.egd parameter. Details can be found here: https://github.com/ex3ndr/telegram-api/issues/9#issuecomment-38175765 and here: http://www.virtualzone.de/2011/10/javas-securerandomgenerateseed-on-linux.html
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25876572
downvote count: 0

http://stackoverflow.com/a/25894425
has comment: http://stackoverflow.com/comment/64900061
has comment: http://stackoverflow.com/comment/97987717
has comment: http://stackoverflow.com/comment/50198151
type: Answer
upvote count: 90
score: 89
downvote count: 1
has body: Remove below jar's from class path and it should fix the issue - log4j-to-slf4j-2.0.2.jar log4j-to-slf4j-2.0.2-sources.jar log4j-slf4j-impl-2.0.2.jar log4j-slf4j-impl-2.0.2-sources.jar I was able to replicate and fix the issue after downloading apache-log4j-2.0.2 from http://www.apache.org/dyn/closer.cgi/logging/log4j/2.0.2/apache-log4j-2.0.2-bin.zip.
has comment: http://stackoverflow.com/comment/130319421
has comment: http://stackoverflow.com/comment/130320041
has comment: http://stackoverflow.com/comment/116405082
has comment: http://stackoverflow.com/comment/100194024
answers question: http://stackoverflow.com/q/25891737
has comment: http://stackoverflow.com/comment/76510022

http://stackoverflow.com/q/25887246
linked to: http://stackoverflow.com/q/14014631
tagged with: nlp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40591172
answer count: 0
has body: For a project I need a dependency parse tree of a sentence. This works quite well using Stanford NLP: import edu.stanford.nlp.pipeline.StanfordCoreNLP; // ... public void parse(String sentence) { Properties props = new Properties(); props.put("annotators", "tokenize, ssplit, pos, lemma, parse"); Annotation document = new Annotation(sentence); StanfordCoreNLP pipeline = new StanfordCoreNLP(props); pipeline.annotate(document); List&lt;CoreMap&gt; sentences = document.get(SentencesAnnotation.class); CoreMap firstSentence = sentences.get(0); SemanticGraph dependencies = firstSentence.get(CollapsedCCProcessedDependenciesAnnotation.class); // ... } However I now also need other possible parse trees, i.e. the k-best parse trees. I can later pick out the tree that makes most sense. I have looked around but not found any code on the web that does this using a Java API. Has anyone done something like this? Cheers!
tagged with: java
has title: Get k-best dependency parse trees
type: Question
tagged with: text-parsing
has comment: http://stackoverflow.com/comment/40592183
tagged with: stanford-nlp
score: 0
has comment: http://stackoverflow.com/comment/40585082

http://stackoverflow.com/comment/40562891
comment on: http://stackoverflow.com/q/25911265
score: 0
has text: I realize that what I want to do can be accomplished either by: -acessDecisionManager; -pre-post-annotations; -secured-annotations; The problem perssist, once I have to do my custom authorization, either on accessDecisionManager, as I'm doing now, or changind this logic to @Secured or pre-post annotations. At the end I've to configure my aapplication security to use this logic, that's my problem right now.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25972526
tagged with: java
linked to: http://stackoverflow.com/q/10673036
tagged with: log4j2
has title: How to use custom columns with jdbcappender?
type: Question
tagged with: jakarta-ee
score: 2
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I am able to log the application trace in a database table using jdbcappender. Now I would like to extend the table (add new columns) to include some contextual information, such as user, method name, parameters and so on. Here is a log4j solution where Mapped Diagnostic Context (MDC) is used to add additional information to the log entry with additional information. In log4j2 the successor to MDC is a ThreadContext. This solution works for me, but since this is an application which can have many concurrent users, is it thread safe? Or in other words, is 1 ThreadContext active pro user session? I am running this application on Apache TomEE.
tagged with: jdbc
answer count: 0

http://stackoverflow.com/q/25971669
type: UnansweredQuestion
tagged with: spring-data
has comment: http://stackoverflow.com/comment/40747053
has comment: http://stackoverflow.com/comment/40699476
tagged with: java
type: Question
score: 0
tagged with: mongodb
has title: SpringData Mongodb @Field sometime works, sometime not
has body: I'm have the following class (I omit getter/setter for the first attributes): public class Customer { private String firstname; private String lastname; private String nickname; private String type; @Field("bag_list") @DBRef private ArrayList&lt;Checkout&gt; bagList; public ArrayList&lt;Checkout&gt; getBagList() { return bagList; } public void setBagList(ArrayList&lt;Checkout&gt; bagList) { this.bagList = bagList; } } The document in MongoDb is (omitting as before the trivial attributes): { "bag_list" : [ { "$ref" : "checkout", "$id" : ObjectId("541fe83bc026bb4901f5f90c") } ] } The above code just doesn't work and if I debug it I can see that the object Customer in memory has a null value for bagList even if in the DB the data exists. If I change it to: public class Customer { private String firstname; private String lastname; private String nickname; private String type; @Field("bag_list") @DBRef private ArrayList&lt;Checkout&gt; bag_list; public ArrayList&lt;Checkout&gt; getBagList() { return bag_list; } public void setBagList(ArrayList&lt;Checkout&gt; bagList) { this.bag_list = bagList; } } It works correctly. It seems like the @Field value it's ignored. I'm running Spring Framework 4.0.6, Spring Data MongoDb 1.6.0 and MongoDb driver 2.12.1.
has comment: http://stackoverflow.com/comment/40695192
tagged with: spring
answer count: 0

http://stackoverflow.com/a/25968826
score: 0
has comment: http://stackoverflow.com/comment/40703456
has body: It is wrong way of working with Android views in libgdx project. You should place all logic which works with view on LibGdx extends AndroidApplication class and if you want to get access to this logic from another class you should create Interface which will be transferred to your main Game class. Such way you will be able to get access to your 'Android specific' logic in any place. Look at this guide for more details - Interfacing with platform specific code
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25965833
has comment: http://stackoverflow.com/comment/40661974
has comment: http://stackoverflow.com/comment/40661329
type: Answer
accepted answer of: http://stackoverflow.com/q/25965833
has comment: http://stackoverflow.com/comment/40707033

http://stackoverflow.com/comment/67700836
score: 0
type: Comment
comment on: http://stackoverflow.com/a/38475273
type: AnswerComment
has text: And what is the code for the full access of the entire redirect history ?

http://stackoverflow.com/q/25917773
score: 7
tagged with: java
tagged with: tomcat7
type: Question
has comment: http://stackoverflow.com/comment/40570262
has comment: http://stackoverflow.com/comment/40570842
answer count: 2
has title: How to log Tomcat 7 JDBC connection pool, connection creation
upvote count: 7
has answer: http://stackoverflow.com/a/31186360
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40572605
favorite count: 0
has answer: http://stackoverflow.com/a/47107731
type: UnansweredQuestion
tagged with: jdbc
has body: I'm trying to debug what seems to be an excessive number of database connections being opened and closed despite the fact that we are using the Tomcat 7 JDBC connection pool. How can I log when calling getConnection() on the data source results in a new connection being opened versus an existing connection being borrowed from the pool?
tagged with: connection-pooling
downvote count: 0

http://stackoverflow.com/comment/43907182
has text: And remember that it is not an EJB, so no public properties if you dont want the error "CDI definition failure:WELD-000075: Normal scoped managed bean implementation class has a public field: ..." Ufff!! And after this error, It is necessary restart the instance. It is crazy!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25997828

http://stackoverflow.com/comment/40518360
score: 0
type: Comment
has text: my while loop in there is used for write down untouched srt in a textarea, with while loop to read and append texts until the end of file (as condition). when i tried to implement your while loop so that my while loop write down stripped srt, textarea only filled with blank line. do i have to change my while condition?
type: AnswerComment
comment on: http://stackoverflow.com/a/25888631

http://stackoverflow.com/comment/40527861
has text: What happens, for example, if the constructor throws an exception? Simply setting to `null` is *far* more sensible. I'll have a look at the JLS later.
score: 0
comment on: http://stackoverflow.com/a/25894808
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25971031
accepted answer: http://stackoverflow.com/a/25971170
favorite count: 0
tagged with: exception
possible better answer: http://stackoverflow.com/a/25971194
has comment: http://stackoverflow.com/comment/40665062
tagged with: lambda
upvote count: 4
has body: Why is an exception thrown when using ?: operator in a Java 8 lambda expression? When I try to run the following sample code: import java.util.ArrayList; import java.util.List; public class TestClass { public static void main(String[] args) { List&lt;Foo&gt; foos = new ArrayList&lt;&gt;(); boolean b = true; foos.forEach(foo -&gt; (b ? foo.doSth(1) : foo.doSth(2))); } @FunctionalInterface interface Foo { public void doSth(int i); } } I get the following exception: Exception in thread "main" java.lang.Error: Unresolved compilation problem: at gui.marksDetection.view.TestClass.main(TestClass.java:8) When replacing the lambda expression with a for-each-loop, or replacing (b ? foo.doSth(1) : foo.doSth(2)) with an if-else-block, everything works fine, so there seems to be a problem with the combination ?: + lambda. However, Eclipse does not mark it as an error.
has comment: http://stackoverflow.com/comment/40665615
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Exception when using ?: operator in Java 8 lambda expression
has comment: http://stackoverflow.com/comment/40664831
type: Question
has comment: http://stackoverflow.com/comment/40664805
answer count: 2
has answer: http://stackoverflow.com/a/25971194
score: 4
has answer: http://stackoverflow.com/a/25971170

jspinner
tags question: http://stackoverflow.com/q/25947892
type: Tag
tag name: jspinner
tags question: http://stackoverflow.com/q/25887858

http://stackoverflow.com/comment/40719607
type: Comment
type: QuestionComment
has text: @abalos - I have gone ahead and done what you suggested. While it does not solve my immediate problem, I believe it did need to be done. Thx.
comment on: http://stackoverflow.com/q/25998618
score: 0

http://stackoverflow.com/comment/125524713
comment on: http://stackoverflow.com/a/68549962
has text: Edited my post for you.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40547599
score: 0
type: AnswerComment
has text: I totally appreciate your answer and I will take a look at it later, but my question is how I can use Java 8 to accomplish that
type: Comment
comment on: http://stackoverflow.com/a/25905492

http://stackoverflow.com/a/25939807
has comment: http://stackoverflow.com/comment/40611283
has comment: http://stackoverflow.com/comment/40610828
accepted answer of: http://stackoverflow.com/q/25939705
has comment: http://stackoverflow.com/comment/40611940
downvote count: 0
has comment: http://stackoverflow.com/comment/40611597
score: 1
answers question: http://stackoverflow.com/q/25939705
has comment: http://stackoverflow.com/comment/40611310
has comment: http://stackoverflow.com/comment/40610726
has comment: http://stackoverflow.com/comment/40618763
has body: Add an InternalFrameListener to your JInternalFrame, and re-enable the JButton when the JInternalFrame is either closed or closing or both. Or better still -- it looks as if you're trying to create and display the JInternalFrame equivalent of a JOptionPane, and if so, you can actually do this directly via JOptionPane showInternalXxxDialog as discussed here. As an aside, your code posted shows some magical thinking: private void formInternalFrameClosed(javax.swing.event.InternalFrameEvent evt) { posframe pos = new posframe(); // **** here*** pos.jButton1.setEnabled(true); JOptionPane.showMessageDialog(null,"closed"); } You're creating a new posframe (which by the way should be re-named PosFrame to comply with Java naming rules), and assuming that if you enable a JButton on this new posframe object, it will magically enable the JButton in the displayed posframe object, but please understand that that is not how Java works, that the two posframe objects are completely distinct, and setting the state of the non-displayed posframe will have no effect on the displayed one. If your code were to work, you'd first have to pass a reference of the displayed posframe object into the class that is calling this code above. Also your code suggests that the jButton1 has been declared public, if so, that is a potentially dangerous thing to do and should be avoided. Edit OK, based on your posted code, I see two possible solutions to your issue. Pass a reference of the main GUI into your JInternalFrame code Use this reference to set a field of the class with the reference. Then in the listener, call a public method on the main GUI (don't make fields public if at all possible). Or an even better solution is to not have the JInternalFrame worry about that which should not concern it. Instead put the listener in the calling class, so that it changes itself without need for the other class to manipulate things that it really shouldn't have responsibility for. Code for example one is shown…
has comment: http://stackoverflow.com/comment/40610321
has comment: http://stackoverflow.com/comment/40610620
has comment: http://stackoverflow.com/comment/40612049
has comment: http://stackoverflow.com/comment/40612622
has comment: http://stackoverflow.com/comment/40611833
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40619090
has comment: http://stackoverflow.com/comment/40619576
has comment: http://stackoverflow.com/comment/40611970
has comment: http://stackoverflow.com/comment/40619194
type: Answer

http://stackoverflow.com/comment/40678027
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25977421
type: AnswerComment
has text: But I had that bean configuration within my struts.xml

http://stackoverflow.com/q/25897712
tagged with: jlist
tagged with: http://stackoverflow.com/tag/xml
score: 2
has answer: http://stackoverflow.com/a/25898299
upvote count: 2
type: AnsweredQuestion
has body: I've looked at a few posts on this topic, but none of the solutions have worked for me. I have a DefaultListModel called partsListRight that is a member of my window class, and I have an inner class called configuration that contains an ArrayList which I want to populate with the items in partsListRight: @XmlRootElement class Configuration{ @XmlElement private ArrayList&lt;String&gt; Component; public Configuration(){ Component = new ArrayList&lt;String&gt;(); Object[] partsList = partsListRight.toArray(); for (Object object : partsList){ Component.add((String)object); } } } In my window class I have a save() method that does the marshalling for the ArrayList Component: public void save() { Configuration configuration = new Configuration(); try{ File file = new File("C:\\configuration.xml"); JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(configuration, file); jaxbMarshaller.marshal(configuration, System.out); } catch(JAXBException e){ e.printStackTrace(); } } However when I try to run this method I get the error that Configuration is a non-static inner class, and JAXB can't handle those. I'm not sure how to get around this. Would greatly appreciate any help!
has comment: http://stackoverflow.com/comment/40546007
has title: Marshal DefaultListModel into xml
tagged with: java
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/25898299
tagged with: defaultlistmodel
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40533402

http://stackoverflow.com/comment/40747692
has text: @geoand I updated the example slightly. I want to test a bean configured in main scope, but context has to be mocked partly in test scope to make it work. Problem is that mocked class has Autowired annotation, and injecting into it can't be switched off.
score: 0
comment on: http://stackoverflow.com/q/26016311
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25921598
score: 1
favorite count: 0
type: Question
answer count: 1
tagged with: java
upvote count: 1
has title: Compilation issue with example code
has body: example from the documentation, it compiles but I haven't managed to make it run. >java -cp . SourceBee Error: Could not find or load main class SourceBee I use following batch file: @echo off cd %1 echo Manifest-version: 1.0 &gt; manifest.mf echo Main-Class: %1 &gt;&gt; manifest.mf javac %1.java rem jar cvmf manifest.mf %1.jar %1.java rem pause rem java -jar %1.jar java -cp . %1 cd .. And this is the unmodified source: import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class SourceBee{ public static void main(String[] args) { JFrame frame = new JFrame("SourceBee"); frame.setSize(800,600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setLayout(null); JLabel userLabel = new JLabel("User"); userLabel.setBounds(10,10, 80, 25); panel.add(userLabel); JTextField userText = new JTextField(20); userText.setBounds(100, 10, 160, 25); panel.add(userText); JButton loginButton = new JButton("login"); loginButton.setBounds(10, 80, 80, 25); panel.add(loginButton); JButton registerButton = new JButton("register"); registerButton.setBounds(180, 80, 80, 25); panel.add(registerButton); frame.add(panel); frame.setVisible(true); } }
tagged with: compilation
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25921684
downvote count: 0

http://stackoverflow.com/comment/70781548
has text: Note that the prepare() method has been deprecated since Scala 2.12
type: Comment
comment on: http://stackoverflow.com/a/26528986
score: 1
type: AnswerComment

http://stackoverflow.com/comment/40651967
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25963891
has text: Are you using threads?
score: 0

http://stackoverflow.com/comment/40638092
comment on: http://stackoverflow.com/q/25956419
has text: If `node.left` is not `null` assign its height to `ltVal` else assign the value zero to it. Google "Ternary Operators"
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/40634926
type: Comment
type: QuestionComment
score: 0
has text: jajaa i forgot to mention the most important part of the question, this is what happens on a dragging problem: when you try to drag a box, you just lose in the game, cos you dragged it to the wrong place, I mean: you drag it to the top, and the game thinks it was moved to the left, and you lose. it's clear now?
comment on: http://stackoverflow.com/q/25944088

http://stackoverflow.com/q/25966936
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40657691
has comment: http://stackoverflow.com/comment/40658600
has title: Generating random math questions
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40658021
has answer: http://stackoverflow.com/a/25967183
has body: We have to make a program than generates math problems for different year levels, so they vary with difficulty. We have to produce 2 random numbers within a min and max boundary. We then have to make these two numbers carry out an operation. For example add them together, or divide one by the other or multiply them etc. The program works based on the year level the user supplies. Each year level has different minimum and maximum numbers, and different operations. Eg. Year 1 is only addition and subtraction and year 7 is addition subtraction multiplication division and so on. I've defined different methods to help me do this, but I can't seem to get my program to generate what I want. It should look something like the image attached below. Part of my code is here. When I run my program it just produces a number of integers (10 or 20 depending on how many math questions the user selected to attempt). It doesn't produce any of the operations between the numbers eg( +, -, /, x) Can anyone point me in the right direction as to what I'm doing wrong? private static void generateQuestion(int yearLevel) { int min = getMin(yearLevel); int max = getMax(yearLevel); int num1 = (int) (min + (max - min) * Math.random()); int num2 = (int) (min + (max - min) * Math.random()); int oper = getOper(yearLevel); String result = " "; char op; switch (oper) { case 1: op = '+'; result = (num1 + num2 + " "); break; case 2: op = '-'; result = (num1 - num2 + " "); break; case 3: op = '*'; result = (num1 * num2 + " "); break; case 4: op = '/'; result = (num1 / num2 + " "); break; case 5: op = '%'; result = (num1 % num2 + " "); break; } ; } private static int getMin(int yearLevel) { int min = 0; if (yearLevel == 0 || yearLevel == 1 || yearLevel == 2 || yearLevel == 3 || yearLevel == 4) { min = 0; } if (yearLevel == 5 || yearLevel == 6) { min = -999; } if (yearLevel == 7) { min = -9999; } return min; } private static int getMax(int yearLevel) { int max = 9; if (yearLevel == 0 || yearLevel == 1 || …
has answer: http://stackoverflow.com/a/25967341

http://stackoverflow.com/comment/40505572
score: 0
type: QuestionComment
has text: Adding a zero to the end of 12.5 so that is prints as 12.50 is a formatting/presentation issue.
type: Comment
comment on: http://stackoverflow.com/q/25882136

http://stackoverflow.com/q/25991249
tagged with: crossdomain.xml
downvote count: 0
tagged with: applet
favorite count: 0
has title: JSE 1.8, Sandbox Java Applet loaded over HTTPS, but crossdomain.xml retrieved using HTTP
has answer: http://stackoverflow.com/a/37528274
has body: Hi all Java/Applet gurus, I've stumbled upon an interesting problem with the latest JDK build (1.8.0_b26). When running Sandbox Java Applet with the latest JDK, from within Java code we try to connect back to the server with a different protocol - instead of original HTTPS we use WSS (secured Websockets connection, we use third party Websockets Client Java library). As the result, JVM tries to retrieve crossdomain.xml file from the server. The problem is, that the file is retrieved using HTTP (and not HTTPS) protocol. For example, in our case the server IP is 192.168.1.1, the applet is loaded over HTTPS default port (443). Using trace level 5 in Java console we see that the crossdomain.xml is retrieved from http://192.168.1.1:443. And of course it doesn't work because the server listens only for HTTPS connections on port 443 (and not HTTP). On the other hand, when we use HTTP protocol and open new WS (unsecured Websockets connection) to the server, the problem doesn't appear, because crossdomain.xml is retrieved from http://192.168.1.1:80 and it is completely correct. As the problem was further investigated, we've made few more observations: It is possible to provide alternative location of crossdomain.xml file using jnlp.altCrossDomainXMLFiles Java VM parameter. We've never succeed to make this parameter work for us though (tried both in java_arguments list and as lone applet parameter). The possible reason might be that the parameter should be used only with Webstart application (although it is not written specifically in specs). While establishing Websockets connection, the connection stack trace is as follows: at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:790) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:787) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534) at sun…
tagged with: java-8
upvote count: 3
has comment: http://stackoverflow.com/comment/40707202
type: UnansweredQuestion
tagged with: java
tagged with: sandbox
has answer: http://stackoverflow.com/a/29477011
type: Question
score: 3
answer count: 2
has comment: http://stackoverflow.com/comment/40703637

http://stackoverflow.com/comment/40658468
type: Comment
type: QuestionComment
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
score: 4
comment on: http://stackoverflow.com/q/25967346

http://stackoverflow.com/q/25977868
has comment: http://stackoverflow.com/comment/40677335
score: 0
has answer: http://stackoverflow.com/a/25977955
answer count: 1
has comment: http://stackoverflow.com/comment/40677476
has comment: http://stackoverflow.com/comment/40677272
tagged with: sockets
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40677324
tagged with: serversocket
accepted answer: http://stackoverflow.com/a/25977955
tagged with: tcp
tagged with: java
type: Question
has body: So I am running a piece of code that is supposed to create a Socket a ServerSocket, when I run my code it meets a stand still at line 14 but doesn't throw any exception. What have I missed? public class Syncronizer { InputStream instr = null; PrintStream prnstr = null; BufferedReader br = null; DataInputStream in; DataOutputStream out; ServerSocket TCPServerSocket; public Syncronizer() { try { instr = System.in; br = new BufferedReader(new InputStreamReader(instr)); TCPServerSocket = new ServerSocket(7007); Socket clientSocket = TCPServerSocket.accept(); in = new DataInputStream(clientSocket.getInputStream()); out = new DataOutputStream(clientSocket.getOutputStream()); } catch (Exception e) { e.printStackTrace(); } } ... } Just to spare you the counting it is this line that halts my program: Socket clientSocket = TCPServerSocket.accept(); EDIT: With halt I mean that my program still runs but doesn't go beyond this point in the code just like a infinite loop.
has comment: http://stackoverflow.com/comment/40677536
has title: Programs halts when trying to create a new Socket with existing ServerSocket

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/25945662
tags question: http://stackoverflow.com/q/26004708
type: Tag

http://stackoverflow.com/q/25973463
has answer: http://stackoverflow.com/a/25973662
answer count: 1
has title: Effective Java: Builder Pattern
favorite count: 0
has comment: http://stackoverflow.com/comment/86345344
has body: I was reading Effective java item# 2- The Builder pattern http://www.informit.com/articles/article.aspx?p=1216151&amp;seqNum=2 It is said here that java bean is not an effective way to create the object with multiple parameters. But what if I have the javabean this way: // JavaBeans Pattern public class NutritionFacts { private final int servingSize ; private final int servings ; private final int calories; private final int fat; private final int sodium; private final int carbohydrate; public NutritionFacts() { } // Setters public void setServingSize(int val) { servingSize = val; } public void setServings(int val) { servings = val; } public void setCalories(int val) { calories = val; } public void setFat(int val) { fat = val; } public void setSodium(int val) { sodium = val; } public void setCarbohydrate(int val) { carbohydrate = val; } } Note that I made all member variables as Final Now an instance can be created this way: NutritionFacts cocaCola = new NutritionFacts(); cocaCola.setServingSize(240); cocaCola.setServings(8); cocaCola.setCalories(100); cocaCola.setSodium(35); cocaCola.setCarbohydrate(27); Whats wrong if I do this way? Can someone help me understand? Thanks, Rajan
upvote count: 2
type: AnsweredQuestion
tagged with: builder
accepted answer: http://stackoverflow.com/a/25973662
score: 1
tagged with: java
downvote count: 1
tagged with: effective-java
type: Question
tagged with: factory-pattern

http://stackoverflow.com/comment/40560676
comment on: http://stackoverflow.com/a/25912887
type: AnswerComment
score: 0
has text: actually I applied that "||" instead of "|" using the same concept i've learned in c++ but i"m getting an error so i only use "|"
type: Comment

http://stackoverflow.com/a/26015232
downvote count: 0
answers question: http://stackoverflow.com/q/26014744
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26014744
has comment: http://stackoverflow.com/comment/40746019
type: AcceptedAnswer
type: Answer
has body: You have a problem with your character encoding. The character sequence Ã‘Ã± clearly shows that there are UTF-8 characters that are decoded in any other character encoding (presumbly ISO-8859-1). Please check your complete application that the encodings are correct. Start with the method parse() in the DocumentBuilder and use the method that uses a InputSource and create the InputSource with a Reader that has the correct encoding (ISO-8859-1 in you case).
score: 2

http://stackoverflow.com/a/25956523
upvote count: 3
answers question: http://stackoverflow.com/q/25956435
score: 3
downvote count: 0
type: Answer
has body: Get all UI out of the Circle class, meaning remove all those JOptionPane calls. Instead all user interaction should be in your CircleTester class. The Circle class should instead focus not on user IO, but simply on drawing a Circle that is defined by its properties. Give your Circle class a constructor that takes meaningful parameters. It seems to me that Ellipse2D is not needed as you can simply draw your circle with a Graphics object by calling g.drawOval(....)`, thereby simplifying your program. After you get the input parameters inside of CircleTester, create Circle objects passing in the parameters obtained from CircleTest, and display your Circle. Also, don't forget to call the super.paintComponent(g) method within your paintComponent method override. Minor nitpick, but I would not declare circumference and area variables, but rather give your Circle class getCircumference() and getArea() methods that would calculate these on the spot when needed. Otherwise if you give Circle a setRadius(...) method, you'll have to remember to change the other fields within the setter method, and if you make radius or the other fields public, all heck can break loose. Play safe and just have accessor methods for those two properties and not fields.

buffer
tags question: http://stackoverflow.com/q/25882747
tags question: http://stackoverflow.com/q/25941794
tag name: buffer
tags question: http://stackoverflow.com/q/25930079
type: Tag

http://stackoverflow.com/a/25983633
accepted answer of: http://stackoverflow.com/q/25936517
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25936517
has body: The BoxImageRequestObject is for the purpose tweaking requests. In this scenario you'll want to do a : BoxImageRequestObject.previewRequestObject().setMinHeight(size).setMaxHeight(size).setMinWidth(size).setMaxWidth(size); This way you are specifically requesting a thumbnail of a certain size. However please be aware that although server always try to render the thumbnail with the size requested, the size requested may not exist in server. In this case server will get an thumbnail with different size back.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25964280
tagged with: ebean
has comment: http://stackoverflow.com/comment/40758959
tagged with: http://stackoverflow.com/tag/xml
tagged with: playframework-2.0
has body: I have the following xml file in conf/orm.xml <?xml version="1.0" encoding="UTF-8"?> <column name="requestKeyId" length="255"/> <column name="requestId" length="255"/> <column name="key" length="255"/> Play framework is not picking up or registering the orm XML settings, even when the xml syntax is bad. Documentation says "Note that Ebean will also make use of a conf/orm.xml file (if present), to configure entity-mappings." I get the following error when I attempt to interact the aforementioned bean "[RuntimeException: No @javax.persistence.Id field found in class [class models.RequestKey]]" Specifically, the error is thrown in this code public Map<RequestKey, List<RequestValue>> mapToRequestMap(UUID requestId, Map<String, String[]> queryParameters) { Map<RequestKey, List<RequestValue>> result = new HashMap<RequestKey, List<RequestValue>>(); queryParameters.forEach((key, values) -> { RequestKey requestKey = new RequestKey(UUID.randomUUID(), requestId, key); List<RequestValue> requestValues = Arrays.stream(values).map( value -> new RequestValue(UUID.randomUUID(), requestKey.getRequestKeyId(), value) ).collect(Collectors.toList()); result.put(requestKey, requestValues); }); return result; } when result.put is called
tagged with: java
tagged with: orm
has answer: http://stackoverflow.com/a/27174852
type: Question
has title: Play Framework 2.x not reigstering orm.xml
has comment: http://stackoverflow.com/comment/40770325
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/25990971
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25990839
type: AcceptedAnswer
downvote count: 0
has body: Gson expects an input in JSON format. That means: All names must be quoted All string values must be quoted you must use : instead of = objects must be wrapped in {} You must omit the type names Example: {"id":null, "provider":null, "venueId":{"t10":555, "t1":333, ...
answers question: http://stackoverflow.com/q/25990839
type: Answer

http://stackoverflow.com/q/25895491
tagged with: windows
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25895560
has comment: http://stackoverflow.com/comment/40529117
has comment: http://stackoverflow.com/comment/40530118
has comment: http://stackoverflow.com/comment/40530765
type: Question
has comment: http://stackoverflow.com/comment/40529837
has title: Login web application with local user
tagged with: java
has body: To using a computer I need inform a network user to connect. So, I wanna know if it is possible to connect to a web application using the local user without putting again the user and password. In other words, I need to recognize the local user to auto authentication when entering the web application. Is it possible?
has comment: http://stackoverflow.com/comment/40529130
accepted answer: http://stackoverflow.com/a/25895560
score: 0
has comment: http://stackoverflow.com/comment/40530042
has comment: http://stackoverflow.com/comment/40546089
answer count: 1
has comment: http://stackoverflow.com/comment/40530104

http://stackoverflow.com/q/25905982
downvote count: 1
score: 0
has title: how to avoid duplicating JTable columns in java?
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/25906811
upvote count: 1
has comment: http://stackoverflow.com/comment/40548162
has comment: http://stackoverflow.com/comment/40548123
tagged with: jtable
has answer: http://stackoverflow.com/a/25906437
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25906811
has comment: http://stackoverflow.com/comment/40548248
favorite count: 0
has answer: http://stackoverflow.com/a/25906848
possible better answer: http://stackoverflow.com/a/25906437
type: Question
has body: i want to add a cloumn to a jtable when a radio button is being clicked. but when i click it twice two columns are being added to the table. here's my code dtm = (DefaultTableModel) viewTable.getModel(); dtm.setRowCount(0); TableColumnModel model=viewTable.getColumnModel(); boolean found=false; for (int i = 0; i &lt; viewTable.getColumnCount(); i++) { if (model.getColumn(i).getIdentifier().equals("customer Id")) { found=true; break; } if (found==false) { dtm.addColumn("customer Id"); } don't know how to fix it..
tagged with: jtableheader
has comment: http://stackoverflow.com/comment/40548319
tagged with: swing

http://stackoverflow.com/comment/40719222
score: 0
type: QuestionComment
has text: And what is abnormal about this ? There is indeed no such constructor in the javadoc.
type: Comment
comment on: http://stackoverflow.com/q/26000758

http://stackoverflow.com/a/26033902
answers question: http://stackoverflow.com/q/26033868
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/26033868
has body: Change FileWriter jsw = new FileWriter(json); with FileWriter jsw = new FileWriter(json, true); this way thte FileWriter is opened in append mode

http://stackoverflow.com/a/25969297
score: 1
answers question: http://stackoverflow.com/q/25968684
upvote count: 1
has body: This should do what you want: double myRound(double val, int param) { val = 1000 * val / param; val = Math.ceil(val); return val * param / 1000; } e.g.: System.out.println(myRound(10.01, 125)); gives 10.125
type: Answer
downvote count: 0

http://stackoverflow.com/a/26001593
has comment: http://stackoverflow.com/comment/40730014
score: 0
has comment: http://stackoverflow.com/comment/40734593
has comment: http://stackoverflow.com/comment/40721810
has comment: http://stackoverflow.com/comment/40760027
type: Answer
has body: Talk about making your life more difficult than it needs to be. Make your application a '.NET managed' application then all you need is the MQ dll called amqmdnet.dll (supplied by IBM and it contains everything you need). Hence, you can run your .NET application without a full install of MQ. Of course, deploying the amqmdnet.dll file with your application is not supported by IBM but neither is the complicated setup you are trying to do.
answers question: http://stackoverflow.com/q/25988538

http://stackoverflow.com/comment/40650057
has text: This will not solve your current issue, but have you considered using the AMQP messaging protocol to accomplish this task?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25961796
type: QuestionComment

http://stackoverflow.com/comment/40652097
score: 0
comment on: http://stackoverflow.com/q/25963891
type: QuestionComment
type: Comment
has text: Are they using the same stream?

http://stackoverflow.com/a/25924175
type: AcceptedAnswer
downvote count: 0
has body: This is your problem: public ArrayList setsongList(ArrayList songList) { return this.songList = songList; } This is accepting and returning a raw type of ArrayList while the field this.songList is an ArrayList&lt;Song&gt;. This is a big no-no. Revise your code to take the parametrized type as an argument, and return the parametrized type. Revised version public ArrayList&lt;Song&gt; setsongList(ArrayList&lt;Song&gt; songList) { return this.songList = songList; }
has comment: http://stackoverflow.com/comment/40582061
has comment: http://stackoverflow.com/comment/40581818
has comment: http://stackoverflow.com/comment/40581943
type: Answer
accepted answer of: http://stackoverflow.com/q/25924144
answers question: http://stackoverflow.com/q/25924144
has comment: http://stackoverflow.com/comment/40581887
has comment: http://stackoverflow.com/comment/40581784
score: 1
has comment: http://stackoverflow.com/comment/40581873
upvote count: 1
has comment: http://stackoverflow.com/comment/40582181
has comment: http://stackoverflow.com/comment/40581925

http://stackoverflow.com/a/25951773
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25951742
has body: No, what you are seeing above is the message of a compilation error. A runtime exception does not carry that information.
accepted answer of: http://stackoverflow.com/q/25951742
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/25921185
answers question: http://stackoverflow.com/q/25920991
has comment: http://stackoverflow.com/comment/40578157
type: Answer
has comment: http://stackoverflow.com/comment/40579518
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25920991
has comment: http://stackoverflow.com/comment/40578687
type: AcceptedAnswer
downvote count: 0
has body: Using a Hashmap&lt;String, List&lt;String&gt;&gt; is probably the simplest way. However if you really want these in objects you could do something with an interface. public interface CSVConvertable { /* sets values in this class according to a row in the CSV file */ public void setCSVValues(String [] values); } class Class1 implements CSVConvertable { String field1 = ""; String field2 = ""; @Override public void setCSVValues(String[] values) { field1 = values[0]; field2 = values[1]; } } class Class2 implements CSVConvertable { String f1 = ""; String f2 = ""; String f3 = ""; @Override public void setCSVValues(String[] values) { f1 = values[0]; f2 = values[1]; f3 = values[2]; } } public static &lt;T extends CSVConvertable&gt; HashMap&lt;String, T&gt; readTSV(String fileName, Class&lt;T&gt; c) throws InstantiationException, IllegalAccessException{ HashMap&lt;String, T&gt; hm = new HashMap&lt;String, T&gt;(); while(/* read rows in csv*/) { CSVConvertable conv = c.newInstance(); conv.setCSVValues(/*your row array here*/); } return hm; } static void main(String[] args){ HashMap&lt;String, Class1&gt; hm1 = new HashMap&lt;String, Class1&gt;(); hm1 = readTSV("firstFile.tsv", Class1.class); HashMap&lt;String, Class2&gt; hm2 = new HashMap&lt;String, Class2&gt;(); hm2 = readTSV("firstFile.tsv", Class2.class); ... } Reflection If you really want to use reflection here is a basic implementation for it. You should note however tho that this implementaion would change if you ever added a new property to the class, changed a property name or made the class extend another class. public static &lt;T&gt; List&lt;T&gt; readTSV(String fileName, Class&lt;T&gt; c) throws InstantiationException, IllegalAccessException, IntrospectionException, NoSuchFieldException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException{ List&lt;T&gt; list = new ArrayList&lt;T&gt;(); //error. List&lt;String&gt; properties = getBeanProperties(c); Collections.sort(properti…

http://stackoverflow.com/a/75004577
score: 5
has body: Although it is possible to remap the key or/and value in the collect part of the stream as shown in other answers, I think it should belong in the map part as that function is designed to transform the data within the stream. Next to that it should be easily repeatable without introducing additional complexity. The SimpleEntry object can be used which is already available since Java 6. With Java 8 import java.util.AbstractMap.SimpleEntry; import java.util.Map; import java.util.Map.Entry; import java.util.stream.Collectors; public class App { public static void main(String[] args) { Map&lt;String, String&gt; x; Map&lt;String, Integer&gt; y = x.entrySet().stream() .map(entry -&gt; new SimpleEntry&lt;&gt;(entry.getKey(), Integer.parseInt(entry.getValue()))) .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); } } With Java 9+ With the release of Java 9 a static method within the Map interface was introduced to make it easier to just create an entry without to instantiate a new SimpleEntry as shown in the previous example. import java.util.Map; import java.util.Map.Entry; import java.util.stream.Collectors; public class App { public static void main(String[] args) { Map&lt;String, String&gt; x; Map&lt;String, Integer&gt; y = x.entrySet().stream() .map(entry -&gt; Map.entry((entry.getKey(), Integer.parseInt(entry.getValue()))) .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); } }
answers question: http://stackoverflow.com/q/25903137
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/140141884
downvote count: 0

http://stackoverflow.com/q/25931426
has comment: http://stackoverflow.com/comment/41263670
answer count: 1
tagged with: shell
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40597848
tagged with: ibatis
has answer: http://stackoverflow.com/a/25931787
score: -4
tagged with: oracle11g
type: Question
tagged with: java
has title: How to process huge amount of data?
has body: Database used : Oracle 11g Operating System : Red hat linux Technology used : Java &amp; Ibatis Description : Have 2 tables (tableA and table B). TableA has more than 100000 records(12- 15 columns). TableB has more than 1000000 record(40 -45 columns). Need to check column1, column2, column3 and column4 values in tableA with column1 in tableB. If its available in tableB then i need to update other columns in tableA. How to do this? Issue : Currently we have done this using java/Ibatis. Frequently we are facing java heap space problems, since its included in, crontab for every 30min it will process the data and makes the environment slower. Current Approach: from table A - reference no, user name, age and status where fetched using below query select referenceno, name, age, status from tableA where status = 'FAILED'. its almost returning 20lac rows and the same is stored in arraylist. from the arraylist, each row is compared with referenceno, name, age in table as below select count(*) from tableB where referenveno= tableA.referenceno and name =tableA.name and age =tableA.age and deleteflag = 'N'.(as mentioned above tableB has almost 40lac records). If above query returns 1 then, it will update tableA with status as PASSED, if returns( &lt;1) it will update tableA with status as FAILED and remarks as no matching found. if returns ( >1) it will update tableA with Status as FAILED and remarks as 'more than one matching is found'. Hope using shell script / perl can do the job? Please suggest the best way to do this!!!
downvote count: 4
tagged with: perl
upvote count: 0

http://stackoverflow.com/q/26029828
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40772341
has comment: http://stackoverflow.com/comment/40772437
has comment: http://stackoverflow.com/comment/40772472
accepted answer: http://stackoverflow.com/a/26030035
has comment: http://stackoverflow.com/comment/40772751
has comment: http://stackoverflow.com/comment/40772327
answer count: 1
has title: Java reuse scanner
has comment: http://stackoverflow.com/comment/40772388
tagged with: java.util.scanner
has body: I'm trying to extract string from txt file with matching data with the problem below when I'm trying to reuse my scanner it consume all the resources and got stuck in the page String tmpStr1 = scanStr("Name :",streamData); String tmpStr2 = scanStr("Email :",streamData); //it got stuck on this line public String scanStr(String Str, String fileData){ Scanner s = new Scanner(fileData); while (s.hasNextLine()) { try{ s.findInLine(Str+" (\\S*)(.*)"); if(s.match()!=null) { MatchResult result = s.match(); s.close(); return result.group(1); } s.nextLine(); } catch (IllegalStateException e){ } } s.close(); return ""; } Is there any way to solve this problem? Many thanks.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26030035

http://stackoverflow.com/comment/40588995
type: Comment
has text: By "Algorithm for implementing Tic Tac Toe", do you mean an *agent* (AI player)? UI for playing? leaderboard? Please elaborate what exactly are you after. Also, what do you mean by "most efficient?" In what terms? (it is obviously highly related to the first question)
score: 1
comment on: http://stackoverflow.com/q/25928171
type: QuestionComment

http://stackoverflow.com/q/25883941
has comment: http://stackoverflow.com/comment/40517376
tagged with: http://stackoverflow.com/tag/pdf
answer count: 0
type: UnansweredQuestion
has title: Different output DOC, Excel and PDF in Jasper?
upvote count: 1
tagged with: excel
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40511934
type: Question
tagged with: jasper-reports
downvote count: 0
has body: Update When I use Jasper Report 5.6 version, the printed files(DOC, Excel and PDF) are different format as below images. In DOC and Excel, there missing things like subtotaland No. Column ($V{REPORT_COUNT}). PDF (Correct Outpt) DOC (Incorrect Outpt) EXCEL (Incorrect Outpt) 5.6 Code as below /*PDF File Generation */ JasperExportManager.exportReportToPdfFile(print, pdf_filePath); /*Excel File Generation */ JRXlsxExporter xlsEexporter = new JRXlsxExporter(); xlsEexporter.setExporterInput(new SimpleExporterInput(print)); xlsEexporter.setExporterOutput(new SimpleOutputStreamExporterOutput(new File(xls_filePath))); SimpleXlsxReportConfiguration config = new SimpleXlsxReportConfiguration(); xlsEexporter.setConfiguration(config); xlsEexporter.exportReport(); /*Doc File Generation */ JRDocxExporter docxExporter = new JRDocxExporter(); docxExporter.setExporterInput(new SimpleExporterInput(print)); docxExporter.setExporterOutput(new SimpleOutputStreamExporterOutput(new File(doc_filePath))); SimpleDocxReportConfiguration config = new SimpleDocxReportConfiguration(); docxExporter.setConfiguration(config); docxExporter.exportReport(); How can I solve this problem? What I need to do configuration SimpleXlsxReportConfiguration and SimpleDocxReportConfiguration?;
favorite count: 0

http://stackoverflow.com/comment/59742940
score: 0
type: Comment
has text: I tried the same on some other mac, and there both those urls work.
comment on: http://stackoverflow.com/a/36019834
type: AnswerComment

http://stackoverflow.com/comment/40576189
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25920318
has text: @DavidEisenstat - I'm not so sure about that being an abuse of the same kind as O(n/2). The [Wikipedia article on big-O notation](http://en.wikipedia.org/wiki/Big_O_notation), among others, explains: _"g(x) = h(x) + O(f(x))" expresses the same as "g(x) - h(x) ∈ O(f(x))"_. With that extension of notation (which is very common), n/2 + O(1) denotes "some function g(n) such that g(n) - n/2 ∈ O(1)," which should satisfy the most stringent notation police.

http://stackoverflow.com/comment/40643110
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25959258
has text: @BorjaSanchidriánMonge the arguments have to line up with the interface, in my example I used Runnable which declared run(), a no arg argument. I will add another example which takes an argument.

rabbitmq
tags question: http://stackoverflow.com/q/25927372
tags question: http://stackoverflow.com/q/25894665
tag name: rabbitmq
type: Tag
tags question: http://stackoverflow.com/q/25936488

http://stackoverflow.com/a/25975406
type: Answer
score: 0
has body: MtRoad's answer as a possible implementation. public class GameStateRunning { private final int TICKS_PER_SECOND = 30; private final double timePerTick = 1000 / TICKS_PER_SECOND; private final int MAX_FRAMESKIP = 5; private double next_game_tick = System.currentTimeMillis(); private int loops; private double extrapolation; public void update() { loops = 0; while (System.currentTimeMillis() &gt; next_game_tick &amp;&amp; loops &lt; MAX_FRAMESKIP) { // YOUR GAME UPDATE CODE GOES HERE next_game_tick += timePerTick; loops++; } if (next_game_tick &lt; System.currentTimeMillis()) { next_game_tick = System.currentTimeMillis(); } extrapolation = 1 - (next_game_tick - System.currentTimeMillis()) / timePerTick; } public void render() { // YOUR GAME RENDER CODE GOES HERE } Slick2d probably won't be faster than OpenGL, as Slick2d uses OpenGL.
answers question: http://stackoverflow.com/q/25880527

http://stackoverflow.com/comment/40496809
comment on: http://stackoverflow.com/a/25877010
type: AnswerComment
score: 0
type: Comment
has text: I have posted the full stack trace.

http://stackoverflow.com/comment/40945428
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25914987
type: QuestionComment
has text: @Leigh I can find nothing else about the error. That's why I turned here. Very frustrating.

http://stackoverflow.com/comment/40524545
has text: Don't use scriptlets, we are living in the 21st century, not the 11th century. Use EL Expressions.
type: Comment
comment on: http://stackoverflow.com/a/25893009
score: 2
type: AnswerComment

http://stackoverflow.com/comment/40554493
comment on: http://stackoverflow.com/a/25909079
type: Comment
has text: Thx man for your time thx a lot. i try the code before and it doesnt work now i will try this. thx again
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40503397
type: Comment
has text: I understand but I always seem to get an arrayoutofbounds error, how do I read in an arbitrary number of command line arguments from the file in to the String[] args array ? can i pass an ArrayList instead of String[] to the main ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25880969

http://stackoverflow.com/comment/40598287
score: 0
type: Comment
has text: Forget the last comment, this won't work precisely because of the DTD. The plugin could however be extended to support command-line configuration, this would work then. Please file an issue here: https://github.com/highsource/jaxb2-basics/issues if you want this.
comment on: http://stackoverflow.com/a/25933294
type: AnswerComment

http://stackoverflow.com/q/25943521
type: Question
has title: CollectionsUtils filter collections of objects using an object element collection
score: 0
accepted answer: http://stackoverflow.com/a/25943531
answer count: 1
has comment: http://stackoverflow.com/comment/40616758
has body: I have a Collection of HOUSE objects and each HOUSE object has elements - ID, NAME. I get a another collection of IDs from another source. I want to remove the HOUSE objects with these IDs from the Original Collection of HOUSE objects. I am trying something like this..but I can not pass exclusionIDsList to inner class Predicate. Any alternate ideas? List&lt;HOUSE&gt; originalHouses = ...//List of houses List&lt;ID&gt; exclusionIDsList = ...//List of IDs to exclude CollectionUtils.filter(originalHouses, new Predicate() { @Override public boolean evaluate(Object arg0) { if(exclusionIDsList.contains(((HOUSE)arg0).getID()) return false; else return true; } });
type: AnsweredQuestion
tagged with: apache-commons
tagged with: java
tagged with: collections
has answer: http://stackoverflow.com/a/25943531

http://stackoverflow.com/q/26010587
tagged with: stanford-nlp
tagged with: java
has comment: http://stackoverflow.com/comment/40751113
score: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/40737819
type: UnansweredQuestion
has title: Execution time optimization with serial execution of jar and c++ executable
has comment: http://stackoverflow.com/comment/40737384
tagged with: python
tagged with: c++
answer count: 0
has body: I am using co-reference resolution where we are amalgamating various functionality and executing them one by one to get final result. All executable are from different opensource provider. Implementing all functionalities like NER, POS, Parsing etc are not feasible for now. So I have to use the existing (and Stanford is best suitable for this). Issue is, it is taking much time to execute all one by one and give result. Around 25-30 seconds Everytime I execute, it compiles linked files and give output. Is that anyway to reduce this execution time? All commands are in .sh shell script and I am executing it via python file. Here are set of commands being executed Getting NER (Named entity recognization) java -mx700m -cp $1/stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -loadClassifier $1/classifiers/ner-eng-ie.crf-3-all2008-distsim.ser.gz -textFile $2 (java jar file) Getting POS (Part of speech) java -mx300m -classpath $1/stanford-postagger.jar edu.stanford.nlp.tagger.maxent.MaxentTagger -model $1/models/bidirectional-wsj-0-18.tagger -textFile $2 (java jar file) Using minipar parse for parsing the text tools/minipar/pdemo/pdemo -p tools/minipar/data/ &lt; $1 > $1.minipar (c++ executable) Detecting mentions java MentionDetection $1 (class file) java CreateNPSpan $1 $1.pred (class file) creating feature file java -cp .:edu.mit.jwi.jar CherryPick cr $1 cr joint model tools/svmrank/svm_classify $1 modelrank > $1.entities (c++ executable) Getting response java MakeResponse $1 (classfile)
type: Question

http://stackoverflow.com/comment/118157043
type: Comment
comment on: http://stackoverflow.com/a/25947999
has text: @Flic, it turned out I had the compiler set to Java8 which did not understand this.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40721970
comment on: http://stackoverflow.com/q/26001713
type: QuestionComment
has text: Also, you may take a look at [partial mocking](http://code.google.com/p/powermock/wiki/MockPartial).
score: 0
type: Comment

http://stackoverflow.com/comment/40583356
type: Comment
comment on: http://stackoverflow.com/a/25924099
score: 0
type: AnswerComment
has text: But I have been using the in and out on both for normal strings. Should I use just the one for strings too? Like I said I'm very new.

http://stackoverflow.com/a/25989991
has comment: http://stackoverflow.com/comment/40735349
accepted answer of: http://stackoverflow.com/q/25981224
has comment: http://stackoverflow.com/comment/40727670
has comment: http://stackoverflow.com/comment/40736395
has comment: http://stackoverflow.com/comment/40735611
answers question: http://stackoverflow.com/q/25981224
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40735970
score: 0
has comment: http://stackoverflow.com/comment/40732284
has body: So using only predicates available in the SWI-Prolog implementation, you can solve this in the following manner: Read first line, get last two characters of fourth word Read second line, do the same If they are the same, succeed and show the two characters Implementation: foo(X) :- last_two_chars_fourth_word(X), last_two_chars_fourth_word(X). Reading a line and taking last two chars of fourth word: Read character codes from input Split into words separated by a single space Take the last two chars of the fourth word Implementation: last_two_chars_fourth_word(X) :- read_line_to_codes(user_input, Line), atom_codes(A, Line), atomic_list_concat(Words, ' ', A), nth1(4, Words, W), sub_atom(W, _Before, 2, 0, X). If you want to read many lines you would have to adjust your foo/1 to only stop at the end of input. See the SWI-Prolog documentation on details.
type: Answer
has comment: http://stackoverflow.com/comment/40736659

http://stackoverflow.com/comment/40600492
has text: @JonSkeet: Apologies. Realised that was a rather terrible explanation. I've added the stack trace now. I hadn't included it originally as I figured this was some feature I was unaware of as opposed to an error in the code. Shouldn't have made that assumption.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25934791
score: 0

http://stackoverflow.com/q/25964452
has body: I wrote code in the class Password that generates a password given a certain length. The test driver PasswordTest input different lengths into the generatePassword method. Both programs compile but when I try to run PasswordTest.java I get the error: exception in the thread "main". How do I correct this error and get my test driver working? Here is the Password class: /** * Password.java -- Generates random passwords * @author Sam Harrison * @version 21-Sept-2014 * */ import java.util.Random; public class Password { public char randomChar(int length) { final int NUM_CHARS = 62; Random rand = new Random(); int num = rand.nextInt(NUM_CHARS); if (num &lt;= 9) num += 48; else if (num &lt;= 35) num += 55; else num += 61; return (char) num; } public String generatePassword(int length) { String str1 = "abcdefghijklmnopqrstuvwxyz1234567890"; Password randObj = new Password(); str1 = randObj.generatePassword(length); return str1; } } Here is the test driver: /** * PasswordTest.java * @author Sam Harrison * @version 21-Sept-2014 * */ public class PasswordTest { public static void main (String[] args) { int length = 3; Password randObj = new Password(); randObj.generatePassword(length); } }
has title: Random password generator test driver won't execute
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25964911
answer count: 1
score: 0
type: UnansweredQuestion
tagged with: passwords

http://stackoverflow.com/q/25959542
has comment: http://stackoverflow.com/comment/40643857
tagged with: android
tagged with: android-studio
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25959664
score: 0
has title: Android Studio "Unfortunately the Application had to stop" error.
answer count: 1
has answer: http://stackoverflow.com/a/25959664
has body: I am trying to pass some variables from one class to another in Android Studio, but my application keeps crashing and I don't know why. This is the method of the class that executes onClick and calls the other: public void sendInfo (View view) { Intent intent = new Intent(this, InfoActivity.class); EditText editText = (EditText) findViewById(R.id.editText); String name = editText.getText().toString(); EditText editText2 = (EditText) findViewById(R.id.editText2); String surname = editText2.getText().toString(); EditText editText3 = (EditText) findViewById(R.id.editText3); String mail = editText3.getText().toString(); EditText editText4 = (EditText) findViewById(R.id.editText4); String age = editText4.getText().toString(); InfoActivity activity = new InfoActivity(); activity.displayInfo(name,surname,mail,age); startActivity(intent); } And this is the method that is being called. It takes the parameters passed and adds them to a TextView: public void displayInfo(String name, String surname, String mail, String age) { TextView textview = (TextView) findViewById(R.id.textView); TextView textview2 = (TextView) findViewById(R.id.textView2); TextView textview3 = (TextView) findViewById(R.id.textView3); TextView textview4 = (TextView) findViewById(R.id.textView4); textview.setText(name.toString()); textview2.setText(surname.toString()); textview3.setText(mail.toString()); textview4.setText(age.toString()); } Any ideas why the app is crashing? What is wrong?

http://stackoverflow.com/comment/40776153
comment on: http://stackoverflow.com/q/26031664
score: 0
type: Comment
type: QuestionComment
has text: yes.when i add maven goal as jar:test-jar then run it will not generating test classes

http://stackoverflow.com/a/25999015
type: Answer
score: 15
has comment: http://stackoverflow.com/comment/86562628
answers question: http://stackoverflow.com/q/25998536
has comment: http://stackoverflow.com/comment/86655592
upvote count: 15
has comment: http://stackoverflow.com/comment/86564631
downvote count: 0
has body: Synchronizing those operations has no benefit here - it actually degrades performance if you don't need synchronization. The reason ConcurrentHashMap was created, is that synchronized maps (either implemented by hand like in the question or instantiated in the usual way with Collections.synchronizedMap(map)) show bad performance when accessed by many threads. Put and get operations are blocking, so all other threads have to wait and can't access the map concurrently. The ConcurrentHashMap - as the name suggest - allows concurrent access on the other hand. You lose this benefit if you add synchronization.

http://stackoverflow.com/comment/40649496
score: 0
comment on: http://stackoverflow.com/q/25962437
has text: what is your logcat showing???use system.out.println() in the button click to detect wheater the button click is fired
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40615502
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25942556
has text: I agree with the other commenters that this suffers from the XY problem. The way your example method works, the caller of the method could never notice what the (local) variable was called.

http://stackoverflow.com/comment/104288127
has text: Also it is good way of maintaining this in pom for deployment on multiple machines
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/29470713

http://stackoverflow.com/comment/40665434
type: Comment
comment on: http://stackoverflow.com/q/25971406
type: QuestionComment
score: 1
has text: What is the point of making a class private and method as public ?

http://stackoverflow.com/comment/40614495
type: Comment
comment on: http://stackoverflow.com/a/25941150
has text: @rjcarr You're synchronizing on both iteration and mutation. The list itself just does the mutation synchronization out of the box (the entire purpose of the `synchronizedList` method). It really boils down to this: it's not safe to mutate the list while something is iterating over it, but the list can't lock itself after it returns the iterator. So you either have to lock the list yourself or use a copy instead. (For a small list, I'd prefer a copy, actually. Much less hassle.)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40666646
type: Comment
type: QuestionComment
has text: It gives `org.hibernate.HibernateException: collection is not associated with any session`
score: 0
comment on: http://stackoverflow.com/q/25971953

http://stackoverflow.com/comment/83884851
comment on: http://stackoverflow.com/a/33385595
type: AnswerComment
has text: what the purpose of this script?
score: 0
type: Comment

http://stackoverflow.com/comment/40550364
score: 0
comment on: http://stackoverflow.com/a/25906996
type: Comment
has text: Thanks again but in your second solution, I need to have Instructions in the first one and in the second one I call first one.
type: AnswerComment

http://stackoverflow.com/a/26031968
answers question: http://stackoverflow.com/q/26031900
type: Answer
has body: w1 is an arrayList and do not have a method sortTemperature(). The method sortTemperature() is defined in the Object WetherList. So you have to read an object from the list w1.get(0)and then you can call sortTemperature(). w1.get(0).sortTemperature()
score: 0

http://stackoverflow.com/q/25929291
has title: Classifying data inside mongodb using naiva bayes
has comment: http://stackoverflow.com/comment/49474299
tagged with: lingpipe
score: 2
answer count: 0
upvote count: 3
tagged with: classification
tagged with: java
downvote count: 1
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/49505883
has body: I want to classify news in the mongodb database to certain specific categories using Naive Bayes. My training data contains different set of news of the fields sports, arts, entertainment etc. I have to train this data and build a model and then apply test data for checking its accuracy.. I have already done that which is showing good accuracy but the problem is that now I have to train data inside a database... I have used lingpipe tool for that... Now what I want is that my mongodb database has different sets of data based on each categories ...how can I train data inside a database...Is it possible???
has comment: http://stackoverflow.com/comment/49505545
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26028354
answers question: http://stackoverflow.com/q/26028087
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40770925
has body: The execute method returns a boolean indicating whether there is a ResultSet to be retrieved. Because this is a grant statement, there is no ResultSet. Returns: true if the first result is a ResultSet object; false if it is an update count or there are no results There is nothing wrong with a false return value here. Your statement seems to have executed successfully.
type: Answer
upvote count: 3

http://stackoverflow.com/comment/40560803
has text: Yup, that means you need to increase allocated your eclipse memory. Glad I could help. Make sure your shortcut to eclipse is executing those command line properties properly.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25912633

http://stackoverflow.com/comment/40692118
comment on: http://stackoverflow.com/q/25985679
score: 1
has text: Post stacktrace please
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25985297
linked to: http://stackoverflow.com/q/8769368
has answer: http://stackoverflow.com/a/56936137
has comment: http://stackoverflow.com/comment/40692986
linked to: http://stackoverflow.com/q/2390102
upvote count: 1
answer count: 1
has title: Is there any way to programmatically set the selection of a spinner by it's name?
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40730280
downvote count: 0
linked to: http://stackoverflow.com/q/11072576
score: 1
has comment: http://stackoverflow.com/comment/40693101
tagged with: java
type: Question
has body: I've been trying to figure this one out for a while now, but no matter how much I look, I haven't found an answer. So far I've checked the following questions: Set selected item of spinner programmatically, How to set selected item of Spinner by value, not by position?, and How to set position in spinner?. So far none of them have worked for me. I'm trying to do this on Android 4.4.2, and here's my code: String dataReturned11 = someData.getString("unitCheckFour", "degrees F"); if (dataReturned11 == ("degrees C")) { tempUnits.setSelection(((ArrayAdapter&lt;String&gt;)tempUnits.getAdapter()).getPosition("degrees C")); } else { tempUnits.setSelection(((ArrayAdapter&lt;String&gt;)tempUnits.getAdapter()).getPosition("degrees F")); }; What I'm trying to do is set it based on a value that was saved earlier, and it doesn't seem to be working. An important thing to note is that this gave me an unchecked cast warning, so I suppressed it. It does not seem to have had any effect on my problem whatsoever. EDIT: Since it was asked for, here is the code behind the spinner itself: tempUnits = (Spinner) findViewById(R.id.tempUnits); ArrayAdapter&lt;CharSequence&gt; adapter4 = ArrayAdapter.createFromResource(this, R.array.tempUnits, android.R.layout.simple_spinner_item); adapter4.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); tempUnits.setAdapter(adapter4); I hope this helps.

http://stackoverflow.com/a/25965057
score: 13
upvote count: 13
accepted answer of: http://stackoverflow.com/q/25939263
has body: Oracle Java SE Embedded and Oracle Java ME Embedded are both Oracle products. Since I'm just an engineer (and this is StackOverflow) I'll confine my comments to the technologies and set aside market positioning and licensing topics. For information on those topics please visit the linked product pages, or contact me and I can put you in touch with someone. Java SE Embedded is (or can be, depending upon configuration) a full Java SE runtime, just like the JRE/JDK for the desktop. It features the HotSpot JVM with JIT compiler and the full set of Java SE class libraries, or to reduce static footprint, it can be configured to support one of the three compact profiles defined in Java SE 8. It also supports platforms not supported by desktop Java, such as a variety of ARM processors, with hard or soft floating point, on several embedded Linux configurations. Typical configurations include 32MB of RAM and 10MB-48MB of static space, depending on which compact profile or full JRE is selected. Java ME Embedded is targeted at much smaller embedded configurations than SE Embedded. It has a JVM with a JIT compiler (the "Monty" JVM) but which is designed for low overhead and space efficiency instead of optimized runtime performance. There are also certain JVM and Java Language features not present in ME 8 compared to SE 8, such as user-defined classloaders, reflection, JNI, invokedynamic, method handles, and lambda expressions. Java ME 8 also features a radically subsetted class library, much smaller even than the SE 8 Compact-1 profile. Typical configurations will have 128K of RAM and 1MB of static footprint. For a complete specification of this environment (JVM subset spec, language subset spec, and class library APIs) see the JSR-360 Specification. (Requires click-through license.) There is some work underway to support lambda expressions in this environment; see the JVMLS 2014 talks page and look for "Closures on Embedded JVM" by Oleg Pliss. Note that this is early work, and …
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25939263
type: Answer

http://stackoverflow.com/q/25935094
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40601966
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25935950
has title: How to make button flashing after pressed?
has comment: http://stackoverflow.com/comment/40602605
has body: i want make Mediaplayer buttons which start flashing after pressed, and stop flashing until i press the next Mediaplayer button, which also start flashing. I've got buttons now flash when pressed but the problem now is that how can I get them to stop flashing when I press the next button. Now the buttons continue to flash when I press the next button. Here is my code i use now: mButton1 = (Button)findViewById(R.id.button1); mButton2 = (Button)findViewById(R.id.button2); mAnimation = new AlphaAnimation(1, 0); mAnimation.setDuration(500); mAnimation.setInterpolator(new LinearInterpolator()); mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.REVERSE); mButton1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mButton2.clearAnimation(); mButton1.startAnimation(mAnimation); { mp.release(); mp = MediaPlayer.create(Activity2.this, R.raw.audio_1); mp.setLooping(true); mp.start(); } } }); mButton2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mButton1.clearAnimation(); mButton2.startAnimation(mAnimation); { mp.release(); mp = MediaPlayer.create(Activity2.this, R.raw.audio_2); mp.setLooping(true); mp.start(); } } });
tagged with: android
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/25935950

http://stackoverflow.com/comment/40577732
comment on: http://stackoverflow.com/q/25921322
has text: Why not use a standard [Timer](http://developer.android.com/reference/java/util/Timer.html) then? `scheduleAtFixedRate(TimerTask task, long delay, long period)` allows you to create a timer that lasts forever, and then the onTick can be used in the Task that the fixedRate Timer creates.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/25971965
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26141011
upvote count: 2
tagged with: java
tagged with: solr
has body: I'm receiving sporadic SocketTimeoutException during the generation of a new SOLR index in the master (SOLR 4.5.0) Documents are sent in packs of 500 and the exception usually occurs after ~1 or 2 millions documents have been added. Here is the SOLR server side stacktrace: java.lang.RuntimeException: [was class java.net.SocketTimeoutException] null at com.ctc.wstx.util.ExceptionUtil.throwRuntimeException(ExceptionUtil.java:18) at com.ctc.wstx.sr.StreamScanner.throwLazyError(StreamScanner.java:731) at com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java:3657) at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:809) at org.apache.solr.handler.loader.XMLLoader.readDoc(XMLLoader.java:395) ... Caused by: java.net.SocketTimeoutException at org.apache.coyote.http11.InternalAprInputBuffer.fill(InternalAprInputBuffer.java:796) at org.apache.coyote.http11.InternalAprInputBuffer$SocketInputBuffer.doRead(InternalAprInputBuffer.java:827) at org.apache.coyote.http11.filters.ChunkedInputFilter.readBytes(ChunkedInputFilter.java:243) at org.apache.coyote.http11.filters.ChunkedInputFilter.parseCRLF(ChunkedInputFilter.java:326) at org.apache.coyote.http11.filters.ChunkedInputFilter.doRead(ChunkedInputFilter.java:128) at org.apache.coyote.http11.InternalAprInputBuffer.doRead(InternalAprInputBuffer.java:738) at org.apache.coyote.Request.doRead(Request.java:428) at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:304) at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:405) at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:327) at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:162) SOLR is running on Apache Tomcat (Version 6.0.26) and JAVA7. Connector in tomcat server.xml is configured: &lt;Connector port="1086" protocol="HTTP/1.1" URIEncoding="UTF-8" connectionTimeout="600000" redirectPort="8443" maxThreads="100" keepAliveTimeout="5000" maxKeepAliveRequests="5" minSpare…
type: Question
has title: Sporadic SocketTimeoutException in SOLR master when generating a new index
answer count: 1
downvote count: 0
tagged with: apr
tagged with: tomcat
tagged with: socket-timeout-exception
favorite count: 0

http://stackoverflow.com/comment/40608750
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25922612
has text: @StephenOstermiller. Executor service here is a boiler plate to make sure that your sample runs. It should be more elaborate in production. A good start is actually the JavaDoc for `ExecutorService`

http://stackoverflow.com/a/25980266
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: If I understand your question correct you have a Task object somewhere in your code and want to provide some additional functionality to it by extending the Task class itself. Well for me it sounds like you need some kind of a wrapper class. I would create the TaskHelper like this: public class TaskHelper { private Task taskObject; private String name; //Additional variables public TaskHelper(Task t) { taskObject = t; } public Task getTaskObject() { return taskObject; } //Setters, Getters and other methods working on the Task object and additional variables } Now you can access your Task object via the Getter and work with it normally and you can use the newly provided methods to work on your Task object. If you need the possibility to handle the TaskHelper as a normal Task object you need to extend the Task class, but thats easy too. Just create the TaskHelper class as you wrote and call the super() method (which calls the super classes constructor..) instead of your Task(t). Make sure that you provide all the information needed by the Task constructor in your TaskHelper constructor too. I hope that helped you a bit.
answers question: http://stackoverflow.com/q/25979884

http://stackoverflow.com/q/25982781
type: Question
tagged with: variables
has answer: http://stackoverflow.com/a/25982854
accepted answer: http://stackoverflow.com/a/25982922
has comment: http://stackoverflow.com/comment/40686770
possible better answer: http://stackoverflow.com/a/25982839
has answer: http://stackoverflow.com/a/25982899
upvote count: 1
tagged with: symbols
has answer: http://stackoverflow.com/a/25982839
has answer: http://stackoverflow.com/a/25982919
tagged with: calculator
has answer: http://stackoverflow.com/a/25982922
favorite count: 0
has comment: http://stackoverflow.com/comment/40686709
answer count: 5
has title: Trying to make a make a loan calculator, Can not find symbols
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I've searched all of google and here and can't figure out why my calculator isn't working. It seems that all of my variables and doubles are declared and called on at some point but it keeps saying "Can not find symbol." This applies to variables P, Y, and R. Can someone please help? Here's my code: import java.util.Scanner; public class Carloan { public static void main(String[] args){ int r = R / 1200; double n = 12 * Y; double payment = (P * r) / (1 - Math.pow(1+r, -n)); double interest = payment * n - P; int P; int Y; double R; Scanner input = new Scanner (System.in); //double P; System.out.println("Enter loan amount: $" + P); P = input.nextInt(); //double Y; System.out.println("Enter number of years: " + Y); Y = input.nextInt(); //double R; System.out.println("Enter interest rate: %" + R); R = input.nextDouble(); System.out.println("Monthly payments = " + payment); System.out.println("Total interest = " + interest); } }

http://stackoverflow.com/q/25983535
type: Question
tagged with: android-layout
answer count: 1
score: 0
tagged with: android
has title: viewpager inside of framelayout
type: UnansweredQuestion
tagged with: android-fragments
has body: My example is composed of a Mainactivity.java (FragmentActivity), a Fragment Called Fragment_ViewPager (Fragment), an adapter Adapter_ViewPager (FragmentPagerAdapter) and three fragments are common fragments Fragment extentienden and have a method onCreateView. Mainactivity.java public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); FragmentManager FM = getSupportFragmentManager(); FragmentTransaction FT = FM.beginTransaction(); Fragment_ViewPager f_pager = new Fragment_ViewPager(); FT.add(R.id.fragment_container, f_pager); FT.commit(); } } activity_main.xml &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_container" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;/FrameLayout&gt; Fragment_ViewPager.java private static final int[] ICONS = new int[] { R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher }; private FragmentPagerAdapter mFragmentPagerAdapter; private ViewPager mViewPager; private TabPageIndicator mTabPagerIndicator; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.f_pager, container, false); mFragmentPagerAdapter = new Adapter_ViewPager(getActivity().getSupportFragmentManager(), ICONS); mViewPager = (ViewPager)v.findViewById(R.id.view_pager_inicio); mViewPager.setAdapter(mFragmentPagerAdapter); mTabPagerIndicator = (TabPageIndicator)v.findViewById(R.id.tab_indicator_inicio); mTabPagerIndicator.setViewPager(mViewPager); return v; } fragment_viewpager.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:orientation="vertical" &gt; &lt;com.viewpagerindicator.TabPageIndicator a…
tagged with: java
has answer: http://stackoverflow.com/a/25983594

http://stackoverflow.com/q/25919083
linked to: http://stackoverflow.com/q/750310
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/85722770
has answer: http://stackoverflow.com/a/49378186
has comment: http://stackoverflow.com/comment/40573583
has body: I want to print a very large panel and this panel contains some components like jtable, jlabel and others jpanel. Now i want to print it in differents pages. But i don't know how to do it. I have implemented Printable in my panel class. But if i print it, I get only one page.
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/25919384
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40573014
has comment: http://stackoverflow.com/comment/40572628
has title: How to print a large JPanel in several page
has comment: http://stackoverflow.com/comment/40573426
score: 0
has comment: http://stackoverflow.com/comment/40573370
tagged with: printing
favorite count: 0
has comment: http://stackoverflow.com/comment/40572905

http://stackoverflow.com/comment/40540560
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25901673
has text: Might be irrelevant to question directly, but this would be a side effect. Try calling `registerElseGet(null);` It will throw exception, you need to be aware of that.
type: Comment

http://stackoverflow.com/comment/41808116
score: 0
has text: @KrzysztofJabłoński what you want is a **jagged array** you can look for it on the google
type: Comment
comment on: http://stackoverflow.com/a/25988264
type: AnswerComment

http://stackoverflow.com/a/25929823
accepted answer of: http://stackoverflow.com/q/25918292
type: Answer
answers question: http://stackoverflow.com/q/25918292
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40607803
has body: HttpHost represents a physical endpoint. It only contains authority part (scheme, host and port) of a URI. It does not contain a path. Request URI represents a resource that potentially can be virtual. There can be no conflicts. Only if HttpHost is not explicitly given the authority part of the request URI is assumed to be the physical endpoint For instance HttpHost = http://www.google.com:-1 Request URI = http://www.google.ch/stuff Will result in the following message composition TCP localhost:&lt;random&gt; -&gt; www.google.com:80 HTTP GET /stuff HTTP/1.1 Host: www.google.ch You can see this behavior in the AbstractHttpClient.determineTarget private helper method, which despite changing radically between 4.0 and 4.3.5 extracts just the scheme, host and port from the URI for variants of execute which don't supply an HttpHost. The code for where the target and request are composed back into the final route is more convoluted, but a careful reading of HttpRoute, HttpRoutePlanner, and HttpRequest impl methods all clearly refer to the host or hostTarget coming from the HTTP host and the path (and params and fragment) coming from the local part, which comes from the HttpRequest.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26033985
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/64138743
tagged with: testng-dataprovider
answer count: 2
has title: How to pass parameter to data provider in testng from csv file
has body: Am reading data from csv file , i have test for which this data will be the input . i want it to run as tescase for every set of value. for that am using data provider The problem is , it is taking only the last set row of data , please help me in debugging the code For eg : if my csv has following data name1 id1 text1 name2 id2 text2 name3 id3 text3 it taking only last row name3 id3 text3 and running the test only once not three times. @DataProvider(name = "test") public Object[][] provider( ) throws InterruptedException { Object[][] returnObject ; String[] checkpoint = ReadfromCSV(); count = count + 1; returnObject = new Object[][]{checkpoint }; return returnObject; } @Test(description = "Test", groups = "test" , dataProvider = "test") public void compare(String val1,String val2,String val3,String val4,String val5,String val6,String val7,String val8,String val9,String val10,String val11 ) { System.out.println("1:" + val1); System.out.println("4:" + val2); System.out.println("5:" + val3); } @SuppressWarnings("null") public String[] ReadfromCSV() throws InterruptedException { String[] data= null; String csvFile = "F:/sample1.csv"; BufferedReader br = null; String line = ""; String cvsSplitBy = ","; try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { // use comma as separator data= line.split(cvsSplitBy); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } System.out.println("Done"); return data; }
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26034191
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
tagged with: test-data
tagged with: testng

http://stackoverflow.com/q/25905217
score: 0
tagged with: java
has title: Extends Thread and implement runnable simultaneously
accepted answer: http://stackoverflow.com/a/25905236
answer count: 1
has comment: http://stackoverflow.com/comment/40554761
has body: When I should use class MyThread extends Thread implements Runnable{ //any statement. } And what is the significance of using both type of thread creation at a single time.
has comment: http://stackoverflow.com/comment/40600180
has comment: http://stackoverflow.com/comment/40588270
type: AnsweredQuestion
type: Question
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40561180
linked to: http://stackoverflow.com/q/541487
has answer: http://stackoverflow.com/a/25905236

http://stackoverflow.com/a/25925558
score: 0
has body: I am guessing if you just changed total to long and left numToSell and lastMax as int, then numToSell*lastMax would still overflow and giving you incorrect result which is then added onto total
answers question: http://stackoverflow.com/q/25925478
type: Answer

http://stackoverflow.com/a/25929169
has body: Ok. Let's try in this way public static void main(String[] args){ System.out.println(withTernary(null, null)); } private static Boolean withTernary(String val, Boolean defVal){ return (val == null ? defVal : Boolean.valueOf("true".equalsIgnoreCase(val))); } Now it will works fine. Now there is no unboxing here and will not give you exception. But in other way due to null unbox you will get NPE public static void main(String[] args){ System.out.println(withTernary(null, null)); //Null Pointer } private static Boolean withTernary(String val, Boolean defVal){ return (val == null ? defVal : "true".equalsIgnoreCase(val)); }
downvote count: 0
answers question: http://stackoverflow.com/q/25928896
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/25908185
score: 1
has comment: http://stackoverflow.com/comment/40552219
has comment: http://stackoverflow.com/comment/40552533
has body: Type parameters are not optional: List is a fundamentally different type than List&lt;Object&gt;. The only reason raw types exist in Java is legacy code. You should never write code which introduces a new occurrence of a raw type. One important case where the difference between List and List&lt;Object&gt; becomes crucial would be the following: static void addObject(List&lt;Object&gt; objs) { objs.add("a"); } static void addObjectToRaw(List objs) { objs.add("a"); } public static void main(String[] args) { final List&lt;Boolean&gt; bools = new ArrayList&lt;&gt;(); addObject(bools); // compiler detects error addObjectToRaw(bools); // compiler is silent } Accepting a raw List as an argument has the effect of removing all type safety.
has comment: http://stackoverflow.com/comment/40553109
upvote count: 1
has comment: http://stackoverflow.com/comment/40552907
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25907991
type: Answer
answers question: http://stackoverflow.com/q/25907991
downvote count: 0

http://stackoverflow.com/q/25929544
answer count: 1
has body: I'm using TestNG 6.8.8 in Intellij IDEA 13.4, logback 1.1.2. I have bunch of test classes, and have xml launcher like this: <?xml version="1.0" encoding="UTF-8"?> <suite name="Example" parallel="tests" thread-count="3"> <class name="ExampleClass1"/> <class name="ExampleClass2"/> <class name="ExampleClass3"/> also, each class have MDC mark to distinct test classes: MDC.put("testName", "ExampleClass1"); and logback.xml: %d{HH:mm:ss.SSS} %C [%X{testName}] - %m%n INFO <appender-ref ref="console" /> when I change xml runner to thread-count="1" everything is fine - console logs each test in it's own tree node. But when i run TestNG with thread-count="3" or more, some log entries shown not in their own test tree node, but in some others. for example, console output in tree node for test "test1" can be: 11:53:28.388 ExampleClass1 [ExampleClass1] - logEntry 11:53:28.388 ExampleClass2 [ExampleClass2] - logEntry 11:53:29.800 ExampleClass1 [ExampleClass1] - logEntry2 11:53:29.958 ExampleClass2 [ExampleClass2] - logEntry2 So, log entry of class ExampleClass2 is shown as result of execution of ExampleClass1, while console output in tree node for test "test2" is empty. also, xml export of console output shows, that some log values goes to different test results. How Intellij desides for each output line which test is responsible for? Is there any way to enforce Intellij IDEA to somehow check which log entry which class is responsible for by MDC mark? or is there any other way to make sure console output is on it's place in test tree?
favorite count: 0
tagged with: testng
tagged with: mdc
upvote count: 1
has title: Console output in parallel tests shown in different test tree, than was launched in
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/25943310
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25943310
tagged with: intellij-idea
downvote count: 0
tagged with: logback

http://stackoverflow.com/a/25960124
type: Answer
answers question: http://stackoverflow.com/q/25958471
score: 0
has body: use beyond compare, it's a great tool for comparing classes, and methods! download beyond compare

http://stackoverflow.com/comment/40615384
score: 0
comment on: http://stackoverflow.com/q/25942456
type: Comment
has text: @Makoto : This problem and the one in the `Scanner issue when using nextLine after nextXXX` post are different, this is not a duplicate. He is not calling nextLine(), he just misuses nextDouble().
type: QuestionComment

http://stackoverflow.com/comment/88039395
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25986239
has text: Adam, add @Valid to interface `public interface Service<T> { T execute(@Valid T item); }`
score: 0

http://stackoverflow.com/comment/40601495
score: 3
type: AnswerComment
has text: As I said its a jar library and I don't have access to it's field component. I just have above code and that's all to create and add jDatePicker.
comment on: http://stackoverflow.com/a/25935411
type: Comment

http://stackoverflow.com/comment/40492338
score: 0
comment on: http://stackoverflow.com/q/25874831
has text: @Ordous I use the variable in calculations. So I decided to ONLY show currency when an item is about to be displayed. @Dave It could be 100, 100.00 or $100. I simply want to take either one and covert it to a `double` (or `BigDecimal` -- but these are basic, basic calculations).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40657130
comment on: http://stackoverflow.com/q/25966456
has text: Maybe i will remove that code. Sorry..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25895759
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25896478
accepted answer: http://stackoverflow.com/a/25896478
has body: There is a Scala library (that only exists written in Scala) that I really want to use in my Java app. I am trying to evaluate whether I can do this or not without suffering any hidden gotchyas/caveats/pitfalls. So I went straight to the Scala FAQ, where they answer this very question (well, sort of): Accessing Java classes from Scala code is no problem at all. Using a Scala class from Java can get tricky, in particular if your Scala class uses advanced features like generics, polymorphic methods, or abstract types. I then found several other sites (such as this one) that seem to indicate there is no problem in calling Scala from inside Java, as it is all compiled JVM bytecode. So I have two very conflicting sources of information, and I'm stuck in the middle trying to determine what use cases make calling Scala from Java "tricky", and which use cases are straight forward. Any ideas?
has comment: http://stackoverflow.com/comment/40529672
has title: "Trickiness" to calling Scala code from Java?
has comment: http://stackoverflow.com/comment/40529754
upvote count: 5
downvote count: 0
tagged with: scala-java-interop
tagged with: scala
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40529703
tagged with: java
type: Question
score: 5

http://stackoverflow.com/a/26035998
has comment: http://stackoverflow.com/comment/40964527
has body: When creating a HazelcastInstance using Hazelcast::newHazelcastInstance you can give it a Config instance as parameter. If you don't do that the Config instance is created from classpath-available config files. XmlConfigBuilder can create Config from those files, too. After you got the Config instance you call Config::setConfigClassLoader and set it to your bundle classloader. Config config = new XmlConfigBuilder().build(); config.setClassLoader(getBundleClassLoader()); HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/40814567
accepted answer of: http://stackoverflow.com/q/26033192
type: AcceptedAnswer
upvote count: 6
answers question: http://stackoverflow.com/q/26033192
type: Answer

http://stackoverflow.com/comment/40731597
comment on: http://stackoverflow.com/a/26007119
has text: Query is: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> PREFIX dbpedia: <http://dbpedia.org/resource/> SELECT DISTINCT ?abstract WHERE { _:b0 rdfs:label \"" + New York + "\"@en . _:b0 dbpedia-owl:abstract ?abstract FILTER langMatches(lang(?abstract), "en") }
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40736546
has text: sorry to unclear it. the query like 'select s from Student s inner join s.courses c where c.id = 1 or c.id is null'. if i check course id with null it showing exception.
type: AnswerComment
comment on: http://stackoverflow.com/a/26009816
score: 0
type: Comment

http://stackoverflow.com/q/26017319
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40751668
has body: I am currently working on a Java project involving building interface to read and write from an AS/400 file using hibernate. The file has a key list, but is not unique, i.e. there are multiple records with identical keys in it. If the Java interface is to retrieve a list of records with the same key list from this file, how should the hibernate mapping look like?
linked to: http://stackoverflow.com/q/767277
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41251298
tagged with: ibm-midrange
type: Question
has title: How to create hibernate mapping for AS/400 file without unique key?
answer count: 0

http://stackoverflow.com/q/25943373
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/8526907
favorite count: 0
has title: Array initialization - performance differences
has comment: http://stackoverflow.com/comment/40616638
has body: If I run this program the output is: init: 1239.0 toCharArray: 1343.6 arraycopy: 1583.8 The first question is: Why init() is faster than toCharArray()? Is there a compiler optimization here? (I am using Java 1.8.0_20) The second question is: Why toCharArray() is faster than arraycopy()? I copied arraycopy() from here: String.toCharArray(). public class MyClass { private static char[] SRC = { 'a', 'b', 'c', 'd', 'e', 'f', 'g' }; public static void main(String[] args) { long start = 0; int init = 0, toCharArray = 0, arraycopy = 0; for (int j = 0; j &lt; 5; j++) { start = System.currentTimeMillis(); for (int i = 0; i &lt; 100000000; i++) init(); init += (System.currentTimeMillis() - start); start = System.currentTimeMillis(); for (int i = 0; i &lt; 100000000; i++) toCharArray(); toCharArray += (System.currentTimeMillis() - start); start = System.currentTimeMillis(); for (int i = 0; i &lt; 100000000; i++) arraycopy(); arraycopy += (System.currentTimeMillis() - start); } System.out.println("init: " + init / 5.0); System.out.println("toCharArray: " + toCharArray / 5.0); System.out.println("arraycopy: " + arraycopy / 5.0); } private static void init() { char[] c = { 'a', 'b', 'c', 'd', 'e', 'f', 'g' }; doSomething(c); } private static void toCharArray() { char[] c = "abcdefg".toCharArray(); doSomething(c); } private static void arraycopy() { char[] c = new char[SRC.length]; System.arraycopy(SRC, 0, c, 0, SRC.length); doSomething(c); } private static void doSomething(char[] c) { for (int i = 0; i &lt; c.length; i++) c[i] = ' '; } } EDIT Caliper result: init: min=11.90, 1st qu.=12.27, median=12.48, mean=12.44, 3rd qu.=12.54, max=13.16 toCharArray: min=13.10, 1st qu.=13.21, median=13.39, mean=13.49, 3rd qu.=13.78, max=14.27 arraycopy: min=15.42, 1st qu.=15.49, median=15.51, mean=15.51, 3rd qu.=15.55, max=15.58
accepted answer: http://stackoverflow.com/a/25944038
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26361070
type: Question
has comment: http://stackoverflow.com/comment/40616778
possible better answer: http://stackoverflow.com/a/26361070
tagged with: arrays
has comment: http://stackoverflow.com/comment/40616901
has answer: http://stackoverflow.com/a/25944038

http://stackoverflow.com/comment/40775650
type: QuestionComment
type: Comment
has text: the thread in which you declare wait() will wait. It will resume its execution when you notify him.
comment on: http://stackoverflow.com/q/26031724
score: 0

http://stackoverflow.com/q/25949275
tagged with: date-format
tagged with: android
has comment: http://stackoverflow.com/comment/40626567
tagged with: internationalization
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/1661325
has comment: http://stackoverflow.com/comment/40628658
score: 0
answer count: 1
has title: Partial date format in different locales
has body: I wanted to have my app display September 2014 in English locale and 2014年9月 in Chinese locale. Are there any way in Java (especially, Java 1.6 in Android) can do this? I am interesting in the "natural" way to display the year and the month in a specific culture. So English and Chinese cultures are just an example, and the solution shall work for all system supported cultures. For the example above, if I have something like 9月 2014 I am sure every Chinese speaker will know what it means but it is just looked very odd in that culture. On the other hand, 2014年九月 is acceptable. Attempts The pattern for SimpleDateFormat need you to specify the order of year and month field. Since this is vary in different languages this is not going to solve it. If you try to bend the rule to allow displaying 2014, September for English and 2014年, 9月 for Chinese (this is acceptable, but 2014, 9月 is still odd) and consider Calendar.getDisplayName, unfortunately it returns null for Calendar.Year.
linked to: http://stackoverflow.com/q/1951849
has answer: http://stackoverflow.com/a/25949724
has comment: http://stackoverflow.com/comment/40628604
type: UnansweredQuestion

http://stackoverflow.com/a/25926513
answers question: http://stackoverflow.com/q/25926404
type: Answer
has comment: http://stackoverflow.com/comment/40586089
score: 2
upvote count: 2
has body: This should restrict the input to start and end with alphanumeric, and allow multiple consecutive - and _ within the input. ^[a-zA-Z0-9]++(?:[-_]++[a-zA-Z0-9]++)*+$ I turn all the quantifiers possessive (++ and *+ instead of + and *), to disallow backtracking.
downvote count: 0

http://stackoverflow.com/comment/40766786
type: AnswerComment
comment on: http://stackoverflow.com/a/26026583
has text: Thank you that removes my crash at least. I'm still interested in seeing if my approach was possible, but I'm happy to have it not crash.
score: 0
type: Comment

http://stackoverflow.com/a/26025298
has body: You're missing the fact that every time the length changes, the entries are redistributed - they're put in the new buckets appropriately. That's why it takes a bit of time (O(N)) when the map expands - everything needs to be copied from the old buckets to the new ones. So long as you only ever have indexes for one length at a time (not a mixture), you're fine.
accepted answer of: http://stackoverflow.com/q/26025236
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26025236
type: Answer
score: 7
has comment: http://stackoverflow.com/comment/40764202
upvote count: 7

http://stackoverflow.com/comment/40703439
has text: An (old) bug suggests that this behaviour is a bug: ['Design For Extension check should skip toString() ... and maybe hashCode() and equals()](http://sourceforge.net/p/checkstyle/bugs/295/). It's currently still open.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25992067
score: 1

http://stackoverflow.com/comment/40645331
type: QuestionComment
comment on: http://stackoverflow.com/q/25960504
has text: Have you tried anything at all? If so, add the code to the question. The question is too broad too. For example are you using any ORM framework like JPA/Hibernate?
score: 0
type: Comment

http://stackoverflow.com/a/36121405
type: Answer
has body: Definitely pay attention to those transitive dependencies. There's about 5 or more different ways you can enable or view the @EnableAutoConfiguration report. The report will show you: what's enabled what's disabled what's excluded configurations that are unconditional As an application argument --debug As a VM argument -Ddebug As an environment variable export DEBUG=true // UNIX based set DEBUG=true // Windows based By adding a property to your application.properties debug=true Adjusting the log level in your application.properties logging.level.=debug Adjusting the log level of the report generator class in your application.properties Spring Boot 1.x logging.level.org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer=debug Spring Boot 2.x logging.level.org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener=debug
upvote count: 6
score: 6
accepted answer of: http://stackoverflow.com/q/25989245
answers question: http://stackoverflow.com/q/25989245
has comment: http://stackoverflow.com/comment/105152398
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40707210
comment on: http://stackoverflow.com/q/25994475
has text: Did you mean something like this?? http://stackoverflow.com/questions/9105277/reverse-string-word-by-word-in-java
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40565901
comment on: http://stackoverflow.com/q/25915684
type: Comment
score: 1
type: QuestionComment
has text: Not enough information for profound answers. In any case, consider putting the data into some external storage, and **NOT** into the source code. (Use a database, or at least a file that you can load at runtime)

http://stackoverflow.com/a/77886796
type: Answer
answers question: http://stackoverflow.com/q/26017545
score: 0
has body: Files.walk(Paths.get("C:\\Temp\\samplefolder")) // works recursively .map(Path::toFile) // use Java File object .filter(File::isDirectory) // only consider directories .filter(f -> f.length() == 0) // make sure no files or directories are in it .filter(f -> FileUtils.sizeOfDirectory(f) == 0) // use Apache FileUtils here .forEach(File::delete); // go and delete This code should work also without Apache Fileutils.sizeOfDirectory() as it counts files and sub-directories inside a directory already.

currency
tag name: currency
tags question: http://stackoverflow.com/q/25897932
type: Tag
tags question: http://stackoverflow.com/q/25910883
tags question: http://stackoverflow.com/q/25905519

http://stackoverflow.com/a/25897839
has comment: http://stackoverflow.com/comment/40533606
type: Answer
has comment: http://stackoverflow.com/comment/40533530
upvote count: 6
score: 6
has body: Lists.transform returns a List that is a view of the original List. If you add or remove items in the original list, the view will change as well. FluentIterable.from(list).transform similarly returns a transformed view of the original list, though as a FluentIterable rather than as a List. When you call toList() on it, though, you get back an ImmutableList which will not change if the original list changes (or ever for that matter).
accepted answer of: http://stackoverflow.com/q/25897767
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25897767

http://stackoverflow.com/comment/40562965
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25914142
has text: please tag question to appropriate/relevant one's. Looks like its java question, but you have tagged it to javascript.

http://stackoverflow.com/comment/40527449
comment on: http://stackoverflow.com/q/25894499
type: Comment
type: QuestionComment
score: 1
has text: Very simply, an array can contain components or elements. Elements are individual primitives/class types/interface types, that are not arrays. Arrays can contain other arrays and those arrays can contain other arrays and so on but finally the inner most array should have something which is not an array and that is the element type.

http://stackoverflow.com/a/25965686
has comment: http://stackoverflow.com/comment/40655442
type: Answer
has comment: http://stackoverflow.com/comment/40655402
has comment: http://stackoverflow.com/comment/40655414
has body: Simply do double parsedDouble = Double.parseDouble(scan.nextLine()); However, this is a stupid question because it would be better to do double parsedDouble = scan.nextDouble();
score: 0
has comment: http://stackoverflow.com/comment/40655475
answers question: http://stackoverflow.com/q/25965675

http://stackoverflow.com/q/26028171
accepted answer: http://stackoverflow.com/a/26042439
tagged with: gradle
type: Question
has body: So I am running ProGuard for the first time and I am getting a weird error: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:proguardRelease'. &gt; java.io.IOException: Can't read [C:\Users\Some\workspace\MyApp\app\bin\classes] (No such file or directory) * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Here is my gradle: apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion '19.1.0' defaultConfig { minSdkVersion 16 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-v4:19.0.+' compile 'com.google.android.gms:play-services:4.3.23' compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.viewpagerindicator:library:2.4.1@aar' compile group:'com.android.support', name:'appcompat-v7', version:'18.0.+' compile 'com.squareup.picasso:picasso:2.3+' compile 'com.github.castorflex.smoothprogressbar:library:0.4.0' } allprojects { gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs &lt;&lt; "-Xlint:unchecked" &lt;&lt; "-Xlint:deprecation" } } } my proguard-rules.txt: -injars bin/classes -injars libs -outjars bin/classes-processed.jar -libraryjars /usr/local/java/android-sdk/platforms/android-9/android.jar -dontpreverify -repackageclasses '' -allowaccessmodification -optimizations !code/simplification/arithmetic -keepattributes *Annotation* -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.view.View { public &lt;init&gt;(android.content.Context); public &lt;init&gt;(android.content…
upvote count: 9
has comment: http://stackoverflow.com/comment/40769925
tagged with: java
score: 9
answer count: 2
downvote count: 0
has title: Android Studio - ProGuard "java.io.IOException ...bin\classes (No such file or directory)"
has answer: http://stackoverflow.com/a/26042439
favorite count: 0
has answer: http://stackoverflow.com/a/36881805
tagged with: android
tagged with: proguard
tagged with: android-studio
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/36881805

http://stackoverflow.com/q/25874057
has answer: http://stackoverflow.com/a/25874587
tagged with: rcp
tagged with: eclipse
upvote count: 1
answer count: 1
downvote count: 0
has body: I'm having troubles with a custom Dialog in Eclipse. in the first place, I created a Class that extend Dialog. public class ModificarGrupoBCDialog extends Dialog { private static final int CANCELAR = 999; private static final int MODIFICAR = 1; ... somewhere I create the buttons... protected void createButtonsForButtonBar(Composite parent) { this.createButton(parent, MODIFICAR, "Modificar", true); this.getButton(MODIFICAR).setEnabled(puedeAltaGrupoBC()); this.bt_ok = this.getButton(MODIFICAR); this.createButton(parent, CANCELAR, "Cancelar", false); Display display = window.getShell().getDisplay(); Image image = new Image(display, ModificarGrupoBCDialog.class.getResourceAsStream("/icons/modificar.png")); this.getButton(MODIFICAR).setImage(image); image = new Image(display, ModificarGrupoBCDialog.class.getResourceAsStream("/icons/cancelar.png")); this.getButton(CANCELAR).setImage(image); } and when the user clicks... protected void buttonPressed(int buttonId) { switch (buttonId) { case MODIFICAR: // Some Code, for Change Button break; case CANCELAR: setReturnCode(CANCELAR); close(); break; } Finally, this is how I open and get the returnCode, in the caller object. ... ModificarGrupoBCDialog modificarGrupoBC = new ModificarGrupoBCDialog(window.getShell(), window, gr_bc); if (modificarGrupoBC.getReturnCode() == Window.OK) { //... Some code on OK } else { //another code when cancel pressed. } ; as you can see, after trying a while, I have to write setReturnCode() in CANCELAR switch block, is that OK ? I spect that Dialog class automatically asign the correct return code. May be someone could point me to a good sample. I'm reading Vogela's blog, and may be the solution is to override okPressed() method ? Best Regards.
favorite count: 0
tagged with: jface
has title: Jface Dialog, How to retrieve correctly what button pressed the user?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25874587
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/73885775
type: Comment
type: QuestionComment
has text: @aleksey-shipilev @tagir-valeev I found that disabling of the JIT compiler with `-Djava.compiler=NONE` option gives some difference with non-volatile fields on my platform. https://gist.github.com/qwazer/e4341f0153f525f088fa227348e69734
comment on: http://stackoverflow.com/q/25931376
score: 0

http://stackoverflow.com/q/25960901
has answer: http://stackoverflow.com/a/25961546
accepted answer: http://stackoverflow.com/a/25961546
has comment: http://stackoverflow.com/comment/40646375
has comment: http://stackoverflow.com/comment/40646106
has body: I want to build a programm, which connects to a database. Inprinciple, my code works. I use "Hibernante-4.3.1" and a postgresql-driver "postgresql-9.3-1100.jdbc41.jar". My persistence.xml looks like this: org.hibernate.ejb.HibernatePersistence <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/> <property name="hibernate.connection.username" value="******"/> <property name="hibernate.connection.password" value="******"/> <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/*******"/> <property name="hibernate.hbm2ddl.auto" value="create"/> For localhost, it's okeyishly fast, but if I want to connect to a external server via internet, it takes about 30-60 seconds to establish the connection. Once it is initialised, all subsequent requests are executed fast enough, but the first call is taking way to long. I could restructure the whole project as a WEB-Project and make a JBoss Datasource via JTA. That way, the connection is established before the programm starts and all would be fine. But I'd would like it a lot more to have if I didn't have to do that. What's the right way to connect like this? Edit: Some more information: The line which takes the long time is: javax.persistence.EntityManagerFactory emf = Persistence.createEntityManagerFactory("OneGramService"); Greetings, Rhodarus
type: Question
tagged with: database
has comment: http://stackoverflow.com/comment/40652525
has title: Efficient way to connect to database (by performance)
has comment: http://stackoverflow.com/comment/40646105
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/25924445
answer count: 2
tagged with: sorting
has comment: http://stackoverflow.com/comment/40582427
has comment: http://stackoverflow.com/comment/40582241
has title: Sorting strings alphabetically without arrays in java
has comment: http://stackoverflow.com/comment/40582478
favorite count: 0
has comment: http://stackoverflow.com/comment/40582375
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/40582318
upvote count: 1
has answer: http://stackoverflow.com/a/25924906
has comment: http://stackoverflow.com/comment/40582264
tagged with: conditional-statements
tagged with: java
has answer: http://stackoverflow.com/a/25927113
score: -1
type: Question
has body: So for this program I need to obtain three strings from a user and sort those strings alphabetically. The caveat is that I cannot use arrays. Also if the string does not start with an alphabetic letter than it is not accepted. So far I have managed to get the three strings from the user and am able to determine if they should be accepted on or not. What I can't figure out is how to sort them alphabetically. The main issue I am having is ignoring the strings that weren't accepted when sorting. Here is the code to get the strings from the user. Scanner scan = new Scanner(System.in); System.out.print("Please input the first name: "); String name1 = scan.nextLine(); name1 = name1.substring(0, 1).toUpperCase() + name1.substring(1,name1.length()).toLowerCase(); if (name1.charAt(0) &gt;= 'A' &amp;&amp; name1.charAt(0) &lt;= 'Z' ){ System.out.println("The first name is: " + name1); }else{ System.out.println("Error: The name was not accepted"); name1 = null; } System.out.print("Please input the second name: "); String name2 = scan.nextLine(); name2 = name2.substring(0, 1).toUpperCase() + name2.substring(1,name2.length()).toLowerCase(); if (name2.charAt(0) &gt;= 'A' &amp;&amp; name2.charAt(0) &lt;= 'Z'){ System.out.println("The second name is: " + name2); }else{ System.out.println("Error: The name was not accepted"); name2 = null; } System.out.print("Please input the third name: "); String name3 = scan.nextLine(); name3 = name3.substring(0, 1).toUpperCase() + name3.substring(1,name3.length()).toLowerCase(); if (name3.charAt(0) &gt;= 'A' &amp;&amp; name3.charAt(0) &lt;= 'Z'){ System.out.println("The third name is: " + name3); }else{ System.out.println("Error: The name was not accepted"); name3 = null; }

http://stackoverflow.com/comment/40717454
has text: Well, thanks to the `try` and `catch` it's not crashing now... The problem is that the 2 `HackyViewPager` are not moving together (probably because it always get the `catch`...)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25926134
score: 0

http://stackoverflow.com/q/25879298
has comment: http://stackoverflow.com/comment/40501153
tagged with: java
type: UnansweredQuestion
has body: Does android.os.Process.killProcess(android.os.Process.myPid()) calls onDestroy() / super.onDestroy() method? (in any case)
has title: Does killProcess(Process.myPid()) calls onDestroy()?
answer count: 0
has comment: http://stackoverflow.com/comment/40500867
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/40501104
score: 0

http://stackoverflow.com/comment/40601088
score: 0
comment on: http://stackoverflow.com/q/25923449
has text: I am not sure I understand exactly but I think `BorderLayout` might work using EAST, NORTH, SOUTH or WEST panel with CENTER panel.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25948763
has comment: http://stackoverflow.com/comment/40656618
score: 0
has title: Http call crashes
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40661371
tagged with: java
tagged with: blackberry
has body: When i call the http, and during it connection is cutt of..my app crashes.. how can i handle such issue in this code? This also happens when there is no connection, and the http is called.. also it happens when i returns wrong format ( not json).. HttpConnection conn = null; OutputStream os = null; InputStream is = null; try { // construct the URL String serverURL = "xxxxxxxxxxxxxxxxxxxxxxx"+Common.getConnectionType(); // encode the parameters URLEncodedPostData postData = new URLEncodedPostData("UTF-8", false); byte[] postDataBytes = postData.getBytes(); // construct the connection conn = (HttpConnection)Connector.open(serverURL, Connector.READ_WRITE, true); conn.setRequestMethod(HttpConnection.POST); conn.setRequestProperty("User-Agent", "BlackBerry/" + DeviceInfo.getDeviceName() + " Software/" + DeviceInfo.getSoftwareVersion() + " Platform/" + DeviceInfo.getPlatformVersion()); conn.setRequestProperty("Content-Language", "en-US"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Length", new Integer(postDataBytes.length).toString()); // write the parameters os = conn.openOutputStream(); os.write(postDataBytes); // write the data and get the response code int rc = conn.getResponseCode(); if(rc == HttpConnection.HTTP_OK) { // read the response ByteVector buffer = new ByteVector(); is = conn.openInputStream(); long len = conn.getLength(); int ch = 0; // read content-length or until connection is closed if( len != -1) { for(int i =0 ; i &lt; len ; i++ ) { if((ch = is.read()) != -1) { buffer.addElement((byte)ch); } } } else { while ((ch = is.read()) != -1) { len = is.available(); buffer.addElement((byte)ch); } } // set the response accountsResponse = new String(buffer.getArray(), "UTF-8"); } else { accountsResponse = null; } } catch(Exception e){ accountsResponse = null; } finally { try { os.close(); } catch (Exception e) { // handled by OS } try { is.close(); } catch (Exception e) { // handled by OS } try {…
type: Question
has comment: http://stackoverflow.com/comment/40637447

http://stackoverflow.com/q/26002507
linked to: http://stackoverflow.com/q/2850203
tagged with: java
linked to: http://stackoverflow.com/q/1377279
has comment: http://stackoverflow.com/comment/40750111
tagged with: substring
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/26003403
has body: I am looking for an efficient way to remove last n lines from a String. Efficient as in- fast performing as well as something that does not create too may objects. Therefore would like to stay away from split(). Especially because, at times, my strings could be a few hundred or even thousand lines. For instance, I am getting a string as such: This is a sample code line 1. This is a sample code line 2. Warm Regards, SomeUser. The last 3 lines (an empty line, "Warm Regards,", and "SomeUser.") is what I am trying to get rid of. Note that the content (including the last 3 lines) isn't fixed. I am thinking of counting the lines first using this solution here: https://stackoverflow.com/a/18816371/1353174 and then again, use another similar loop to reach to a position that is lines - n and do a substring till that position. However, just posting this problem here to know if there are any other and perhaps more efficient ways to achieve this. External library-based solutions (like Apache Commons StringUtils) are also welcome.
has comment: http://stackoverflow.com/comment/40722734
tagged with: string
has comment: http://stackoverflow.com/comment/40733425
favorite count: 0
has title: Remove last n lines (sentences) in a String in Java
has answer: http://stackoverflow.com/a/26002583
has answer: http://stackoverflow.com/a/62157187
answer count: 4
has answer: http://stackoverflow.com/a/26002779
has answer: http://stackoverflow.com/a/26003403
downvote count: 1
possible better answer: http://stackoverflow.com/a/26002779
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/40767647
has text: ok, what's wrong with my answer? I like when someone downvotes without leaving comment.
comment on: http://stackoverflow.com/a/26027117
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25927922
has comment: http://stackoverflow.com/comment/40588449
has comment: http://stackoverflow.com/comment/40588455
tagged with: jakarta-mail
tagged with: email
downvote count: 0
has body: I have a scenario in which I need to send bulk emails to senders. I can send only 10 mails at a time. So I set all my mail contents in variable and then add only ten recipients at a time. Then after I send email, I again add ten next receipients to it. private void addRecipients(Message pMessage, List pRecipients, Message.RecipientType pType, int pNum, int pOffset, int pBulkSize){ for (int i = 0; i &lt; pRecipients.size(); i++) { int offset = pNum + i; if (pBulkSize != 0 &amp;&amp; (offset &lt; pOffset || offset &gt;= pOffset + pBulkSize)) { continue; } Address a; Object r = pRecipients.get(i); pMessage.addRecipient(pType, a); } But the problem is I am not able to remove the last ten receipients from the variable. Transport.send(message); After this line, my loop restarts and again the addRecipients method is called. But now the object MimeMessage message = getIntialEmailConfiguration(); message has previous recipients as well. I want to know how to reset that one property and remove existing recipients.
answer count: 1
accepted answer: http://stackoverflow.com/a/25942923
favorite count: 0
has title: how to reset recipient list from javax.mail.internet.MimeMessage
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/25942923
has comment: http://stackoverflow.com/comment/40588952

http://stackoverflow.com/a/26025593
accepted answer of: http://stackoverflow.com/q/26025566
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40764752
upvote count: 8
type: Answer
score: 8
answers question: http://stackoverflow.com/q/26025566
has body: If you use a multi-catch then you cannot change the Exception reference; try { } catch (IOException|SQLException ex) { ex = null; // &lt;-- NOT LEGAL, the ex is final. }

http://stackoverflow.com/q/25908994
linked to: http://stackoverflow.com/q/13721238
accepted answer: http://stackoverflow.com/a/25909441
type: AnsweredQuestion
tagged with: java
tagged with: servlets
type: Question
tagged with: jsp
has body: I have a html file which needs to take two servlet parameters the rest is hardcoded and then save itself to then send within a Javamail. JSP getting parameters: RequestDispatcher rd = getServletContext().getRequestDispatcher( "/email.jsp"); rd.forward(request, response); Your User Number is "&lt;em&gt;&lt;%=request.getParameter("USERNO")%&gt;&lt;/em&gt;" and your password is "&lt;em&gt;&lt;%= request.getParameter("PASSWORD")%&gt;&lt;/em&gt;". Just to confirm the servlet does give the parameters successfully when executed. The output of the jsp into the html file is given when I call a url like: localhost/MailServlet/HTMLEmail?USERNO=1&amp;PASSWORD=TEST My idea was to save the bytes of the jsp output into a html file and then send that html file as an email. The thing is that when I try to copy from the url it becomes an infinite loop of where I cam calling the servlet. Copying bytes code: System.out.println("opening connection"); URL url = new URL("http://localhost:8080/MailServlet/HTMLEmail?USERNO="+USERNO+"&amp;PASSWORD="+PASSWORD"); System.out.println("urlString created with URL="+url); InputStream in = url.openStream(); System.out.println("InputStream opened"); FileOutputStream fos = new FileOutputStream(new File("C:/Users/****/workspace/HtmlMailServlet/WebContent/email.html")); System.out.println("FileOutputStream opened"); System.out.println("reading file..."); int length = -1; byte[] buffer = new byte[1024]; // buffer for portion of data from connection while ((length = in.read(buffer)) &gt; -1) { fos.write(buffer, 0, length); } System.out.println("file read..."); fos.close(); in.close(); System.out.println("file was downloaded"); Currently I am using a crazy 3 page string with two parameters passed inside which is obviously not good to look at but does the job. Any help is appreciated.
score: 0
has answer: http://stackoverflow.com/a/25909441
answer count: 1
has title: Need to get servlet output into html file

http://stackoverflow.com/a/26010910
score: 3
upvote count: 3
has body: Just use a negated character class instead of .+?, \[\[(?!.+?:)([^\]\[]+)\|([^\]\[]+)\]\] Java regex would be, "\\[\\[(?!.+?:)([^\\]\\[]+)\\|([^\\]\\[]+)\\]\\]" DEMO OR simply you could do like this, \[\[([^\]\[:]+)\|([^\]\[:]+)\]\] Java regex would be, "\\[\\[([^\\]\\[:]+)\\|([^\\]\\[:]+)\\]\\]" DEMO
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26010846
answers question: http://stackoverflow.com/q/26010846
type: Answer

http://stackoverflow.com/q/25885490
possible better answer: http://stackoverflow.com/a/25885551
tagged with: java
has answer: http://stackoverflow.com/a/25885551
tagged with: collections
type: Question
accepted answer: http://stackoverflow.com/a/25885876
has answer: http://stackoverflow.com/a/25885607
has answer: http://stackoverflow.com/a/25885608
has title: How to find nearest values between collection in java?
score: 0
answer count: 4
has answer: http://stackoverflow.com/a/25885876
has body: I need to find out the key from Hashmap after finding the nearest values of Arraylist. I have a Hashmap like below: HashMap&lt;Integer,ArrayList&gt; map=new HashMap&lt;Integer,ArrayList&gt;; map.put(1,new ArrayList(0.45,0.55)); map.put(2,new ArrayList(1.45,1.55)); map.put(3,new ArrayList(3.45,3.55)); And, I have an Arraylist as : ArrayList checklist=new ArrayList(); checklist.add(1.35); checklist.add(1.60); Now I need to compare checklist with Hashmap's value (ie, Arraylist). If I compare above two collections, probably i will get the key '2' from the hashmap. How to achieve this? Thanks in advance...
type: AnsweredQuestion

http://stackoverflow.com/comment/40547129
score: 0
type: Comment
type: QuestionComment
has text: **watch out** when you use an if-clause without brackets! only the next line will be affected... (this is of course known to all java programmers, but this code doesn't look like to be aware of, sorry to be to progressive)
comment on: http://stackoverflow.com/q/25905063

http://stackoverflow.com/comment/40692459
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25985711
has text: If you haven't already done so, take a look at [Painting in AWT and Swing](http://www.oracle.com/technetwork/java/painting-140037.html) for details about how painting is accomplished in Swing

http://stackoverflow.com/q/25969108
type: UnansweredQuestion
tagged with: php
has title: Android MYSQL Select * to Consctruct Java Object
answer count: 0
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/40661557
type: Question
has comment: http://stackoverflow.com/comment/40661984
has body: I am trying to retrieve data from a MYSQL database in android using the following code: ... HttpResponse response = httpclient.execute(httppost); BufferedReader in = new BufferedReader( new InputStreamReader(response.getEntity() .getContent())); StringBuffer sb = new StringBuffer(""); String line = ""; while ((line = in.readLine()) != null) { sb.append(line); break; } in.close(); responseString = sb.toString(); responseString = responseString.substring(0, responseString.length() - 1); showMessage(responseString); System.out.println(responseString); // Handle Response user.orderList.clear(); String[] tmp1 = responseString.split("\\|"); for (String s : tmp1) { String[] tmp2 = s.split(","); Order tmp3 = new Order(); tmp3.orderId = tmp2[0]; tmp3.placerName = tmp2[1]; tmp3.itemName = tmp2[2]; tmp3.payment = tmp2[3]; tmp3.locationString = tmp2[4]; user.orderList.add(tmp3); System.out.println(tmp3.toString()); } ... This gets the response from the php file as a String and splits the response based on , and | Here is the PHP code the returns its data back to the Java Code: $sql = mysql_query("SELECT * FROM orders WHERE (location_lat BETWEEN '".$_POST['LatMin']."' AND '".$_POST['LatMax']."') AND (location_long BETWEEN '".$_POST['LongMin']."' AND '".$_POST['LongMax']."')"); if($sql){ while($row = mysql_fetch_assoc($sql)) { echo ($row['order_id'] . "," . $row['placer_name'] . "," . $row['item_name'] . "," . $row['payment_amount'] . "," . $row['location_string'] . "|"); } } else{ echo 'Failed. SQL Error occured.'; } The issue is that for some reason I am only getting 4 of the values: placerName, itemName, payment, locationString. However the orderId does not return anything. Database:
has comment: http://stackoverflow.com/comment/40663785
score: 0

http://stackoverflow.com/comment/126860684
has text: @Niklas try edited code, it will probably work now
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/59269370

http://stackoverflow.com/comment/40771646
type: QuestionComment
type: Comment
score: 0
has text: I really want to know if this is supported by flyway or not. I refer to an example that uses the syntax I'm using in the script that's failing.
comment on: http://stackoverflow.com/q/26029333

http://stackoverflow.com/comment/40817687
type: Comment
comment on: http://stackoverflow.com/q/26029707
score: 0
type: QuestionComment
has text: pls check email-id,I send project to you

http://stackoverflow.com/a/25951944
has comment: http://stackoverflow.com/comment/40629695
downvote count: 0
type: Answer
has body: As @ColonelThirtyTwo mentioned in the comments, if(stack.size() &gt;= 2) { T first = stack.pop(); T second = stack.pop(); stack.push(first); stack.push(second); }
score: 2
answers question: http://stackoverflow.com/q/25951733
upvote count: 2

http://stackoverflow.com/comment/40684771
type: AnswerComment
comment on: http://stackoverflow.com/a/25981755
type: Comment
has text: @user1170330 As I've stated, access the parent class of the concrete subclass and use its `getDeclaredFields()` method. Testing and abstract class depends on the class itself. Testing concrete subclasses will possibly cover testing their parent classes.
score: 0

http://stackoverflow.com/comment/40762728
type: QuestionComment
score: 0
has text: Have you taken a look at [addMouseListener](http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#addMouseListener(java.awt.event.MouseListener))?
type: Comment
comment on: http://stackoverflow.com/q/26024134

http://stackoverflow.com/a/25918250
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25918163
score: 2
answers question: http://stackoverflow.com/q/25918163
has body: You are not seting the second icon: private Icon[] pics = {new ImageIcon(getClass().getResource(filename[0]))}; Solve it replacing with this: private Icon[] pics = {new ImageIcon(getClass().getResource(filename[0])), new ImageIcon(getClass().getResource(filename[1]))};
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40568271
has text: @MikeM. I put the manifest file wrong ! I edited it . and fixed the while condition . but it's don't work again !
score: 0
comment on: http://stackoverflow.com/q/25916099
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25898655
type: Answer
answers question: http://stackoverflow.com/q/25892370
score: 2
has comment: http://stackoverflow.com/comment/40631324
downvote count: 0
has body: This behaviour is caused because I didn't close my "choice" block properly. i.e. the route should look like this: from(INPUT_SERVICE_ENDPOINT_URI) .wireTap(SAVE_COPY_OF_INPUT) .unmarshal(jaxbFormat) .process(createAuditRecord()) .bean(webServiceValidator) .process(updateAuditRecord()) .split(body()) .choice() .when(simple("${body.second.rejected}")) .log(LoggingLevel.DEBUG, LOGGER_NAME, "Skipping import as it was rejected") .otherwise() .to(ExchangePattern.InOnly, IMPORT_QUEUE_ENDPOINT_URI) .endChoice() .end() .end() .process(createWebServiceResponse()) .marshal(jaxbFormat);
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25892370
upvote count: 2

http://stackoverflow.com/q/25916075
has answer: http://stackoverflow.com/a/25916354
accepted answer: http://stackoverflow.com/a/25916287
has answer: http://stackoverflow.com/a/25916346
has comment: http://stackoverflow.com/comment/40566751
possible better answer: http://stackoverflow.com/a/25916346
downvote count: 4
answer count: 3
favorite count: 0
has body: This program is to find the no. of input which is divisible by k. however I got a program that does this but can't understand what is the code marked // &lt;-- doing. public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader (System.in)); String s = br.readLine();// &lt;-- int end = s.indexOf(' ');// &lt;-- int n = Integer.parseInt(s.substring(0, end));// &lt;-- int k = Integer.parseInt(s.substring(end+1));// &lt;-- int count = 0; for (int i=0; i &lt; n; i++){ if (Integer.parseInt(br.readLine())%k == 0){ count++; } } System.out.println(count); }
has comment: http://stackoverflow.com/comment/40566901
has answer: http://stackoverflow.com/a/25916287
score: -3
has comment: http://stackoverflow.com/comment/40566735
type: AnsweredQuestion
has title: What is the program doing
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40566780
has comment: http://stackoverflow.com/comment/40566586
type: Question

testing
tags question: http://stackoverflow.com/q/26018045
tags question: http://stackoverflow.com/q/25990884
tags question: http://stackoverflow.com/q/25978032
tag name: testing
tags question: http://stackoverflow.com/q/25948604
tags question: http://stackoverflow.com/q/25940720
tags question: http://stackoverflow.com/q/25939486
tags question: http://stackoverflow.com/q/25944605
tags question: http://stackoverflow.com/q/25978716
type: Tag
tags question: http://stackoverflow.com/q/25944326
tags question: http://stackoverflow.com/q/25889539
tags question: http://stackoverflow.com/q/25987788
tags question: http://stackoverflow.com/q/25939261
tags question: http://stackoverflow.com/q/26011534
tags question: http://stackoverflow.com/q/25875438
tags question: http://stackoverflow.com/q/25981712

http://stackoverflow.com/comment/40666164
type: Comment
type: QuestionComment
has text: @pooja - if you're interested in concepts, then ask directly for them: "What are the uses of declaring a public method in a private inner class?" (and delete this question) Then you'll get better answers.
comment on: http://stackoverflow.com/q/25971406
score: 0

http://stackoverflow.com/comment/40780116
score: 0
type: AnswerComment
has text: Well that is my question - is there some api or third party library available for thsi task.
type: Comment
comment on: http://stackoverflow.com/a/26021836

http://stackoverflow.com/q/25916563
linked to: http://stackoverflow.com/q/4374528
has body: I have problem of performance in my many-to-one mapping. When I debug the SQL query in log file the principal query it's ok, but after i have other query representing many-to-one object mapping. Entity.hbm.xml : <?xml version="1.0"?> <column name="ENTITY_ID"/> SEQ_MY_ENTITY <property name="prop1" type="string" column="PROP1" /> <many-to-one name="object1" column="OBJECT1_ID" class="com.omb.database.mapping.Object1" /> <many-to-one name="object2" column="OBJECT2_ID" class="com.omb.database.mapping.Object2" /> Object1.hbm.xml : <?xml version="1.0"?> <property name="label" type="string" column="LABEL_OBJECT_1" length="15" /> Object2.hbm.xml : <?xml version="1.0"?> <property name="label" type="string" column="LABEL_OBJECT_2" length="15" /> Query HBM : public List<Entity> findByObject1Id(Integer object1Id) throws DataAccesException { List<Entity> results = null; try { Query query = this.getSession().createQuery( "from Entity ent where ent.object1.id = :object1Id"); query.setParameter("object1Id", object1Id); results = query.list(); } catch (HibernateException hbe) { throw new DataAccesException(hbe); } return results; } in pom.xml org.hibernate hibernate 3.2.6.ga javax.transaction jta net.sf.ehcache ehcache asm asm-attrs
type: AnsweredQuestion
upvote count: 9
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25916870
downvote count: 0
has answer: http://stackoverflow.com/a/25917029
has comment: http://stackoverflow.com/comment/40567997
has answer: http://stackoverflow.com/a/25916870
has title: Hibernate lazy loading not work with many-to-one mapping
favorite count: 0
score: 9
tagged with: sql
tagged with: http://stackoverflow.com/tag/xml
tagged with: mapping
accepted answer: http://stackoverflow.com/a/25917029

http://stackoverflow.com/a/26019182
has body: You can do it with string split: How to split a string in Java String string = "/storage/emulated/0/temp.jpg"; String[] parts = string.split("/"); String file= parts[parts.length-1];
answers question: http://stackoverflow.com/q/26019132
type: Answer
has comment: http://stackoverflow.com/comment/40752577
downvote count: 0
score: 4
upvote count: 4

http://stackoverflow.com/comment/40525393
type: QuestionComment
has text: @maress probably you mean that the changes are not reflected in same moment in a live transaction of the other application. Otherwise, if you do a fetch from DB, you will see the changes made by the other aplication.
score: 0
comment on: http://stackoverflow.com/q/25891221
type: Comment

http://stackoverflow.com/comment/91739948
score: 0
type: Comment
has text: @MidhilajM That's a significantly limited subset of what the question was asking about. it's a more specific use-case, under limited circumstances, where some things are possible. It also is specific to using a browser, almost certainly either redirected to a different page, or over HTTP (i.e. not HTTPS). It is not just general network use. The question was asking for a universal solution.
comment on: http://stackoverflow.com/a/26195669
type: AnswerComment

http://stackoverflow.com/comment/40538213
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25899247
has text: Brackets should be perfectly acceptable as part of the path.
score: 0

http://stackoverflow.com/q/25903898
tagged with: arrays
has answer: http://stackoverflow.com/a/25903956
type: UnansweredQuestion
has title: read new data into array of names from input.txt
has answer: http://stackoverflow.com/a/25904581
tagged with: compiler-errors
has body: I keep getting this error for the while loop: java.lang.ArrayIndexOutOfBoundsException; This is under: Read new data into the array of names from "Input.txt" one String per line, and places them in an array. The number of Strings in the file must be the same as the number of cells in the array. // Open an input textfile named "Input.txt". File f = new File("Input.txt"); Scanner inputFile = new Scanner(f); System.out.println("\nThe array contents:"); // Read new data into the array of names from "Input.txt" one String per line, and places them in an array. //The number of Strings in the file must be the same as the number of cells in the array. String[] input = new String [5]; int k=0; while (inputFile.hasNext()) { String str = inputFile.nextLine(); input[k]=str; k++; } inputFile.close(); //Print the new array contents on the screen PrintWriter pw = new PrintWriter("Input.txt"); for(String str : array) pw.println(str); pw.close(); } /** * Method printOnScreen sends the entire contents of an * array to the Screen using an "enhanced for" loop. * * @param array the array of Strings be printed on Screen * */ public static void printOnScreen(String[] args) { for(String val : args) System.out.println(val); }
has comment: http://stackoverflow.com/comment/40544666
type: Question
has answer: http://stackoverflow.com/a/25903965
tagged with: java
tagged with: eclipse
score: 0
answer count: 3

http://stackoverflow.com/comment/40732657
type: Comment
comment on: http://stackoverflow.com/a/26006153
has text: Well, RMI is used behind the scenes, you don't need to use it directly. EJBs get registered in the JNDI and you only need to grab the JNDI and ask for the EJB. The Transactions would be in the EJB side so every call would be enclosed in a transaction.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40504160
comment on: http://stackoverflow.com/a/25881228
type: Comment
has text: Will remember this, still getting started in Coding (as if you couldn't tell).
score: 0
type: AnswerComment

http://stackoverflow.com/a/25920808
score: 2
downvote count: 0
upvote count: 2
has body: Array offsets begin at 0, not 1. If you start at 1 you miss offset 0. Also, make the compare &lt; st.length(), or else you go out of bounds for(int i=0; i&lt; st.length(); i++){
type: Answer
answers question: http://stackoverflow.com/q/25920776

android-asynctask
tags question: http://stackoverflow.com/q/25965756
type: Tag
tags question: http://stackoverflow.com/q/26007674
tags question: http://stackoverflow.com/q/25898612
tag name: android-asynctask
tags question: http://stackoverflow.com/q/25962386
tags question: http://stackoverflow.com/q/25903395
tags question: http://stackoverflow.com/q/25885273
tags question: http://stackoverflow.com/q/25951404
tags question: http://stackoverflow.com/q/26014812
tags question: http://stackoverflow.com/q/25920015
tags question: http://stackoverflow.com/q/25882768
tags question: http://stackoverflow.com/q/25899984
tags question: http://stackoverflow.com/q/25920371
tags question: http://stackoverflow.com/q/25921353
tags question: http://stackoverflow.com/q/25904720
tags question: http://stackoverflow.com/q/25937046

http://stackoverflow.com/comment/71883172
type: AnswerComment
type: Comment
score: 0
has text: Although Shivs issue is not related to a total number of style created on a workbook, but this can be caused by it and for me, it was exactly what was happening, the maximum cap for styles you can create is around 50k to 60k in a workbook.
comment on: http://stackoverflow.com/a/32756260

http://stackoverflow.com/comment/40672792
score: 0
comment on: http://stackoverflow.com/q/25973287
type: QuestionComment
type: Comment
has text: See my updated answer for a way to get what you want while still using printf.

http://stackoverflow.com/q/25932076
type: Question
tagged with: inheritance
has comment: http://stackoverflow.com/comment/40595846
has title: Exception: "No default Constructor provided" exception subclassing ParseObject
score: 0
accepted answer: http://stackoverflow.com/a/25932218
tagged with: android
answer count: 1
tagged with: parse-platform
type: AnsweredQuestion
tagged with: oop
has body: I have two classes NewsImage and EventImage that are almost identical and therefore they inherit from Image abstract class. Each of those two represent a class in my Parse database. public abstract class Image extends ParseObject { public Image(){}; public String getImageId(){ return getObjectId(); } public void setImageId(String imageId){ setObjectId(imageId); } public byte[] getImageBytes(){ try { return getParseFile("image").getData(); } catch (ParseException e) { e.printStackTrace(); return null; } } public void setImageBytes(byte[] bytes){ put("image", new ParseFile(bytes)); } public Bitmap getBitmap(){ return Toolbox.ByteArrayToBitmap(getImageBytes()); } EventImage Class @ParseClassName("OSW_event_images") public class EventImage extends Image { public EventImage() { super(); } public Event getEvent(){ return (Event) getParseObject("event"); } public void setEvent(Event event){ put("event", event); } }; NewsImage class @ParseClassName("OSW_news_images") public class NewsImage extends Image { public NewsImage() { super(); } public News getNews(){ return (News) getParseObject("news"); } public void setNews(News event){ put("news", event); } }; } I register those two classes before I call Parse.initialize() ParseObject.registerSubclass(Image.EventImage.class); ParseObject.registerSubclass(Image.NewsImage.class); After I run this I get: 09-19 12:38:39.794: E/AndroidRuntime(25806): java.lang.RuntimeException: Unable to start activity ComponentInfo{pl.holdapp.osw/pl.holdapp.osw.activities.MainActivity}: java.lang.IllegalArgumentException: No default constructor provided for class pl.holdapp.osw.objects.Image$EventImage 09-19 12:38:39.794: E/AndroidRuntime(25806): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
has answer: http://stackoverflow.com/a/25932218
tagged with: java

http://stackoverflow.com/q/25920414
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: collation
downvote count: 0
score: 1
tagged with: java
tagged with: collections
accepted answer: http://stackoverflow.com/a/25920683
type: Question
has answer: http://stackoverflow.com/a/25920683
has body: I'm trying to sort a map with Collator, by apparently it only works with lists Im using this: import java.text.* Collator collator = Collator.getInstance() collator.setStrength(Collator.PRIMARY) def list = [ [name:"áaa", title:"foo1"], [name:"zzz", title:"foo2"], [name:"éee", title:"foo3"], [name:"ába", title:"foo4"], [name:"aaa", title:"foo5"] ] Collections.sort(list.name, collator); ​list.collect{it.name}​ It returns [áaa, zzz, éee, ába, aaa] but it should returns: [áaa, aaa,ába,éee, zzz] How can i fix it? I need to keep the original map. maybe I could use other class than Collator Thanks!!
tagged with: groovy
upvote count: 1
has title: Sort Map with Strings with accents with Collator

http://stackoverflow.com/a/25910845
upvote count: 2
answers question: http://stackoverflow.com/q/25909611
score: 2
downvote count: 0
has body: Most probably you have several installed java versions on your PC, and your Eclipse is started based on old version. In command line java -version command shows default one or even first installed one, which is saved somewhere in registers, and it is not always that which is used by your applications. (As example, I have only 1.7 installed physically now but java -version shows old one 1.5) You may try next: right click on Eclipse shortcut, chose Shortcut tab, and change Target field so that it run with -vm argument pointing on that Java version you need: "D:\eclipse-jee-kepler-R-win32-x86_64\eclipse\eclipse.exe" -vm "C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe"
type: Answer

http://stackoverflow.com/comment/40708716
score: 0
has text: @MartinBaumgartner : not to re-authenticate means SSO only
comment on: http://stackoverflow.com/q/25990343
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40513881
type: Comment
comment on: http://stackoverflow.com/a/25886461
score: 0
type: AnswerComment
has text: I am a bit confused where should I call it?

http://stackoverflow.com/comment/40601265
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25927253
type: Comment
has text: Yes it is. It is better though, since it's portable. Please mark the answer, so the thread can be closed.

http://stackoverflow.com/comment/40552219
has text: I agree with you, but the only reason to type <Object> here is to avoid warning and follow convention that raw types shouldn't be used at all?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25908185
type: Comment

http://stackoverflow.com/a/25954490
type: AcceptedAnswer
has body: You already have the result in employeeNum, just check for it being less than 4 and you're good. Just get EmNo[employeeNum] which you should be doing instead of that switch statement anyway... For catching errors in the input, you should catch the exception being thrown with a try-catch statement.
type: Answer
answers question: http://stackoverflow.com/q/25954473
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25954473
upvote count: 2

http://stackoverflow.com/comment/40563261
has text: @IanMcLaird `replaceAll` uses regex, while OP clearly wants to replace literals, so `replace` is better here. But there is possible problem if cyclic replacements can exist like `a->b` `b->a`. In that case by replacing all `a` with `b` then all `b` with `a` we end up with only `a`.`appendReplacement` and `appendTail` solves this problem.
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/25914283
type: Comment

http://stackoverflow.com/a/25983069
answers question: http://stackoverflow.com/q/25982929
has body: There are two simple ways to achieve your goal. First, you can move your arrays one level up and make them static fields of your class. static String[] a; static double[] b; public static void main(String[] args) { a = new String[x] ; b = new double[x] ; } public void datain() { System.out.println( "Valor test:" + b[0] ) ; } This will work, but it is generally bad approach to modify static fields from non-static methods. Second, you can pass your arrays as arguments to the datain method: public static void main(String[] args) { String[] a = new String[x]; double[] b = new double[x]; new DatainTest().datain(a, b); } public void datain(String[] a, double[] b) { System.out.println("Valor test:" + b[0]); } I assume that DatainTest is the name of your class. Maybe you can provide more information of what you are trying to do, because there are many different approaches to pass data to a method and choosing the right one is highly dependent on your goal.
type: Answer
downvote count: 0
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25982929
type: AcceptedAnswer

http://stackoverflow.com/comment/40696615
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25982853
score: 0
has text: @Damien-Layershift The path of the image was supposed to be saved in the database. However, nothing happens. On the localhost, the page is successfully redirected to the profile page with the display pic. Online, no error, but no pic either. Based on the code above, it's relativePath = "images/profilepic/" + fileName_Original; absolutePath = request.getSession().getServletContext().getRealPath("") + "/" + relativePath; patient.setRelativePath(relativePath); patient.setFileName(fileName_Original); patientDao.update(patient);

http://stackoverflow.com/comment/40704692
comment on: http://stackoverflow.com/q/25992944
has text: I am not familiar with writing custom deserializer, can you point to some resources ? Thanks
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/79010481
type: AnswerComment
comment on: http://stackoverflow.com/a/27239122
has text: Any one did it ?
type: Comment
score: 0

http://stackoverflow.com/a/25977300
has body: Your DateTime is actually not in UTC - it's in the system default time zone. To fix it, you just need to tell it that the value you're passing in is in UTC: DateTime dt = new DateTime("2014-09-15T21:20:14", DateTimeZone.UTC); System.out.println(dt); DateTime other = dt.plusMillis(581042272); System.out.println(other); Output: 2014-09-15T21:20:14.000Z 2014-09-22T14:44:16.272Z Also note that you can't have made the request at 15:44:16 GMT, as that hasn't occurred yet. At the time I'm writing this, it's 16:05 British Summer Time, therefore 15:05 GMT. It's important to understand that the time zone in the UK isn't "GMT" - that's just the part of the time zone when we're not observing daylight savings. If you want to convert to the UK time zone, you want: DateTime other = dt.plusMillis(581042272) .withZone(DateTimeZone.forID("Europe/London"));
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25977197
answers question: http://stackoverflow.com/q/25977197
type: Answer
score: 7
upvote count: 7

http://stackoverflow.com/comment/40589174
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25928349
has text: Try to replace this code : if (rb.isChecked()){
score: 0

http://stackoverflow.com/a/25876618
has body: If my understanding is correct, you want to dynamically update the content of a JList. If this is the requirement then use the javax.swing.ListModel to implement the Model (the data part of MVC pattern) of the JList.
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25876435

http://stackoverflow.com/a/25925993
answers question: http://stackoverflow.com/q/25925945
upvote count: 2
type: Answer
score: 2
has body: Put the JTextArea in a JScrollPane See How to Use Scroll Panes for more details. Specify the row and column size via the JTextArea's constructor, which will allow you to specify the desired, viewable area of the text area, before the scroll pane has to intervene and add scroll bars. See JTextArea constructor JTextArea(int rows, int columns) for more details
downvote count: 0

http://stackoverflow.com/q/26027463
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26027559
has comment: http://stackoverflow.com/comment/40768549
accepted answer: http://stackoverflow.com/a/26027559
tagged with: exception
has comment: http://stackoverflow.com/comment/40768305
has body: So picture the following scenario. I have two sets of classes and interfaces. ClassA, ClassB, ClassAInterface, and ClassBInterface. ClassA uses ClassB in several of its methods. These methods from ClassB occasionally throw exceptions. public class ClassA implements ClassAInterface { public void example() { ClassB test = new ClassB(); ClassB.exampleTest(); //more code using ClassB } } public class ClassB implements ClassBInterface { public void exampleTest() throws ExampleException() { boolean tru = false; if (tru) { throw new ExampleException(); } } } So the problem that I'm having is that I'm getting an Unhandled Exception type ExampleException() error in the ClassA.example() method. Why does this happen? I want the ClassB method to throw the exception in specific cases, and signify that it sometimes throws exceptions with throws ExampleException(), so why does ClassA not compile. To solve it, I can't add a throws statement onto ClassA.example() because it would violate ClassAInterface. And if I just wrap ClassB.exampleTest() in a try catch statement, much of the rest of ClassA.example() would throw errors because ClassB signifies something is wrong and you should throw an exception at that point, which is the entire point of throwing an exception`. So I'm not sure why this is happening or how to solve it.
type: AnsweredQuestion
tagged with: java
type: Question
has title: Handling exceptions with interfaces and classes in java

http://stackoverflow.com/a/25907427
has body: You don't need any library. GmailContract is a helper class which is provided by Google. You can for example copy it from this sample app. Anyway here it is: /* * Copyright 2012 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PermissionInfo; import android.content.pm.ProviderInfo; import android.net.Uri; import android.text.TextUtils; /** * Contract for use with the Gmail content provider. * * Developers can use this content provider to display label information to the user. * * The label information includes: * * Label name * Total number of conversations * Number of unread conversations * Label text color * Label background color * * * This content provider is available in Gmail version 2.3.6 or newer for Froyo/Gingerbread * and version 4.0.5 and newer for Honeycomb and Ice Cream Sandwich * An application can query the * * Content Resolver directly * (or use a Loader) * to obtain a Cursor with information for all labels on an account * Cursor labelsCursor = getContentResolver().query(GmailContract.Labels.getLabelsUri( * selectedAccount), null, null, null, null); */ public final class GmailContract { private GmailContract() {} /** * Permission required to access this {@link android.content.ContentProvider} */ public static final String PERMISSION…
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25907249
answers question: http://stackoverflow.com/q/25907249

http://stackoverflow.com/comment/40549575
has text: Side note: In Java, variable names should be `camelCase` (lower-case first letter). Many of your variables are `TitleCase`, which confuses Java programmers.
comment on: http://stackoverflow.com/q/25904144
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40566649
type: QuestionComment
comment on: http://stackoverflow.com/q/25912572
score: 1
has text: Can you paste the section of your elasticsearch.yml file which says #########Cluster#########
type: Comment

http://stackoverflow.com/a/26010036
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25977595
has body: Ok. I already know why it doesn't work. You can't simply write an entire sql select query inside the test tag. The test tag only accepts in parameters. Actually, I'm passing the response of the select as a parameter.

http://stackoverflow.com/comment/40702022
type: Comment
type: QuestionComment
score: 1
has text: No it isn't... That will only work for spring defined and managed beans. As soon as you do a `new OurLogger` nothing is going to happen. Unless you use AspectJ combined with `@Configurable`.
comment on: http://stackoverflow.com/q/25991191

http://stackoverflow.com/a/26022745
answers question: http://stackoverflow.com/q/26022233
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/40759567
has comment: http://stackoverflow.com/comment/40767594
has body: You aren't far from getting your program working. You really have two things left you need to do. Prompt the user for a year Output the date found The trick to using a Scanner to prompt the user for input is to create a while-loop which tests each line the user enters, and keeps repeating until it sees a legal value. Instead of hard-coding y = 2014; (or whatever), you want to do something like this: Scanner input = new Scanner(System.in); int y = -1; // No easter back in B.C. while (y &lt; 0) { System.out.println("Please enter a year (integer greater than zero)"); if (input.hasNextInt()) { // check to see if the user entered a number y = input.nextInt(); // if so, read it } input.nextLine(); // advance the scanner to the next line of input } in this case, each time the user doesn't enter a number, y remains -1 and the loop continues. You are already doing all the calculations correctly, so to end your program, you just need to output the month/day. I wouldn't bother trying to extract the calculation into a helper method. Just use the calculated values directly in main(): int a = y % 19; int b = y / 100; ... int n = (h - m + r + 90) / 25; int p = (h - m + r + n + 19) % 32; System.out.println("In the year " + y + " Easter with fall on day " + p + " of month " + n);
has comment: http://stackoverflow.com/comment/40767385
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/40503236
comment on: http://stackoverflow.com/q/25880893
type: Comment
type: QuestionComment
score: 1
has text: You should consider designing a class to hold the collection of all the variables/fields for a particular record (set of user responses). Then, you can pass this object around to different parts of your code...

http://stackoverflow.com/comment/40525037
type: QuestionComment
has text: Now go and download the MySQL connector for Java.
comment on: http://stackoverflow.com/q/25892923
score: 0
type: Comment

selenium-webdriver
tags question: http://stackoverflow.com/q/25939579
tags question: http://stackoverflow.com/q/26032149
tags question: http://stackoverflow.com/q/25999016
tags question: http://stackoverflow.com/q/26017901
tags question: http://stackoverflow.com/q/25997559
tags question: http://stackoverflow.com/q/25940929
tags question: http://stackoverflow.com/q/26018790
tags question: http://stackoverflow.com/q/25956767
tags question: http://stackoverflow.com/q/25934749
tags question: http://stackoverflow.com/q/25914156
tags question: http://stackoverflow.com/q/25997556
tags question: http://stackoverflow.com/q/25923405
tags question: http://stackoverflow.com/q/25988884
tags question: http://stackoverflow.com/q/25917132
tags question: http://stackoverflow.com/q/26002360
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/25886300
tags question: http://stackoverflow.com/q/25975301
tags question: http://stackoverflow.com/q/25988017
tags question: http://stackoverflow.com/q/25973997
type: Tag
tags question: http://stackoverflow.com/q/25994767
tags question: http://stackoverflow.com/q/25994772
tags question: http://stackoverflow.com/q/26017122
tags question: http://stackoverflow.com/q/25995754
tags question: http://stackoverflow.com/q/25907409

http://stackoverflow.com/q/25888537
upvote count: 5
tagged with: java
tagged with: google-cloud-storage
type: Question
has body: I'm trying to download reviews from the play store which are accessible in a bucket using the java api (details at the end of the message). For review files which when compressed are larger than the chunk size i get the following exception: java.io.EOFException: Unexpected end of ZLIB input stream at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:240) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158) at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:116) at java.io.FilterInputStream.read(FilterInputStream.java:107) at com.google.api.client.util.ByteStreams.copy(ByteStreams.java:51) at com.google.api.client.util.IOUtils.copy(IOUtils.java:94) at com.google.api.client.util.IOUtils.copy(IOUtils.java:63) at com.google.api.client.googleapis.media.MediaHttpDownloader.executeCurrentRequest(MediaHttpDownloader.java:247) at com.google.api.client.googleapis.media.MediaHttpDownloader.download(MediaHttpDownloader.java:199) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeMediaAndDownloadTo(AbstractGoogleClientRequest.java:553) at com.google.api.services.storage.Storage$Objects$Get.executeMediaAndDownloadTo(Storage.java:4540) at com.google.api.services.storage.Storage$Objects$Get$executeMediaAndDownloadTo.call(Unknown Source) The code snipped i'm using is: private void saveObject(StorageObject object) { try { System.out.println("Getting object data"); FileOutputStream fos = new FileOutputStream (new File(object.getName())); Storage.Objects.Get getObject = storage.objects().get("pubsite_prod_rev_XXXXX", object.getName()); // setting the chunksize to a small value fails pretty much on all files getObject.getMediaHttpDownloader().setDirectDownloadEnabled(false).setChunkSize(MediaHttpUploader.MINIMUM_CHUNK_SIZE) // setting the chunksize to larger value allows me to download some of the files but fails on larger ones //getObject.getMediaHttpDownloader().setDirectDownloadEnabled(false).setChunkSize(MediaHttp…
has title: google cloud storage Unexpected end of ZLIB input stream when downloading file larger than chunksize with java api
downvote count: 0
has comment: http://stackoverflow.com/comment/40518185
favorite count: 0
answer count: 0
type: UnansweredQuestion
score: 5
has comment: http://stackoverflow.com/comment/40537141

http://stackoverflow.com/comment/51933102
score: 0
has text: if your path is the good one (the db folder you want to get) everything should work fine. The only thing missing is a `finally{tx.close()}` block at the end of your try clause.
comment on: http://stackoverflow.com/q/26026008
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25925730
tagged with: jcreator
has body: I have to a do the quadratic formula. When I build the file it has no error, but when I run the project the output is Nan. I know that is "not a number" but I dont know how to fix it. import java.io.*; class cuadratica { public static void main(String [] args) throws IOException { cuadra obj=new cuadra(); System.out.println("5. Calcular la ecuación cuadrática (ax^2 + bx + c) "); obj.cal(); } } class cuadra { void cal() throws IOException { String x; int a; String w; int b; String t; int c; int g; int f; double num3; double num2; double q; InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); System.out.println("Inserte el primero numero (ax^2)" ); x=br.readLine(); a=Integer.parseInt(x); System.out.println("Inserte el segundo numero (bx)"); w=br.readLine(); b=Integer.parseInt(w); System.out.println("Inserte el tercer numero (c)"); t=br.readLine(); c=Integer.parseInt(t); g=(b*b)-(4*a*c); q=Math.sqrt(g); if (a!=0||g&gt;0) { num2 = (-b+q)/(2*a); num3 = (-b-q)/(2*a); System.out.println("La raiz son "+num2+" y "+num3); } else { System.out.println("error"); } } }
score: 0
accepted answer: http://stackoverflow.com/a/25925863
answer count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25925863
has title: quadratic formula java NaN?
has comment: http://stackoverflow.com/comment/40584708
type: Question

http://stackoverflow.com/q/26020514
tagged with: spring
tagged with: spring-mvc
answer count: 0
tagged with: java
type: Question
has body: I am trying to get a property set in a spring context file in my view. I am customizing CAS 4.0 with a maven overlay, so I do not have access to the controller. I have set values in a model and sent that off to the view thousands of times, but how do I skip the controller and go straight from context to view? I want something like this in my context: <bean id="forwardURL" value="/asdlfjk"> and in my view: click me Thank You
has comment: http://stackoverflow.com/comment/40759545
has comment: http://stackoverflow.com/comment/40757740
has title: Get property value in spring view
score: 0
tagged with: cas
type: UnansweredQuestion

http://stackoverflow.com/comment/40721582
type: Comment
type: QuestionComment
has text: @DoraHerbert may be you should look for the content of dog. if it exists do not add and if it does not , do add :)
comment on: http://stackoverflow.com/q/26001903
score: 0

http://stackoverflow.com/q/26023997
has comment: http://stackoverflow.com/comment/40762047
downvote count: 2
has body: I have a piece of Java code that has a simple if-else block as below if (null != field1 &amp;&amp; null != field2 &amp;&amp; field1.equals(field2)) { validated = true; } else if (null == field1 &amp;&amp; null == field2) { validated = true; } else if ((field1 == null &amp;&amp; field2.length() == 0) || (field2 == null &amp;&amp; field1.length() == 0)) { validated = true; } else if (null != field1 &amp;&amp; null != field2 &amp;&amp; !field1.equals(field2)) { validated = false; return validated; } Strangeness: When field1 and field2 gets the values as field1 = "" field2 = null With this combination this should hit the third if block and validated should be set to true. Instead, the last if block is getting executed and validated is getting set to false. Any idea what is going wrong here?
upvote count: 1
has answer: http://stackoverflow.com/a/26024579
has comment: http://stackoverflow.com/comment/40761854
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40762029
has comment: http://stackoverflow.com/comment/40762446
has comment: http://stackoverflow.com/comment/40762426
has comment: http://stackoverflow.com/comment/40761748
possible better answer: http://stackoverflow.com/a/26024122
type: Question
has comment: http://stackoverflow.com/comment/40761639
has answer: http://stackoverflow.com/a/26024122
answer count: 2
has comment: http://stackoverflow.com/comment/40761904
accepted answer: http://stackoverflow.com/a/26024579
has comment: http://stackoverflow.com/comment/40761617
has comment: http://stackoverflow.com/comment/40762706
favorite count: 0
has comment: http://stackoverflow.com/comment/40761708
has comment: http://stackoverflow.com/comment/40762743
has title: strange behavior of if/else (Java)
has comment: http://stackoverflow.com/comment/40762112
has comment: http://stackoverflow.com/comment/40761611
score: -1

http://stackoverflow.com/q/26006743
has title: How to sort values coming from bean using hasmap in java
type: UnansweredQuestion
tagged with: collections
has comment: http://stackoverflow.com/comment/40730501
type: Question
tagged with: hashmap
tagged with: java
score: 0
answer count: 1
has body: Hi everyone i am new here and i would like your help on this task, i dont have much experience working with HashMap Actually i am receiving this String with the next value String value1 = "DA45:1|DA33:2|DA25:3"; actually i have Map&lt;Integer, String&gt; value1 = new HashMap&lt;Integer, String&gt;(); I need to parse these data and generating the map such that priority will be key and device name will be value for example : key1 ----- > DA45 key2 -----> DA33 key3 -----> DA25 please notice that i need to split ":","the number" and pipe thanks in advance for helping me
has answer: http://stackoverflow.com/a/26006832
tagged with: list

custom-fields
tag name: custom-fields
tags question: http://stackoverflow.com/q/25998046
type: Tag

http://stackoverflow.com/q/25928950
upvote count: 1
has comment: http://stackoverflow.com/comment/40590321
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25929030
has title: how to return 2 values of different type from a java function : for dummies only
type: Question
answer count: 2
tagged with: types
has body: i searched this topic and found answers, but being a java dummy, i don't really understand it all and therefor i tried to execute the best answer i found into a little example : package return2valuesofdifftype; public class Return2ValuesOfDiffType { public static void main(String[] args) { System.out.println("started"); String strHere = "nothing happened"; int iHere = -5; Method myM = new Method(); ReturningValues myRV = new ReturningValues(strHere, iHere); myRV = myM.method(5, 10); //should return a RV holding the string "correct" and the integer 1 //so far so good (i hope), but how to get this string and integer out of RV ??? System.out.println("string = "+strHere+" ,en i = "+iHere); } } package return2valuesofdifftype; public final class ReturningValues { private final String value; private final int index; public ReturningValues(String value, int index) { this.value = value; this.index = index; } } package return2valuesofdifftype; public class Method { public ReturningValues method(int five, int ten) { String str=""; int i=-1; if(five==5){str="correct";} else{str="wrong";} if(ten==10){i=1;} else{i=0;} ReturningValues rv = new ReturningValues(str, i); return rv; } } My Question : how to get this integer and string out of RV ? Thanks a lot ! dad
downvote count: 0
possible better answer: http://stackoverflow.com/a/25929003
has answer: http://stackoverflow.com/a/25929003
favorite count: 0
has answer: http://stackoverflow.com/a/25929030
tagged with: return-value

http://stackoverflow.com/comment/40590770
has text: This is because the bottom panel does not use `BorderLayout`, but the default `FlowLayout`,
comment on: http://stackoverflow.com/q/25929085
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40566901
type: QuestionComment
has text: @Pshemo: I have just commented so that it gets highlighted regarding the code's working that I want to know.. if u remove the comment it will work fine..
comment on: http://stackoverflow.com/q/25916075
score: 0
type: Comment

http://stackoverflow.com/q/25896897
has answer: http://stackoverflow.com/a/25897023
type: Question
tagged with: object
tagged with: oop
downvote count: 5
has body: i have an object for example called myObject and this object has an integer which is 5. How would i send this object to another class or retrieve the object from its class it was created in so i can use the object and all its values even though i created in a different class? the class myObject was created from public class Class { int Int; public void setInt(i) { Int = i; } } how would i send the object below to another class where i can use it and have access to all its values etc. Class myObject = new Class(); myObject.setInt(5);
has answer: http://stackoverflow.com/a/25897257
answer count: 2
has comment: http://stackoverflow.com/comment/40531820
upvote count: 0
has comment: http://stackoverflow.com/comment/40531838
favorite count: 0
has title: How do i get an object from another class in java
has comment: http://stackoverflow.com/comment/40531804
has comment: http://stackoverflow.com/comment/40531981
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40531866
score: -5
has comment: http://stackoverflow.com/comment/40531762
tagged with: java

http://stackoverflow.com/comment/40571440
has text: well, if you want to simulate real races, i can assume it's a workflow and in this case, linked list just work perfectly and solve your problem in O(1).
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25918169
type: Comment

jdbc
tags question: http://stackoverflow.com/q/25911668
tags question: http://stackoverflow.com/q/25982045
tags question: http://stackoverflow.com/q/26007541
tags question: http://stackoverflow.com/q/25892923
tags question: http://stackoverflow.com/q/25995892
tags question: http://stackoverflow.com/q/25929301
tags question: http://stackoverflow.com/q/25907742
tags question: http://stackoverflow.com/q/25995144
tags question: http://stackoverflow.com/q/25905368
tags question: http://stackoverflow.com/q/25930946
tags question: http://stackoverflow.com/q/25959240
tags question: http://stackoverflow.com/q/25905835
tags question: http://stackoverflow.com/q/25972526
type: Tag
tags question: http://stackoverflow.com/q/25884698
tags question: http://stackoverflow.com/q/25939121
tags question: http://stackoverflow.com/q/25999014
tags question: http://stackoverflow.com/q/25918416
tags question: http://stackoverflow.com/q/25934666
tags question: http://stackoverflow.com/q/25892563
tags question: http://stackoverflow.com/q/25902881
tags question: http://stackoverflow.com/q/25921275
tags question: http://stackoverflow.com/q/25903856
tags question: http://stackoverflow.com/q/26028087
tags question: http://stackoverflow.com/q/25923696
tags question: http://stackoverflow.com/q/25876829
tags question: http://stackoverflow.com/q/25983508
tags question: http://stackoverflow.com/q/25979642
tags question: http://stackoverflow.com/q/25928868
tags question: http://stackoverflow.com/q/25880891
tags question: http://stackoverflow.com/q/25934155
tags question: http://stackoverflow.com/q/25927093
tags question: http://stackoverflow.com/q/26019614
tags question: http://stackoverflow.com/q/25990571
tags question: http://stackoverflow.com/q/25886466
tags question: http://stackoverflow.com/q/26002259
tags question: http://stackoverflow.com/q/25993151
tags question: http://stackoverflow.com/q/25889354
tags question: http://stackoverflow.com/q/25888607
tags question: http://stackoverflow.com/q/25996460
tags question: http://stackoverflow.com/q/26023970
tags question: http://stackoverflow.com/q/25892982
tags question: http://stackoverflow.com/q/25886523
tags question: http://stackoverflow.com/q/26024939
tags question: http://stackoverflow.com/q/25917773
tags question: http://stackoverflow.com/q/25895817
tags question: http://stackoverflow.com/q/25990658
tags question: http://stackoverflow.com/q/25987072
tags question: http://stackoverflow.com/q/25883403
tags question: http://stackoverflow.com/q/25949730
tags question: http://stackoverflow.com/q/25898865
tags question: http://stackoverflow.com/q/25927230
tags question: http://stackoverflow.com/q/25966979
tag name: jdbc
tags question: http://stackoverflow.com/q/25969716
tags question: http://stackoverflow.com/q/25924042
tags question: http://stackoverflow.com/q/25997841

http://stackoverflow.com/comment/40755336
type: Comment
comment on: http://stackoverflow.com/q/26007201
has text: Apparently you are not familiar with basic Java syntax. And by "basic" I really mean basic. Grab a book of the sorts of "Writing your very first Java program", as someone fixing the errors you have here is useless both for the site and for you.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40585858
comment on: http://stackoverflow.com/q/25926404
type: Comment
has text: Can there be multiple consecutive `-` and `_`?
score: 0
type: QuestionComment

http://stackoverflow.com/q/25922336
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40578852
has answer: http://stackoverflow.com/a/25922518
accepted answer: http://stackoverflow.com/a/25922518
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40578894
answer count: 1
score: 0
tagged with: user-interface
has body: I am trying to get my parsed XML data onto my GUI that I am making. The goal is to click the "Open connection" button (which has the code in it from the class Open Connection) to open the connecting to the XML webpage, then use the "Get Headlines" button (which has the code in it from the NPRInfo class) to get the Titles and Descriptions of the articles to show up in the text box. Ignore the Keyword button for now, I will start working on that once I fix this problem. Can anybody please point out what I am doing wrong and how I can go about fixing it? Thanks for any and all help! //import java.io.*; //import java.io.BufferedReader; //import java.io.InputStreamReader; import java.net.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.xml.parsers.*; import org.w3c.dom.*; public class NPRNews extends JFrame implements ActionListener { JButton btnURL; JButton btnKW; JButton btnTD; JTextArea txtArea; /** * */ private static final long serialVersionUID = 1L; public static void main(String[] args) throws Exception { new NPRNews(); } public NPRNews() throws Exception { super("NPR News"); setupGUI(); NPRInfo(); registerListeners(); } public void NPRInfo() throws Exception { try { DocumentBuilderFactory XmlBuilder = DocumentBuilderFactory.newInstance(); DocumentBuilder xBuilder = XmlBuilder.newDocumentBuilder(); Document xml = xBuilder.parse(new URL("http://www.npr.org/rss/rss.php?id=1001").openStream()); if(xml==null) System.out.println("no XML DOM Document retrieved."); xml.getDocumentElement().normalize(); NodeList nList = xml.getElementsByTagName("item"); if(nList==null) System.out.println("No elements with tag name channel retrieved."); int temp = 0; for (temp = 0; temp &lt; nList.getLength(); temp++) { Node nNode = nList.item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE){ Element eElement = (Element) nNode; txtArea.setText("Title : " + eElement.getElementsByTagName("title").item(0).getChildNodes().item(0).getNodeValue()); txtArea.se…
has title: Attempting to parse an XML and get info onto a GUI
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/26034191
upvote count: 4
downvote count: 0
has body: You should read entire file in data provider and return iterator of test cases. Here is some pseudocode for data provider. Notice that I used List&lt;String []&gt; to store test cases instead of Object[][]. This allows you do define test cases dynamically. @DataProvider(name = "test") public Iterator&lt;Object []&gt; provider( ) throws InterruptedException { List&lt;Object []&gt; testCases = new ArrayList&lt;&gt;(); String[] data= null; //this loop is pseudo code br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { // use comma as separator data= line.split(cvsSplitBy); testCases.add(data); } return testCases.iterator(); }
has comment: http://stackoverflow.com/comment/40782178
type: Answer
answers question: http://stackoverflow.com/q/26033985
has comment: http://stackoverflow.com/comment/40784787
score: 4

http://stackoverflow.com/comment/40996344
comment on: http://stackoverflow.com/a/26031943
has text: the params are passed from `jndi.properties`, this is what the default constructor for the initial context pulls them from. `localhost` works fine, but the remote address fails as above.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40635199
score: 0
has text: You need to add to your `List` not `Adapter`
comment on: http://stackoverflow.com/q/25954576
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25998872
has comment: http://stackoverflow.com/comment/40737889
has comment: http://stackoverflow.com/comment/40775956
has comment: http://stackoverflow.com/comment/40750243
has comment: http://stackoverflow.com/comment/40785762
score: 0
has comment: http://stackoverflow.com/comment/40749608
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40750171
has comment: http://stackoverflow.com/comment/40749800
has comment: http://stackoverflow.com/comment/40750341
has body: I edited your code: public class GameThing extends Applet { // External resources BufferedImage rightSprite, leftSprite, spriteDead, backgroundImg; // Game data int state = 1; //0 = left, 1 = right, 2 = dead // Geometry int locX = 100, locY = 300; int bgX = 0, bgY = 0; int groundX = 0, groundY = 334, groundW = 500, groundH = 50; int appletW = 600, appletH = 480; int wallW = 20, wallH = 40, wallX = 20, wallY = groundY - wallH; final int STEP_SIZE = 7; // Information final String X_LOC_STR = "Sprites Current X Location is: "; final String Y_LOC_STR = "Sprites Current Y Location is: "; final String STATE_STR = "Currently: "; final String X_BG_STR = "Background X location is: "; String stateString = ""; // Double buffering Image offscreen; Graphics bufferGraphics; Dimension dim; // GUI components Panel gamePanel; Panel statusPanel = new Panel(); Label xLocLabel = new Label(); Label yLocLabel = new Label(); Label stateLabel = new Label(); Label xBGLocLabel = new Label(); @Override public void init() { // Load images try { rightSprite = ImageIO.read(new File(getClass().getResource("SpriteRIght.png").getPath())); leftSprite = ImageIO.read(new File(getClass().getResource("SpriteLeft.png").getPath())); spriteDead = ImageIO.read(new File(getClass().getResource("SpriteDead.png").getPath())); backgroundImg = ImageIO.read(new File(getClass().getResource("Background.png").getPath())); } catch (IOException e) { e.printStackTrace(); } // Set the panel that displays data statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.Y_AXIS)); statusPanel.add(xLocLabel); statusPanel.add(yLocLabel); statusPanel.add(stateLabel); statusPanel.add(xBGLocLabel); // Create the panel that draws the game and specify its behavior gamePanel = new Panel() { // Reduces flickering @Override public void update(Graphics g) { paint(g); } // DRAW MAIN CHARACTER SPRITE AND BACKGROUND @Override public void paint(Graphics g) { bufferGraphics.clearRect(0, 0, dim.width, dim.width); bufferGraphics.drawImage(bac…
type: Answer
accepted answer of: http://stackoverflow.com/q/25991552
answers question: http://stackoverflow.com/q/25991552
has comment: http://stackoverflow.com/comment/40747341

http://stackoverflow.com/q/26016116
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40753036
type: UnansweredQuestion
tagged with: opencv
score: 2
has title: Detecting smile inside face using openCV in Java
has comment: http://stackoverflow.com/comment/40753214
tagged with: detection
tagged with: java
has comment: http://stackoverflow.com/comment/40751869
has answer: http://stackoverflow.com/a/26020969
has body: I am working on a openCV application. With some code, I am able to detect frontalfaces. I want to detect and just keep a count of the times user smiled. My idea was after the face is detected, I am drawing a rectangle around it, and at that point I would call smile detection. So far, my result are less then successful. I am posting my code for face detection, can anyone give me any pointers how to start from the for loop inside face detection. THank you. public Mat detect(Mat inputframe) { Mat mRgba = new Mat(); Mat mGrey = new Mat(); MatOfRect faces = new MatOfRect(); inputframe.copyTo(mRgba); inputframe.copyTo(mGrey); Imgproc.cvtColor(mRgba, mGrey, Imgproc.COLOR_BGR2GRAY); Imgproc.equalizeHist(mGrey, mGrey); face_cascade.detectMultiScale(mGrey, faces); System.out.println(String.format("Detected %s face", faces.toArray().length)); MatOfRect smileDetections = new MatOfRect(); face_cascade1.detectMultiScale(mGrey,smileDetections); System.out.println(String.format("Detected %s smiles",smileDetections.toArray().length)); for (Rect rect : faces.toArray()) { Point center = new Point(rect.x + rect.width * 0.5, rect.y + rect.height * 0.5); Core.ellipse(mRgba, center, new Size(rect.width * 0.5, rect.height * 0.5), 0, 0, 360, new Scalar(255, 0, 255), 4, 8, 0); } return mRgba; } }
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40752812

http://stackoverflow.com/q/25890677
answer count: 1
has comment: http://stackoverflow.com/comment/40520533
linked to: http://stackoverflow.com/q/3988788
tagged with: writer
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/25890769
type: AnsweredQuestion
has body: Can someone explain me why I get: java.lang.StringIndexOutOfBoundsException: String index out of range: 5 File file = new File("file.txt"); BufferedWriter writer = null; Date date; SimpleDateFormat dt = new SimpleDateFormat("yyyy-MM-dd"); try { writer = new BufferedWriter(new FileWriter(file)); writer.write(" ",0,1); writer.write("FICH", 1, 4); writer.write("1234", 5, 4); writer.close(); System.err.println(writer.toString()); } catch (IOException ex) { Logger.getLogger(FicheroTdALogic.class.getName()).log(Level.SEVERE, null, ex); } finally { try {writer.close();} catch (Exception ex) {} }
tagged with: file
upvote count: 1
downvote count: 1
type: Question
tagged with: bufferedwriter
has title: Error writting a txt file String index out of range
tagged with: java
has answer: http://stackoverflow.com/a/25890769

http://stackoverflow.com/comment/40684776
type: Comment
has text: The output should be the same, because he doesn't ever test for a zero denom as far as I could read, that means that x > 0 is always true, which is fine in this case. Due diligence suggests that you should add a test to have it reach that error point.
comment on: http://stackoverflow.com/a/25979976
type: AnswerComment
score: 0

http://stackoverflow.com/comment/73724752
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/43305895
has text: You have to add it in answer not as a comment :)
type: Comment

http://stackoverflow.com/a/25959640
score: 1
has body: First things first: Check that OpenGL is properly supported. Run the glxinfo command and post its output here; you can safely omit the lengthy list of supported framebuffer formats (GLXVisuals and GLXFBConfigs). One possibility is, that you're running in a composited environment and don't use double buffering. Actually single buffered rendering and window composition are a match made in heaven, because the composition step acts very much like a buffer swap, but the design of the existing drivers and APIs make it hard to synchronize between finishing the rendering and composition so the double buffer swap is repurposed for that.
upvote count: 1
answers question: http://stackoverflow.com/q/25957768
type: Answer
downvote count: 0

http://stackoverflow.com/q/25938601
type: Question
has comment: http://stackoverflow.com/comment/40609369
has comment: http://stackoverflow.com/comment/40609466
has title: Parseing JSON Array with unnamed fields with GSON
tagged with: parsing
favorite count: 0
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40609997
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: So I want to parse flightradar24.com data into a Java program. The data seems to be JSON-ish and thus I am trying to read it using GSONs JSonParser. Here is a short excerpt of what I try to parse (you can see it in full e.g. in http://arn.data.fr24.com/zones/italy_all.js?callback=pd_callback): pd_callback({"45da286":["4CAAB6",43.5609,12.6837,211,34975,420,"7311","F-LIBP2","B772","EI-ISA",1411143824,"NRT","FCO","AZ785",0,0,"AZA785",0], "45dae4b":["7809B9",47.5892,15.8256,204,36000,442,"7303","F-LKTB2","A332","B-5921",1411143824,"PVG","FCO","MU787",0,0,"CES787",0], "45dae73":["76CEF7",47.6238,17.2440,291,36000,428,"0342","F-LKTB1","B77W","9V-SWW",1411143826,"SIN","LHR","SQ318",0,0,"SIA318",0], "45db3e2":["71BC61",46.0211,10.0549,242,22800,344,"7313","F-LIPE1","B744","HL7461",1411143824,"ICN","MXP","KE927",0,-2176,"KAL927",0], "full_count":10394,"version":4}); Each line in the example above resembles the data of a certain flight at that moment, with id, lat, lon, and so on. I have removed pd_callback(...); and just to try it I removed ""full_count":10394,"version":4" as well. When I try to parse this string to an iterable JSON Object Array, e.g. like this: com.google.gson.JsonParser jsonParser = new JsonParser(); com.google.gson.JsonArray jsa = jsonParser.parse(line).getAsJsonArray(); I always get parsing errors. I think one of the problems is that the field names are not given and the syntax might be wrong, but thats actually how flightradar reads the data. In the end, I just want to be able to iterate through each flight and to read each attribute as a primitive to then feed it into my own objects. Anyone with an idea where the problem is or how I can parse this kind of data conveniently? Any comments appreciated.
downvote count: 1
has comment: http://stackoverflow.com/comment/40608000
has comment: http://stackoverflow.com/comment/40610145

http://stackoverflow.com/q/25900688
score: 0
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25901640
linked to: http://stackoverflow.com/q/25755340
possible better answer: http://stackoverflow.com/a/25901640
tagged with: libgdx
tagged with: camera
tagged with: border
has body: I am using the LibGDX orthographic camera class to handle different screen sizes and it works pretty well for me. The only issue I have is the border around the screen when the device doesn't stretch to scale. I don't mind a border that much, the only thing that bothers me is the color of the border. I think it would look much nicer if it was black instead of white. Any way to change that? Also I posted another question about android touch handling that was never answered. If someone could answer that, that would be great. I don't want to have to ask it again, I don't want to seem spammy. My Question
type: AnsweredQuestion
has title: LibGDX Orthographic camera: Make borders black instead of white (java)
has answer: http://stackoverflow.com/a/25901017
tagged with: orthographic
type: Question
accepted answer: http://stackoverflow.com/a/25901017

http://stackoverflow.com/a/25987546
has body: There are a lot of things wrong with your code, so here is a simplified rewrite: public static void main(String[] args) { String s = "boy india apple"; String[] split = s.split( " " ); String[] toReturn = new String[split.length]; for (int i = 0; i &lt; split.length;i++) { String word = split[i]; char[] chars = word.toCharArray(); chars[chars.length/2] = Character.toUpperCase( chars[chars.length/2] ); toReturn[i] = String.valueOf( chars ); } System.out.println(Arrays.toString( toReturn )); } In order to correct your code you can start by removing the useless ArrayList and moving the System.out outside of the for loop. There are some other issues like you are appending the new result to the original so newar after this runs will look like {boybOy, indiainDia, appleapPle}. EDIT: For teaching purposes, here is your code modified so that it will work; however inefficient. public static void main(String[] args) { ArrayList&lt;String&gt; al = new ArrayList&lt;String&gt;(); al.add("boy india apple"); String str[] = al.toArray(new String[al.size()]); String newar[]; String delimiter = " "; newar = str[0].split(delimiter); System.out.print("{"); for (int i = 0; i &lt; newar.length; i++) { char[] c = newar[i].toCharArray(); for (int j = 0; j &lt; c.length; j++) { if (j == c.length / 2) { c[j] = Character.toUpperCase(c[c.length / 2]); } System.out.print(c[j]); } newar[i] = String.valueOf(c); if (i &lt; newar.length - 1) System.out.print(","); } System.out.println("}"); }
type: Answer
answers question: http://stackoverflow.com/q/25987349
score: 0

http://stackoverflow.com/q/25995362
has comment: http://stackoverflow.com/comment/40727978
has comment: http://stackoverflow.com/comment/40709007
possible better answer: http://stackoverflow.com/a/25995547
type: Question
has body: Consider the following code: public class Test { static private volatile Integer number1 = 42; static private volatile Integer number2 = 42; public static void main(String[] args) { Test test = new Test(); test.changeInteger(number1); System.out.println(number1); } public void changeInteger (Integer number) { number = new Integer(3); } } I would like to change the value of either number1 or number2 depending on the argument I pass to the method changeInteger. Obviously this doesn't work. Is there a way to make this work in Java without using reflection? To clarify: I want the call changeInteger(number1) to change the field number1.
has answer: http://stackoverflow.com/a/25995547
has comment: http://stackoverflow.com/comment/40709162
has comment: http://stackoverflow.com/comment/40708960
has answer: http://stackoverflow.com/a/25995856
has comment: http://stackoverflow.com/comment/40708789
downvote count: 0
has comment: http://stackoverflow.com/comment/40709355
favorite count: 0
has answer: http://stackoverflow.com/a/25995494
answer count: 3
has comment: http://stackoverflow.com/comment/40709232
has comment: http://stackoverflow.com/comment/40708845
has title: Dereferencing possible?
accepted answer: http://stackoverflow.com/a/25995856
has comment: http://stackoverflow.com/comment/40709256
linked to: http://stackoverflow.com/q/40480
upvote count: 1
has comment: http://stackoverflow.com/comment/40709406
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/25927306
has body: Is it possible, from OOP standpoint, to create the following program: If I have a Tracker class that is supposed to track several web-queried data, can I have multiple Tracker instances (~50) running concurrently and querying different data? ** Can I have each Tracker object pass its data (when necessary) to an array inside a Processor class that I have also created? Can the Processor class run simultaneously in the background processing the data the Tracker objects deliver, continuously? To clarify, is it possible to create multiple class instantiations that run concurrently with the main program and pass data to a common variable? How could this be implemented while avoiding prob;ems where the main program is accessing the common variable while the Tracker instances are passing data to it? The program is meant to run indefinitely. Is the scenario I am thinking of related to Threading in Java, or is it more advanced, or something else entirely? I understand this is an involved question and I appreciate any and all answers. Please note that while I have pseudo-code, I have not written any of the actual code yet. I want to get some nudges in the right direction before I start. I am looking into @Soana's answr, but more answers would also be great!
tagged with: java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/25930337
type: Question
tagged with: concurrency
score: 0
has title: How to handle multiple instances of class running concurrently and independently in an "OOP" fashion?
answer count: 1
has comment: http://stackoverflow.com/comment/40587496
has comment: http://stackoverflow.com/comment/40587463
has answer: http://stackoverflow.com/a/25930337
has comment: http://stackoverflow.com/comment/40587929
has comment: http://stackoverflow.com/comment/40588720
type: AnsweredQuestion
tagged with: oop

http://stackoverflow.com/q/25925972
favorite count: 0
has comment: http://stackoverflow.com/comment/40586575
answer count: 5
downvote count: 5
tagged with: single-instance
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26017062
has comment: http://stackoverflow.com/comment/40656243
tagged with: java
tagged with: object-composition
type: Question
possible better answer: http://stackoverflow.com/a/25927017
has answer: http://stackoverflow.com/a/25927017
score: -2
has comment: http://stackoverflow.com/comment/40882807
has answer: http://stackoverflow.com/a/26030508
accepted answer: http://stackoverflow.com/a/26030508
has comment: http://stackoverflow.com/comment/40639062
has answer: http://stackoverflow.com/a/25998744
has answer: http://stackoverflow.com/a/25995569
upvote count: 3
linked to: http://stackoverflow.com/q/137975
tagged with: singleton
has comment: http://stackoverflow.com/comment/40850427
has body: java version 1.7.0_65 I have a singleton design pattern class. That will always return the same instance that is initially created. However, the problem I have is this class needs to create many other objects from another class. I have used composition for this (instance of POI class in ArlabFacade). From this singleton instance the client should be able to create many POI objects. And I don't want to expose the internal workings of the POI class, everything has to go through the singleton instance. private static ArlabFacade mArlabFacade = null; private POI mPoi; /* Should be able to create many object of this class */ private ArlabFacade(Context context) { /* initialize properties */ mContext = context; mPoi = null; } public static ArlabFacade getInstance(Context context) { /* Create a synchronised singleton instance */ ReentrantLock lock = new ReentrantLock(); lock.lock(); if(mArlabFacade == null) { mArlabFacade = new ArlabFacade(context); } lock.unlock(); return mArlabFacade; } I have tried doing something like this, but it has 2 problems. 1) I don't want to return the class instance of POI 2) because I only have a single instance the mPoi will be overwritten by the next client call to this function. This function will just overwrite: public POI createNewPOI() { return mPoi = new POI(); } Is there any design patterns that address this problem?
has title: Creating many objects using composition when the containing class is a singleton pattern

http://stackoverflow.com/a/26010186
has comment: http://stackoverflow.com/comment/40737560
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26009492
has comment: http://stackoverflow.com/comment/40736378
has comment: http://stackoverflow.com/comment/40737400
has comment: http://stackoverflow.com/comment/40737476
has comment: http://stackoverflow.com/comment/40736498
has comment: http://stackoverflow.com/comment/40784706
has comment: http://stackoverflow.com/comment/40737511
has body: Change your calendar value to Calendar calendar = Calendar.getInstance(); calendar .set(Calendar.HOUR_OF_DAY, 0); calendar .set(Calendar.MINUTE, 0); calendar .set(Calendar.SECOND, 0); and set alarm.
has comment: http://stackoverflow.com/comment/40736327

http://stackoverflow.com/a/25937102
score: 0
has body: Unless you specified a queue name, all deferred tasks go into the "default" Task Queue. From there, you can rerun and if you are on local dev server (debug mode) you can step through the code.
answers question: http://stackoverflow.com/q/25934325
type: Answer
has comment: http://stackoverflow.com/comment/42638710

http://stackoverflow.com/comment/40669738
type: AnswerComment
has text: this work except when used in a split function it will split the `two (,) three` to `two`, `,` and `three`. But I wanted if this `(?![^)()]*\))` takes care of removing the `()`. Can you please explain how your solution works? Thank you
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25973041

http://stackoverflow.com/a/25901899
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25878083
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25878083
has body: I solved the problem by changing the code to use download the file using HttpClient and then checking the response headers for Content-Disposition. If not found then generate a random file using the hostname and the timestamp.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/25887858
answer count: 1
tagged with: converters
has answer: http://stackoverflow.com/a/25887909
accepted answer: http://stackoverflow.com/a/25887909
type: AnsweredQuestion
tagged with: jspinner
score: 0
tagged with: java
tagged with: milliseconds
tagged with: date
has body: i'm using JXDatePicker and JSpinner to input date and time from the user. I then need to format it back to one date in a long millisecond format. with input of 03/09/2014 in JXDatePicker , the output from the JXDatePicker is: Wed Sep 03 00:00:00 IDT 2014 and with input of 11:00 in JSpinner, the output from JSpinner is : Thu Jan 01 22:33:00 IST 1970 I need to combine both this outputs to get the full date , and then convert it to a long in millis. I use this code: SimpleDateFormat f = new SimpleDateFormat("DDD MMM dd yyyy hh:mm:ss"); String string_date = datePicker.getDate().toString().substring(0, 11) + datePicker.getDate).toString().substring(24, 28) + hourPicker.getValue().toString().substring(10,19); Date d; try { d = f.parse(string_date); } catch (ParseException e3) { e3.printStackTrace(); } and get this exception: java.text.ParseException: Unparseable date: "Wed Sep 17 2014 12:44:22" at java.text.DateFormat.parse(Unknown Source) at MainFrame.sendButtonActionPerformed(MainFrame.java:598) at MainFrame.access$3(MainFrame.java:574) at MainFrame$3.actionPerformed(MainFrame.java:434) please help ! thanks, Dave.
type: Question
has title: Unparseable date exception Creating a date from two objects

http://stackoverflow.com/comment/40620262
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25945197
type: Comment
has text: If ThreadFactory doesn't manage lifecycle of threads, how will I manage it if it is under the ThreadFactory?

http://stackoverflow.com/q/26029308
answer count: 1
tagged with: tomcat
has title: Tomcat7 throws exception in ubuntu Eclipse Juno
accepted answer: http://stackoverflow.com/a/26034103
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26034103
type: Question
has body: I have exactly similar project configured in windows environment and that works like charm but when I configured the same in ubuntu and tries to deploy app on tomcat, it throws this exception: SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/svc]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/svc]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.NoClassDefFoundError: org/json/JSONException at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2436) at java.lang.Class.getDeclaredFields(Class.java:1806) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:89) at org.apache.catalina.startup.WebAnno…
tagged with: ubuntu
tagged with: eclipse
score: 0

http://stackoverflow.com/q/25916477
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
has body: I'm working in a spring mvc project using spring data jpa and hibernate, I am using native queries that I declare in a interface that extends JpaRepository like this: public interface I_Table_one extends JpaRepository&lt;table_id, Long&gt;{ @Query(value ="select name_att, .... .... various att" + "from Table_one " + "where id_table = 4 ", nativeQuery = true) public List&lt;Table_one_Mapped_Class&gt;serachInTable(); This method doesn't have to much sense is just a example, I have one that have like 80 attributes in the select I just one to know is there is a way to know what column name I have wrong. My mapped class: @Entity @Table(name="Table_one") public class Table_one_Mapped_Class implements Serializable { private static final long serialVersionUID = 1L; ////ID/////// @Id @Column (name="ID_TABLE", nullable=false) private Long idInMyTable; ////ID/////// .....other columns This is my hibernate properties configuration: jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.Oracle10gDialect"); jpaProperties.put("hibernate.format_sql", true); jpaProperties.put("hibernate.ejb.naming_strategy", "org.hibernate.cfg.ImprovedNamingStrategy"); jpaProperties.put("hibernate.show_sql", true); and I get the following error when i try to print a value from my controller class in a html page like this ${value} I get this error in the console : WARN : org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 17006, SQLState: 99999 ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Invalid Column Name and this error when I try to open the page Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.GenericJDBCException: could not execute query; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query In the console says: invalid column name but how can I know what column have a invalid name, is in the query that I put in the inter…
has title: Show erros in hibernate spring-data jpa
has answer: http://stackoverflow.com/a/25926846
type: Question
tagged with: jpa
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/26030445
has body: For this you have to add alert box Just like the below code new AlertDialog.Builder(this) .setTitle("Delete entry") .setMessage("Are you sure you want to delete this entry?") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete } }) .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); or try this AlertDialog.Builder builder1 = new AlertDialog.Builder(context); builder1.setMessage("Write your message here."); builder1.setCancelable(true); builder1.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder1.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert11 = builder1.create(); alert11.show();
score: 0
answers question: http://stackoverflow.com/q/26030340
type: Answer

http://stackoverflow.com/comment/40550673
comment on: http://stackoverflow.com/q/25906985
type: QuestionComment
has text: Hmmm, how about @JsonIgnoreProperties({"genre"}) or @JsonIgnore
score: 0
type: Comment

http://stackoverflow.com/a/26235262
accepted answer of: http://stackoverflow.com/q/26018318
score: 0
has body: That's exactly why WebSockets exist! HTTP/1.x is synchrone so it's not possibe without that.
answers question: http://stackoverflow.com/q/26018318
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/25974051
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40674374
has title: Using Canvas zu display a picture on x/y position
type: Question
has comment: http://stackoverflow.com/comment/40670118
score: 0
tagged with: canvas
has body: I currently started to program android using the Android Studio IDE. At the moment I try to place a picture at a x/y position. But I always get a NULL Pointer Exception. Code: package main.com.test; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import java.util.Random; public class main extends ActionBarActivity { Canvas canvas; public int x=50,y=20, i=0; public Bitmap picture; public Random rand = new Random(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); picture = BitmapFactory.decodeResource(getResources(),R.drawable.picture); } @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); } //@Override public void onDraw(Canvas canvas) { canvas.drawBitmap(picture,x,y,null); } public void press(View button){ int red = rand.nextInt(255); int green = rand.nextInt(255); int blue = rand.nextInt(255); i++; TextView tv = (TextView)findViewById(R.id.textView); Button button1 = (Button)findViewById(R.id.button); onDraw(canvas); tv.setText("Test "+i); button1.setText("test"); button.setBackgroundColor(Color.rgb(red,green,blue)); } }…
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/25971170
has comment: http://stackoverflow.com/comment/40665372
type: Answer
answers question: http://stackoverflow.com/q/25971031
has body: The Ternary statement requires the separate parts to be expressions and not statements You are not allowed to invoke statements in the separate branches. For more information see the Java Language specification section 15.25
has comment: http://stackoverflow.com/comment/40665285
score: 9
accepted answer of: http://stackoverflow.com/q/25971031
upvote count: 9
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40585571
type: Comment
comment on: http://stackoverflow.com/a/25926114
has text: you don't need student id in BOOK table as you already have student object in BOOK class referenced to Student Entity. Use JPA reverse enginneing tool(to generate Entity classes for you) to avoid this kind of problem.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40723732
score: 0
type: Comment
has text: We have a central POM to pin external dependencies. Tks a lot.
comment on: http://stackoverflow.com/a/25986409
type: AnswerComment

console-application
tags question: http://stackoverflow.com/q/25943023
tag name: console-application
tags question: http://stackoverflow.com/q/25926010
type: Tag

view
tags question: http://stackoverflow.com/q/25961263
tags question: http://stackoverflow.com/q/26006440
tags question: http://stackoverflow.com/q/25965833
tags question: http://stackoverflow.com/q/25881555
type: Tag
tags question: http://stackoverflow.com/q/25919574
tag name: view

http://stackoverflow.com/q/25890034
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/31225380
score: 0
tagged with: raspberry-pi
answer count: 3
has body: I have the following simple code written in java-ME embedded: public class JavaMEApplication2 extends MIDlet { @Override public void startApp() { GPIOPinConfig config1 = new GPIOPinConfig(DeviceConfig.DEFAULT, 4, GPIOPinConfig.DIR_OUTPUT_ONLY, DeviceConfig.DEFAULT , GPIOPinConfig.TRIGGER_NONE, true); try { GPIOPin pin = (GPIOPin) DeviceManager.open(config1); Thread.sleep(2000); pin.setValue(false); pin.setDirection(GPIOPinConfig.MODE_INPUT_PULL_UP); } catch (IOException ex) { Logger.getLogger(JavaMEApplication2.class.getName()).log(Level.SEVERE, null, ex); } catch (InterruptedException ex) { Logger.getLogger(JavaMEApplication2.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void destroyApp(boolean unconditional) { } } The previous code run just fine (My LED is turned ON and OFF) until the execution reach this statement: pin.setDirection(GPIOPinConfig.MODE_INPUT_PULL_UP); The following exception occurs: TRACE: &lt;at java.security.AccessControlException: &gt;, startApp threw an Exception java.security.AccessControlException: My API permissions Configuration: Can any one please tell me why this exception occurs? and if there's another way to toggle the same pin between OUTPUT Mode and INPUT Mode in java-Me embedded?
has answer: http://stackoverflow.com/a/26831395
has title: Java Me 8 raspberry pi - java.security.AccessControlException
tagged with: exception
type: UnansweredQuestion
tagged with: java-me
has answer: http://stackoverflow.com/a/30803983

http://stackoverflow.com/comment/40583320
comment on: http://stackoverflow.com/q/25924871
score: 0
type: QuestionComment
has text: equals returns boolean so you are not use || with String anyway
type: Comment

http://stackoverflow.com/a/26030624
has body: Create a global ArrayList and add the contents to it using add() and pass it to ArrayAdapter. It's better to pass the List or String[] to ArrayAdapter and set that adapter to List You should update the List or Array being passed to Adapter, not Adapter itself. ArrayList&lt;String&gt; myList ; myList = new ArrayList&lt;String&gt;; myList.add("ONE"); // add items to List myList.add("TWO"); myList.add("THREE"); myList.add("FOUR"); ArrayAdapter&lt;String&gt; ad = new ArrayAdapter&lt;String&gt; (this, android.R.layout.simple_list_item_1, myList); // pass List to ArrayAdapter yourListView.setAdapter(ad); // set the adapter to ListView. EDIT Please remove the ScrollView. Using ListView inside ScrollView is not allowed. Because ListView by default has Scrolling effect.
has comment: http://stackoverflow.com/comment/40783653
has comment: http://stackoverflow.com/comment/40783746
type: Answer
has comment: http://stackoverflow.com/comment/40781945
has comment: http://stackoverflow.com/comment/40783329
has comment: http://stackoverflow.com/comment/40782753
has comment: http://stackoverflow.com/comment/40773936
upvote count: 2
has comment: http://stackoverflow.com/comment/40774148
has comment: http://stackoverflow.com/comment/40773984
answers question: http://stackoverflow.com/q/26030425
has comment: http://stackoverflow.com/comment/40774241
has comment: http://stackoverflow.com/comment/40783130
score: 2
downvote count: 0

http://stackoverflow.com/comment/106540453
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25873711
has text: @theftprevention LOL. Well played sir!

http://stackoverflow.com/q/25884797
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40510740
has comment: http://stackoverflow.com/comment/40510364
tagged with: parsing
type: Question
has body: I am using java AST parser (eclipse API) to parse java files. I want to extract all the lines before any "IF" condition in methods. Can anyone please tell how to do it. Following is the example code: Void method1() { L1: System.out.println("This is first line"); L2: System.out.println("Line 2"); L3: L4 if(1==0) L5: { L6: System.out.println("no cond"); L7: } L8: } output:System.out.println("This is first line"); System.out.println("Line 2");
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40696143
has title: Extracting all the lines before IF block in Java AST parser
tagged with: abstract-syntax-tree
answer count: 0

http://stackoverflow.com/comment/40747875
comment on: http://stackoverflow.com/q/26015350
score: 1
type: Comment
type: QuestionComment
has text: To start with, arrays start with index 0, not 1.

http://stackoverflow.com/a/25929270
upvote count: 4
downvote count: 0
has body: Its nice if you synchronize your methods so when you writing data to the DB and same time your read method execute then there is possibilities that you will get old data in output not the currently updated data. Thanks
type: Answer
answers question: http://stackoverflow.com/q/25929212
has comment: http://stackoverflow.com/comment/40590914
has comment: http://stackoverflow.com/comment/40590981
score: 4

http://stackoverflow.com/comment/113228583
type: Comment
score: 1
has text: This is the most secure and transparent way to go if you trust the .cer file. Thanks for your contribution!
type: AnswerComment
comment on: http://stackoverflow.com/a/37520140

http://stackoverflow.com/a/25926608
answers question: http://stackoverflow.com/q/25926042
has body: Entity works well. It is the problem of column name. To make sure your DDL, you can use with &lt;property name="eclipselink.ddl-generation" value="drop-and-create-tables"/&gt;. As @Sanket Pipariya said, you don't need @Column(name="student_id") private String studentID; Because you already have Student Object ('student_id' column in Book table). You are using insertable=false in Student attribute in Book Class so that when you persist Book object along with Student attribute, student_id column in Book table will be null.
type: Answer
score: 0

http://stackoverflow.com/comment/40748543
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26017115
has text: Well... it depends on the parser... If the parser decides to set the distance to 0... But I doubt it would succeed in making an `int` `null`.

http://stackoverflow.com/comment/40715876
score: 0
type: Comment
has text: But you have a single question mark, and an array of values. You might try a string of comma-separated values instead.
type: QuestionComment
comment on: http://stackoverflow.com/q/25999014

http://stackoverflow.com/comment/40626669
comment on: http://stackoverflow.com/a/25949854
type: Comment
score: 0
has text: I did consider Strategy pattern but really I don't want to make the algorithm implementations interchangeable, just extensible (by adding new algorithms). So I'd like to have them in separate classes, but not sure if Strategy pattern covers this particular scenario.
type: AnswerComment

http://stackoverflow.com/comment/40771185
score: 0
has text: possible duplicate of [How to do map inversion with Guava with non-unique values?](http://stackoverflow.com/questions/3678601/how-to-do-map-inversion-with-guava-with-non-unique-values)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26029181

http://stackoverflow.com/comment/40596887
type: Comment
type: QuestionComment
has text: No. Use standard `@EJB(name="ejb/BeanInterfaceRef") BeanInterface myBean;` Then you can map `ejb/BeanInterfaceRef` to the JNDI of bean in earA, for example via jboss.xml - http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/ENC_Usage_Conventions-EJB_References_with_jboss.xml_and_jboss_web.xml.html
comment on: http://stackoverflow.com/q/25929395
score: 0

http://stackoverflow.com/a/74626336
score: 0
answers question: http://stackoverflow.com/q/25907081
type: Answer
has body: if you have imported some packages in your projects so there may be a possibility of expiring the same. and there are two solutions: change your local system date download the package again with a new user id. I hope it will help.

http://stackoverflow.com/comment/40712157
has text: Yes it is already set.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25996987
score: 0

libgdx
tags question: http://stackoverflow.com/q/25976590
tags question: http://stackoverflow.com/q/25875616
tags question: http://stackoverflow.com/q/25979986
tags question: http://stackoverflow.com/q/25922851
tags question: http://stackoverflow.com/q/25950325
tags question: http://stackoverflow.com/q/25901322
tags question: http://stackoverflow.com/q/25920769
tag name: libgdx
tags question: http://stackoverflow.com/q/25944566
tags question: http://stackoverflow.com/q/26005706
tags question: http://stackoverflow.com/q/25962250
tags question: http://stackoverflow.com/q/25995231
tags question: http://stackoverflow.com/q/25895130
tags question: http://stackoverflow.com/q/25898395
tags question: http://stackoverflow.com/q/25942979
tags question: http://stackoverflow.com/q/25890925
tags question: http://stackoverflow.com/q/26001296
type: Tag
tags question: http://stackoverflow.com/q/25905901
tags question: http://stackoverflow.com/q/25941488
tags question: http://stackoverflow.com/q/25883907
tags question: http://stackoverflow.com/q/25900688
tags question: http://stackoverflow.com/q/26005337
tags question: http://stackoverflow.com/q/25955552
tags question: http://stackoverflow.com/q/25958274
tags question: http://stackoverflow.com/q/26033241
tags question: http://stackoverflow.com/q/25926450
tags question: http://stackoverflow.com/q/25966156
tags question: http://stackoverflow.com/q/25942126
tags question: http://stackoverflow.com/q/25944088
tags question: http://stackoverflow.com/q/25886126
tags question: http://stackoverflow.com/q/25927447
tags question: http://stackoverflow.com/q/25970852
tags question: http://stackoverflow.com/q/25940650
tags question: http://stackoverflow.com/q/25939577
tags question: http://stackoverflow.com/q/25943788
tags question: http://stackoverflow.com/q/25874794
tags question: http://stackoverflow.com/q/25980118
tags question: http://stackoverflow.com/q/25965833
tags question: http://stackoverflow.com/q/26028625

http://stackoverflow.com/a/25884033
has body: In the old days, when there wasn't as much choice as today regarding fonts, people used workarounds to create bold fonts. One way to make a font bold, was by adding the same text over and over again at the same position. I think that this is happening to you. When you use page events correctly, the onEndPage() method is triggered automatically each time a page ends. My guess is that you're doing something very wrong that triggers the onEndPage() many times. Maybe you are called the onEndPage() from your code, maybe you're adding the page event to the writer more than once (and page events are cumulative). If I have to guess, I would guess that you are doing the latter. My guess is based on the fact that you are using variables such as FooterImage in your onEndPage() method. How are you setting that variable. If you are setting it in the constructor of the page event and you're adding the new page event over and over again to the writer, then you're doing it wrong.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25874818
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25874818
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/40530144
score: 1
comment on: http://stackoverflow.com/q/25895974
type: Comment
type: QuestionComment
has text: why exactly you want to do that? It seems like an overkill. Maybe tell us why you are doing this and we can suggest a more efficient solution

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/25948512
tags question: http://stackoverflow.com/q/25951523
tags question: http://stackoverflow.com/q/26030340
tags question: http://stackoverflow.com/q/26006440
type: Tag
tags question: http://stackoverflow.com/q/25963127
tags question: http://stackoverflow.com/q/25876575

http://stackoverflow.com/comment/40720450
has text: Sorry I made a mistake with the directory structure, the changes have been amended in the previous comment
score: 0
comment on: http://stackoverflow.com/q/26001398
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40713470
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25988883
type: AnswerComment
has text: Now I guess this is your code. Env setup wise things look ok. As I mentioned I am not sure about the code, you might have study a bit before implementing

http://stackoverflow.com/a/25925474
type: Answer
answers question: http://stackoverflow.com/q/25925306
score: 0
has body: Instead of synchronizing count, Try doing increment/decrement method that are themselves synchronized... public static synchronized decrementCount() { count--; } public static synchronized incrementCount() { count++; } And call them instead of directly decrementing/incrementing. Also, you should use atomic value if you are only doing a counter which prevent thread interference without resorting to synchronization. Anyway, check this doc which show you how to do a synchronized counter with synchronized methods or atomic values : http://docs.oracle.com/javase/tutorial/essential/concurrency/atomicvars.html

http://stackoverflow.com/comment/40636295
type: Comment
type: QuestionComment
score: 2
has text: you just gave us code. Tell what's the problem? What's wrong with output?
comment on: http://stackoverflow.com/q/25955439

http://stackoverflow.com/comment/40636845
comment on: http://stackoverflow.com/q/25955683
score: 0
has text: It's "equally 50/50" regardless of the seed. The seed only affects which particular "50/50" sequence you get.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25976738
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40675834
score: 2
has body: onCreate() is too early to call getView() and it will return null. Postpone the code that needs to touch the fragment's view hierarchy to onCreateView() or later in the fragment lifecycle.
has comment: http://stackoverflow.com/comment/40675425
has comment: http://stackoverflow.com/comment/40675318
upvote count: 2
answers question: http://stackoverflow.com/q/25976580

http://stackoverflow.com/comment/40493162
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25875304
has text: Thank you, this one worked better, I had used matches() to identify if the regex has been found. Thanks for your suggestions everyone

http://stackoverflow.com/a/25897645
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40533270
has comment: http://stackoverflow.com/comment/40533562
score: 1
upvote count: 1
has body: change this progress += count; to progress++; EDIT Check here Int count = inputStream.read(b, off, len); Does count == the full length of your file ?
answers question: http://stackoverflow.com/q/25897609

http://stackoverflow.com/q/25956404
has comment: http://stackoverflow.com/comment/40647719
accepted answer: http://stackoverflow.com/a/26642377
downvote count: 0
tagged with: string
duplicate of: http://stackoverflow.com/q/2486191
favorite count: 0
has comment: http://stackoverflow.com/comment/40639009
tagged with: string-pool
has answer: http://stackoverflow.com/a/26346008
has body: If for example: String str1 = “abc”; String str2 = new String(“def”); Then, Case 1: String str3 = str1.concat(str2) will go in the heap or pool? Case 2: String str4 = str2.concat(“HI”) will go in the heap or pool?
has answer: http://stackoverflow.com/a/26642377
type: AnsweredQuestion
has title: Create New Strings in normal memory and in string pool
score: 1
linked to: http://stackoverflow.com/q/2486191
linked to: http://stackoverflow.com/q/3801343
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26346008
tagged with: java
has comment: http://stackoverflow.com/comment/40638077
answer count: 2

http://stackoverflow.com/q/25897714
type: Question
tagged with: lucene
score: 0
has body: I developed a little software implementing Lucene to find files. But I'm trying to use it in my network, and if someone is with the software open I can't open it in another computer it just hangs. How can I fix it? Is it normal? I have a git in case you want to read the code. GitHub
has comment: http://stackoverflow.com/comment/40564300
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40570305
tagged with: java
has title: Can't open Java Lucene application in more than one computer

http://stackoverflow.com/q/25955664
tagged with: return-value
answer count: 0
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/40636780
tagged with: java
has comment: http://stackoverflow.com/comment/40636735
score: 0
has comment: http://stackoverflow.com/comment/40636913
has body: public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int num = 6; int[] sticks = new int[num]; String line = br.readLine(); String[] strs = line.trim().split("\\s+"); for(int i=0;i&lt;num;i++) { sticks[i] = Integer.parseInt(strs[i]); } recursion(sticks,num); } public static void recursion(int[] sticks,int num) { int min_num = findMin(sticks,num); int cut=0; for(int i=0;i&lt;num;i++) { sticks[i] = sticks[i] - min_num; cut++; } int[] res = minArray(sticks,num); System.out.println(cut); int len = res.length; while(len != 0) { recursion(res,len); } } public static int findMin(int[] arr,int size) { int minimum = arr[0]; for(int i=0;i&lt;size;i++) { if(arr[i] &lt; minimum) { minimum = arr[i]; } } return minimum; } public static int[] minArray(int[] arr, int size) { int count=0; int flag =0; for(int i=0;i&lt;size;i++) { if(arr[i] != 0) { count++; } } if(count == 0) { flag = 1; } else { flag = 0; } int[] new_array = new int[count]; if(count != 0) { int j=0; for(int i=0;i&lt;size;i++) { if(arr[i] != 0) { new_array[j] = arr[i]; j++; if(j &gt; count) { break; } } } } return new_array; } } here from the minArray i would also like to pass the flag variable back to the recursion method so that i can check that as my base class So What my program tries to do is enter 6 sticks length among the 6 sticks length we try to find the minimum length and subtract that length from all the remaining sticks which will ultimately lead to one or more sticks with minimum length become zero so i extract only the non zero elements and generate another array and repeat the same until all the sticks have exhausted. Meanwhile i m printing the number of sticks that is been cut by each minimum stick length. so, if my input is 5 4 4 2 2 8 output is : 6 4 2 1
tagged with: arrays
has title: how to make an method return both an integer array and another integer
type: UnansweredQuestion
tagged with: return-type

http://stackoverflow.com/q/25963206
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/25963410
answer count: 1
has body: I have a class Item And create multiple objects (tree, tv, book. etc) in the class Game // Create the items tree = new Item("tree", "I big green tree", 60); coat = new Item("coat", "I white coat", 5); paper = new Item("paper", "a role of wc paper", 1); Now a player (also playerclass) must save some items. The player can get this item by typing: get book, where book is the String secondWord. Now i need a function in the class Game that can get a object by a string. For example; The player enters take book. player1.takeItem(Item secondWord); and in the class player i have this function takeItem() /** * Method to take item * and add them to the ArrayList carriedItems * @param secondCommandWord is the second word command * Ex: take book -&gt; book is then command */ public void takeItem(Item secondCommandWord) { // Add new item to carried list carriedItems.add(secondCommandWord); } But this doesn't work. Hope you could help me
favorite count: 0
type: UnansweredQuestion
score: -3
tagged with: object
has comment: http://stackoverflow.com/comment/40650629
tagged with: java
has title: Java search object by string
downvote count: 3

http://stackoverflow.com/q/25906229
has body: bool func1(classA* A,int numberOfA,double (&amp;result)[4]); "A" is pointed to an array of classA bool func2(double param4[4]);
has comment: http://stackoverflow.com/comment/40588864
has comment: http://stackoverflow.com/comment/40588719
has title: how to wrap this function from C++ to Java with swig
has comment: http://stackoverflow.com/comment/40588893
has comment: http://stackoverflow.com/comment/40552456
tagged with: c++
answer count: 0
score: 0
type: UnansweredQuestion
type: Question
tagged with: swig
tagged with: java

http://stackoverflow.com/q/25978194
score: 0
has body: Is it possible to download large files (> 2^31-1 bytes) through the android DownloadManager? The question is caused by column DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR refers to int filed in database. What if bytes count will be more then 2^31-1? Thanks.
has answer: http://stackoverflow.com/a/25978526
answer count: 1
tagged with: android
tagged with: android-download-manager
type: UnansweredQuestion
tagged with: android-sqlite
type: Question
has title: Download large files through android download manager
tagged with: java

http://stackoverflow.com/q/25945288
tagged with: java
has title: Can a class have a "IS A Relationship" with itself?
has comment: http://stackoverflow.com/comment/40619531
type: Question
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/40619514
score: -1
downvote count: 3
has comment: http://stackoverflow.com/comment/40620058
has body: class A { } class B extend A { int i; int j; } Can a class have an IS-A Relationship with itself? In this question, B is an A, right? But can class B have an IS-A relationship with class B?
has answer: http://stackoverflow.com/a/25945413
linked to: http://stackoverflow.com/q/4584541
has comment: http://stackoverflow.com/comment/40619689
favorite count: 0
has comment: http://stackoverflow.com/comment/40619568
tagged with: scjp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40619537
has comment: http://stackoverflow.com/comment/40619663

http://stackoverflow.com/comment/40779635
comment on: http://stackoverflow.com/q/26018730
has text: Why don't just inflate a normal XML file then? Regarding multiple ids, see the second answer to this question: http://stackoverflow.com/questions/1714297/android-view-setidint-id-programmatically-how-to-avoid-id-conflicts. However, I would first try with a fixed number of views to check if the problem is actually solved.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40730228
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26006540
has text: I fixed it (see my comment), but I'll give you the answer anyway.
type: AnswerComment

exit
tags question: http://stackoverflow.com/q/25952297
tags question: http://stackoverflow.com/q/25943644
type: Tag
tag name: exit
tags question: http://stackoverflow.com/q/25992231
tags question: http://stackoverflow.com/q/26032461

http://stackoverflow.com/q/25989048
has title: Too much boilerplate, how can I reduce my POJO builders?
has answer: http://stackoverflow.com/a/25989243
has comment: http://stackoverflow.com/comment/40698105
downvote count: 0
tagged with: pojo
has answer: http://stackoverflow.com/a/25989260
score: 6
possible better answer: http://stackoverflow.com/a/25989243
has body: I have several different POJOs that use a builder pattern, but after adding a builder for each one and generating Object.toString, Object.hashCode and Object.equals, my classes end up being around 100 lines of code. There has to be a better way to handle this. I think having some sort of a reflective builder would help out a lot, but I'm not sure this would be good practice and I'm also not sure how I'd exactly make it happen. In other words, is there a way to implement a builder like this? A simple POJO: public class Foo { public int id; public String title; public boolean change; ... } Then some sort of reflective builder: Foo = ReflectiveBuilder.from(Foo.class).id(1).title("title").change(false).build();
favorite count: 0
accepted answer: http://stackoverflow.com/a/25989260
tagged with: android
tagged with: design-patterns
has answer: http://stackoverflow.com/a/36873387
upvote count: 6
answer count: 4
type: AnsweredQuestion
tagged with: builder
tagged with: java
has comment: http://stackoverflow.com/comment/40697997
has answer: http://stackoverflow.com/a/36875132
type: Question

http://stackoverflow.com/comment/40597107
type: QuestionComment
comment on: http://stackoverflow.com/q/25932063
has text: @cfrick I'm still quite young in groovy scripting and I'm loosing sight of scope of variable all the time!!!
score: 0
type: Comment

http://stackoverflow.com/a/25990190
answers question: http://stackoverflow.com/q/25990075
has comment: http://stackoverflow.com/comment/40700170
has body: Create a function for the loop and the "do something": public void doSomething(Object element, int pos) { ... } public void myloop(Object nextElement, Object previousElement) { for (int i = 20; i &lt;= 30; i++) { doSomething(nextElement, i); nextElement = nextElement.next(); } for (int i = 20; i &lt;= 30; i++) { doSomething(previousElement, i); previousElement = previousElement.previous(); } } If you don't need the position in doSomething you can get rid of it. Also if you need to do different things in the first and second loop, create an other function, doSomething2
has comment: http://stackoverflow.com/comment/40700084
score: 0
has comment: http://stackoverflow.com/comment/40699983
type: Answer
has comment: http://stackoverflow.com/comment/40701547

http://stackoverflow.com/q/25996144
has comment: http://stackoverflow.com/comment/41636485
has body: I just started using Java regular expressions at work, and am having trouble with using the Matcher find() method. In the following code, i is a String parameter received from the client, and 'list' is a ready made linked list with String values, and I want to find the value in the list that appears in i at the smallest possible index out of all the other list values (if there is indeed a match). The values in the list might have an asterisk at their end, which means they have a wildcard, so there are 0 or more 'word characters' in their end - so I have to consider that when searching in i. Here is the code: Pattern checkRegex; int tStart = i.length(); for (String t : list){ if (t.charAt(t.length()-1) == '*') checkRegex = Pattern.compile("\\W" + t + "[0-9A-Za-z]*\\W"); else checkRegex = Pattern.compile("\\W" + t + "\\W"); Matcher regexMatcher = checkRegex.matcher(i); if (regexMatcher.find()){ if (tStart &gt; i.indexOf(regexMatcher.regionStart())) tStart = i.indexOf(regexMatcher.regionStart()); } I get the error - Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1 After debugging, I found that the program crashes at the regexMatcher.find() command - but since it is a boolean method, I don't understand what String indexes have to do here. Appreciate your help.
tagged with: regex
score: 2
has comment: http://stackoverflow.com/comment/40713013
linked to: http://stackoverflow.com/q/4829908
has comment: http://stackoverflow.com/comment/40713720
type: AnsweredQuestion
has title: Matcher find() method returns StringOutOfBounds exception
tagged with: java
tagged with: indexoutofboundsexception
has answer: http://stackoverflow.com/a/25996197
accepted answer: http://stackoverflow.com/a/25996197
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40710463
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40712848
favorite count: 0

http://stackoverflow.com/comment/40723112
has text: @KickButtowski Setters are below where the object ship is being created.
comment on: http://stackoverflow.com/q/26002738
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40494949
type: QuestionComment
has text: Fork-join _is_ a "right shape".
score: 0
comment on: http://stackoverflow.com/q/25875883
type: Comment

http://stackoverflow.com/q/25874659
tagged with: android
has answer: http://stackoverflow.com/a/25874773
type: AnsweredQuestion
tagged with: java
has title: Pause application until AnimationDrawable finishes
type: Question
has body: I'm newbie Android developer. I'm having problems writing a method that is designed to pause the application until the end of an animation. This is my code: public void CorrectAnimation() { Log.d("CorrectAnim", "Pass" ); final Button answer_1 = (Button) findViewById(R.id.answer_1); final Button answer_2 = (Button) findViewById(R.id.answer_2); final Button answer_3 = (Button) findViewById(R.id.answer_3); final Button answer_4 = (Button) findViewById(R.id.answer_4); if (iAnswer_1 == 1) { answer_1.setBackgroundResource(R.drawable.button_correctly); AnimationDrawable animAnswer_1 = (AnimationDrawable) answer_1.getBackground(); animAnswer_1.start(); checkIfAnimationDone(animAnswer_1); } ... } private void checkIfAnimationDone(AnimationDrawable anim){ Log.d("Check", "Pass" ); final AnimationDrawable a = anim; int timeBetweenChecks = 2500; Handler h = new Handler(); h.postDelayed(new Runnable(){ @override public void run(){ Log.d("checkRun", "Pass" ); if (a.getCurrent() != a.getFrame(a.getNumberOfFrames() - 1)){ Log.d("checkRunIf", "Pass" ); checkIfAnimationDone(a); } else{ Toast.makeText(getApplicationContext(), "ANIMATION DONE!", Toast.LENGTH_SHORT).show(); } } }, timeBetweenChecks); }; The problem is that checkIfAnimationDone() ignores the method Run(). RESOLVE: I forget add @override above "public run()". Code now is working :)
answer count: 1
accepted answer: http://stackoverflow.com/a/25874773
linked to: http://stackoverflow.com/q/2214735
score: 0

http://stackoverflow.com/comment/40611833
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25939807
has text: @ChathurangaSandaruwan: please re-read this link:[mcve](http://stackoverflow.com/help/mcve), your posted code needs to be compilable and runnable without altering it *by me*, and right now that's impossible as it has no imports, it refers to Files that I don't have, it calls methods that aren't included, including `initComponents()`, it refers to classes that I don't have, such as if2. Please if I'm to help you, please help me out by posting a small program that I can actually run, test and modify. Yes, I am asking extra work from you, but you're of course asking for work and effort from us.
type: AnswerComment

http://stackoverflow.com/comment/40779509
type: QuestionComment
comment on: http://stackoverflow.com/q/26033817
score: 0
has text: You could just do whatever setup code you're doing in `foo()` in the constructor? Why override it if you're just calling it immediately anyway?
type: Comment

http://stackoverflow.com/q/25984349
has comment: http://stackoverflow.com/comment/40693346
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25984384
has title: Calculating Average of all numbers between and including first and last numbers with Java
has body: The assignment is to use a a While loop to take the first and last numbers and to find the average of the numbers in between. I have the code typed out and I think it works mathematically but I keep on getting an error when I'm trying to display the answer ("Answer is" + average), it keeps on saying that the Average hasn't been Initialized. public static void whileLoop() { int smallNumber = Integer.parseInt(JOptionPane.showInputDialog("Enter the smallest number:")); int largeNumber = Integer.parseInt(JOptionPane.showInputDialog("Enter the largest number:")); int counter = smallNumber; int average; int total = 0; int numberCounter = 0; while (smallNumber &lt;= largeNumber) { total = counter + total; counter = counter + 1; numberCounter++; average = total / numberCounter; } JOptionPane.showMessageDialog(null, "Answer is: " + average); }
has comment: http://stackoverflow.com/comment/40689980
score: 1
tagged with: java
tagged with: loops
type: Question
tagged with: average
linked to: http://stackoverflow.com/q/2448843
has answer: http://stackoverflow.com/a/25984459
downvote count: 0
has answer: http://stackoverflow.com/a/25984417
accepted answer: http://stackoverflow.com/a/25984384
has answer: http://stackoverflow.com/a/25984404
has comment: http://stackoverflow.com/comment/40689856
answer count: 4
possible better answer: http://stackoverflow.com/a/25984404
favorite count: 0
has comment: http://stackoverflow.com/comment/40689737
upvote count: 1
has comment: http://stackoverflow.com/comment/40689925

http://stackoverflow.com/q/25893913
score: 7
possible better answer: http://stackoverflow.com/a/25908384
answer count: 2
tagged with: jstl
upvote count: 7
tagged with: jsp
favorite count: 0
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16619015
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25908384
tagged with: scriptlet
has body: what is a proper way to use variables from scriptlets in jstl? I don't know what is wrong in my code: &lt;% boolean a = true; boolean b = false; %&gt; &lt;c:choose&gt; &lt;c:when test="${a}"&gt; &lt;c:set var="x" value="It's true"/&gt; &lt;/c:when&gt; &lt;c:when test="${b}"&gt; &lt;c:set var="x" value="It's false"/&gt; &lt;/c:when&gt; &lt;/c:choose&gt; It looks like it doesn't go into the whole block.
has answer: http://stackoverflow.com/a/25894028
type: Question
accepted answer: http://stackoverflow.com/a/25894028
has title: How to pass java variables from scriptlets to c:when expression in jstl?
linked to: http://stackoverflow.com/q/3177733

http://stackoverflow.com/comment/40687710
comment on: http://stackoverflow.com/q/25983128
has text: +1 for the streaming json parser. But 28GB? It's likely that you have a design problem here. You might want to think about breaking it up into multiple files if possible, or finding some other, better way to store it.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/26010802
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26005981
has comment: http://stackoverflow.com/comment/40747191
has body: You pointed out to the correct JIRA ticket. From our tests it looks like: expected-response-type-expression="T (org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandlerTests).testParameterizedTypeReference()" Where it references to this method: public static ParameterizedTypeReference&lt;List&lt;String&gt;&gt; testParameterizedTypeReference() { return new ParameterizedTypeReference&lt;List&lt;String&gt;&gt;() {}; } Of course it can any static field with ParameterizedTypeReference type. From other side you can populate desired value of ParameterizedTypeReference to the headers before and use it as: expected-response-type-expression="headers.expectedResponseType" You can even have some bean which may return appropriate type from some its method according to the requestMessage. JsonToObjectTransformer can do something similar, but the result depends on the JSON engine. There is JsonHeaders, with which JsonToObjectTransformer gets deal when there is no provided target-class value. UPDATE As you noticed we are restricted with XML definition, when we can't specify a generic type and even can't privde an inline implementation from SpEL: new ParameterizedTypeReference&lt;List&lt;Shipment&gt;&gt;() {} doesn't work in SpEL at all. I see the workaround for the XML definition with inline Script, for example Groovy: &lt;int:header-enricher&gt; &lt;int:header name="expectedResponseType"&gt; &lt;int-groovy:script&gt; &lt;![CDATA[ new ParameterizedTypeReference&lt;List&lt;com.my.proj.domain.Shipment&gt;&gt;() {} ]]&gt; &lt;/int-groovy:script&gt; &lt;/int:header&gt; &lt;/int:header-enricher&gt;
score: 2
answers question: http://stackoverflow.com/q/26005981
has comment: http://stackoverflow.com/comment/40747493
downvote count: 0

http://stackoverflow.com/q/25956453
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/25959762
answer count: 1
has comment: http://stackoverflow.com/comment/40640883
tagged with: cryptography
has body: I'm trying to encrypt some files in my python web server and decrypt them in android app after downloading. I used python AES encryption java decryption question methods like this but I got padding exception in android code what can I do? my python code: from Crypto.Cipher import AES import os, random, struct key = '0123456789abcdef' mode = AES.MODE_CBC chunksize = 64*1024 iv = ''.join(chr(random.randint(0,0xFF)) for i in range(16)) encryptor = AES.new(key,mode,iv) filesize = os.path.getsize('sample.jpg') with open('sample.jpg','rb') as infile: with open('sample.enc','wb') as outfile: outfile.write(struct.pack('&lt;Q',filesize)) outfile.write(iv) while True: chunk = infile.read(chunksize) if len(chunk) == 0: break elif len(chunk) % 16 != 0: chunk += ' ' * (16 - len(chunk) % 16) outfile.write(encryptor.encrypt(chunk)) ## decrypt with open('sample.enc', 'rb') as infile: origsize = struct.unpack('&lt;Q', infile.read(struct.calcsize('Q')))[0] iv = infile.read(16) print('test',iv.hexdigest()) decryptor = AES.new(key, AES.MODE_CBC, iv) with open('sample2.jpg', 'wb') as outfile: while True: chunk = infile.read(chunksize) if len(chunk) == 0: break outfile.write(decryptor.decrypt(chunk)) outfile.truncate(origsize) And android code: package com.example.crypto; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.Key; import java.security.NoSuchAlgorithmException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.Secret…
favorite count: 0
has title: Encrypt files in python and decrypt in android
linked to: http://stackoverflow.com/q/14179784
type: UnansweredQuestion
tagged with: encryption
tagged with: python
has comment: http://stackoverflow.com/comment/40648458
has comment: http://stackoverflow.com/comment/40643843
tagged with: java
linked to: http://stackoverflow.com/q/9417092
upvote count: 1
has comment: http://stackoverflow.com/comment/40643005
downvote count: 1
type: Question

http://stackoverflow.com/q/25989317
tagged with: swing
linked to: http://stackoverflow.com/q/18243101
has body: I want to apply Insert key Action(Available in keyboard as "Insert" key) for all the opened Documents.By default It didn't work for any document.I write the code for Insert key.But,In my program Insert key Action has worked for only recent opened file only.I want add this feature to all opened files.Please check it once. Main Class: public class InsertDemo extends javax.swing.JFrame { JScrollPane scrollPane; JTextArea textArea; public InsertDemo() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { tabbedPane = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); file = new javax.swing.JMenu(); newFile = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); file.setText("File"); newFile.setText("NewFile"); newFile.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newFileActionPerformed(evt); } }); file.add(newFile); jMenuBar1.add(file); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 279, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE)) ); pack(); }// &lt;/editor-fold&gt; private void newFileActionPerformed(java.awt.event.ActionEvent evt) { textArea=new CaretTextArea(); scrollPane=new JScrollPane(textArea); tabbedPane.add(scrollPane); } public static void main(String args[]) { try { fo…
tagged with: java
tagged with: opendocument
type: Question
has comment: http://stackoverflow.com/comment/66773491
has comment: http://stackoverflow.com/comment/40702716
has title: How to Apply Insert key action for all opened Documents
has comment: http://stackoverflow.com/comment/40698518
has comment: http://stackoverflow.com/comment/40702540
linked to: http://stackoverflow.com/q/2000275
has comment: http://stackoverflow.com/comment/40698434
score: 0
tagged with: insert
has comment: http://stackoverflow.com/comment/40734845
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40698458
has comment: http://stackoverflow.com/comment/40700520

http://stackoverflow.com/q/25955683
type: Question
upvote count: 3
has comment: http://stackoverflow.com/comment/40637042
has comment: http://stackoverflow.com/comment/40636866
tagged with: random
has comment: http://stackoverflow.com/comment/40636845
has answer: http://stackoverflow.com/a/25955736
accepted answer: http://stackoverflow.com/a/25955736
answer count: 1
favorite count: 0
has body: I have this code that simulates 10 coin tosses: public void FlipCoinTenTimes() { Random randomNumberGenerator = new Random(); // Generate 10 random numbers for (int i = 0; i &lt; 10; i++) { randomNumberGenerator.setSeed(randomNumberGenerator.nextLong()); System.out.println(randomNumberGenerator.nextInt(2) == 0 ? "Heads" : "Tails"); } } Does the setting of the seed to a random long make this method any more random? I.e., more 50/50 than if I were to remove the setSeed() line?
type: AnsweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40636877
has comment: http://stackoverflow.com/comment/40639688
tagged with: java
has title: Does setting a Random objects' seed to a random value make the generator more random?

http://stackoverflow.com/q/25963133
upvote count: 2
has answer: http://stackoverflow.com/a/25963194
has body: I'm trying to take a backup of a mysql database using the following code. public boolean backupDB() { String executeCmd = "mysqldump -u root -p 1234 --add-drop-database -B test -r D:\\backup\\aaa.sql"; Process runtimeProcess; try { runtimeProcess = Runtime.getRuntime().exec(executeCmd); int processComplete = runtimeProcess.waitFor(); if (processComplete == 0) { System.out.println("Backup created successfully"); return true; } else { System.out.println("Could not create the backup"); } } catch (Exception ex) { ex.printStackTrace(); } return false; } But it always gives me this error: CreateProcess error=2, The system cannot find the file specified How can I resolve this? Thanks
type: AnsweredQuestion
score: 2
tagged with: database-backups
tagged with: runtime.exec
tagged with: java
has answer: http://stackoverflow.com/a/31719244
tagged with: mysql
type: Question
possible better answer: http://stackoverflow.com/a/31719244
accepted answer: http://stackoverflow.com/a/25963194
answer count: 2
has title: mysql database backup using mysqldump
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40516589
score: 0
type: AnswerComment
type: Comment
has text: Ok I got it to work. I compared the threaded programm with a simple for-loop with 40 files. The threaded program took 83 seconds to complete, the simple loop took 85 seconds. Not sure why there isn't more of a difference. Might have done something wrong, but maybe there just isn't much of a difference. I have just four cores in this machine, we'll see how it works on the 8 core machine. If I calculated correctly, 40 files at 85 seconds would mean more than 200 hours if converting... :/
comment on: http://stackoverflow.com/a/25887400

http://stackoverflow.com/comment/40735550
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25997346
has text: would defining my own maxpermgen affect the performance of my program?
score: 0

http://stackoverflow.com/q/25958699
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40649981
favorite count: 0
tagged with: image-manipulation
has body: I am trying to re-size an image with Java, and I need to get the exact effect that is happening when you re-size with Photoshop Nearest Neighbor (Preserve hard edges). The thing is I never get the exact same effect... I tried following methods: 1) java-image-scale by mortennobel lib resampleOp.setFilter(ResampleFilters.getBoxFilter()); this performs great, but leaves some artifacts in image, that are not there when photoshop does it. 2) TwelveMonkeys library for image manipulation. (here is the github link) Did not work as well, PointFilter completely destroys the gradient inside, and the Box filter does same thing as mortennobel getBoxFilter. 3) AWT AffineTransform, this was the worst one, completely unrealistic resize. Now I am confused, does photoshop's nearest neighbor re-size differently then what the name means, or all the other libs do it wrong (in second case, what is the lib that will do it right?) Here is the before and after images Photoshop generates And here is the image generated by get BoxFilter from mortennobel lib. I scaled images a bit up so you can see the details, in reality they are smaller. Any help is really appreciated :) I am really stuck on this.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40642220
has comment: http://stackoverflow.com/comment/40642299
tagged with: java
has answer: http://stackoverflow.com/a/25968327
tagged with: image-processing
has comment: http://stackoverflow.com/comment/40642995
has comment: http://stackoverflow.com/comment/40647404
type: Question
tagged with: image-scaling
has comment: http://stackoverflow.com/comment/40667694
score: 4
upvote count: 4
has title: Java Image Re-sizing - Nearest Neighbor

http://stackoverflow.com/a/25894588
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25893798
has comment: http://stackoverflow.com/comment/66584792
upvote count: 1
has body: xjc options could be passed to wsimport google xjc inheritance or jaxb2 inheritance &lt;jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" jaxb:extensionBindingPrefixes="inheritance"&gt; &lt;jaxb:bindings schemaLocation="customer.xsd" node="/xsd:schema"&gt; &lt;jaxb:bindings node="xsd:complexType[@name='customer']"&gt; &lt;inheritance:implements&gt;com.acme.foo.Actor&lt;/inheritance:implements&gt; &lt;/jaxb:bindings&gt; &lt;/jaxb:bindings&gt; See http://confluence.highsource.org/display/J2B/Using+JAXB2+Basics+Plugins+with+CXF http://confluence.highsource.org/display/J2B/JAXB2+Basics+Plugins http://www.javaworld.com/article/2074330/core-java/adding-common-methods-to-jaxb-generated-java-classes--jaxb2-basics-plugins-.html

http://stackoverflow.com/a/25959762
answers question: http://stackoverflow.com/q/25956453
score: 0
type: Answer
has body: That python code that you copied from this question in really not suitable for anything. It performs padding as a side effect of having a hard-coded constant CHUNKSIZE being a multiple of 16. If for some reason you didn't know this and changed the CHUNKSIZE to 1000 the code would fail in a hard-to-understand way. The padding used by the python code is also non-standard. To use something standard like PKCS5/7 padding, see this answer.

http://stackoverflow.com/q/25927079
has comment: http://stackoverflow.com/comment/40587124
has comment: http://stackoverflow.com/comment/40587105
downvote count: 1
tagged with: xmlhttprequest
has answer: http://stackoverflow.com/a/30588463
has answer: http://stackoverflow.com/a/30588195
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40587345
linked to: http://stackoverflow.com/q/2419223
upvote count: 8
type: Question
has comment: http://stackoverflow.com/comment/40587160
score: 7
tagged with: java
has body: What is the best way to determine whether a GET or POST request coming into a java servlet is an AJAX request? The method I've come across so far in my search is to strip the information out of the header with "XMLHttpRequest".equals(request.getHeader("X-Requested-With")); Are there other ways to handle this? It seems like relying on the header is not a terribly robust solution.
tagged with: servlets
linked to: http://stackoverflow.com/q/14004877
answer count: 2
has comment: http://stackoverflow.com/comment/40587001
favorite count: 0
tagged with: ajax
has title: Java Servlet: Best Way to Determine if request is AJAX

http://stackoverflow.com/comment/40768326
comment on: http://stackoverflow.com/q/26011607
has text: You need to post your configuration and the content of the remote ivy file. Most likely this is an ivy configuration issue. You state that publishing to a Maven repo works fine. That is because ivy will derive it's configurations (see: http://stackoverflow.com/questions/7104364/how-are-maven-scopes-mapped-to-ivy-configurations-by-ivy/7116577#7116577).
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25968114
tagged with: java
has comment: http://stackoverflow.com/comment/40660173
type: Question
has comment: http://stackoverflow.com/comment/40660019
has comment: http://stackoverflow.com/comment/40659835
score: 0
has body: I am trying to fetch a part of string that may be an expression. I didn't find any way to do this. Problem is that I have a string that have may have one or more expressions and I have to fetch them. For example, string is: - IF [100]&gt;[102] THEN [100]-[102] ELSE [102]-[100] Now, here [100] is representing a value, will be retrieved from database using 100 as primary key and same as for [102], so how to fetch the following [100]-[102] and [102]-[100] expressions from given string. Thank you!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40659827
answer count: 0
has title: Fetch expression from string [java]

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
tags question: http://stackoverflow.com/q/25873971
type: Tag

http://stackoverflow.com/comment/40541693
type: QuestionComment
comment on: http://stackoverflow.com/q/25902289
score: 2
has text: Did you mean to make the `decimalToUnsigned()` method static? I'm also not sure exactly what your question is. Do you need to get past the compile error or is something else wrong?
type: Comment

http://stackoverflow.com/q/26008650
has title: How can we get File() type object in Java from S3 amazon server open file URL?
has body: I have a cloud application having public URLs of files stored on S3 Amazon server i want to get File() object from that URL like: File file = new File("https://jcomplycustomers.s3.amazonaws.com/business%2FLite%2Fe38f3d28-cf78-4b74-9158-3f260782a123%2FLibrary%2Fcea3737f-25ed-4473-b340-27ec257b59f3.docx"); but failed to get this file, exception return by the system is 'File doesn't exist', but if i paste this URL in browser, browser open this file. I have check this with converting URL to URI and try to get object but failed. same exception there as well. Actually i don't want to first download this file and again access with that local URL. and don't want to convert it in streams etc Now my problem is only this how can i get object of File() from this public URL?
upvote count: 0
tagged with: amazon-s3
tagged with: java
type: Question
answer count: 1
score: -1
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/26008702
tagged with: file-io
downvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26027161
has body: When you declare a checked Exception in the signature of a method, you don't need to handle it in this method. At the contrary, any method calling loader will have either to declare this Exception in its header or handling it in a try/catch block : public void someMethod() throws IOException { loader(...); } // or public void someMethod() { try { loader(...); } catch (IOException io) { //... } }
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26027090
upvote count: 1

http://stackoverflow.com/q/25984379
has comment: http://stackoverflow.com/comment/40689753
tagged with: hashmap
has title: how to retrieve and iterate values from a java bean using HashMap
tagged with: java
score: -1
type: Question
has body: Hi friends I dont have experience working with hashmap, I need to create 3 hashmap elements in a java class to retrieve and iterating the values coming from a java bean like this private String value1; private String value2; private String value3; public String getValue1() { return value1; } public void setValue1(String value1) { this.value1 = value1; } public String getValue2() { return value2; } public void setValue2(String value2) { this.value2 = value2; } public String getValue3() { return value3; } public void setValue3(String value3) { this.value3 = value3; } I need to sort each value in each hashmap HashMap&lt;String&gt; values1 = new HashMap&lt;String&gt;(); HashMap&lt;String&gt; values2 = new HashMap&lt;String&gt;(); HashMap&lt;String&gt; values3 = new HashMap&lt;String&gt;(); Could you please help me? thanks in advance!
has comment: http://stackoverflow.com/comment/40689846
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25984470
favorite count: 0
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/comment/40588937
has text: But changing the node is not the point of setting the reference variable to that node. All I need is a reference to that node. which I am not getting unless I do something like `foundNode = node; return foundNode;` And change the method's return type from `void` to `Node`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25926924
type: AnswerComment

http://stackoverflow.com/a/25917017
has comment: http://stackoverflow.com/comment/40735238
has comment: http://stackoverflow.com/comment/40709909
has body: There is a command (ProfileList) to query for installed configuration profiles. This way you can check whether they were installed or not. There is alway s a command (Restrictions). It will return the list of all applied restrictions (both globals and configured through profiles). And there is a command (SecurityInfo). It will return whether passcode a present and compliant with profiles.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25913880
answers question: http://stackoverflow.com/q/25913880
has comment: http://stackoverflow.com/comment/40718168
type: AcceptedAnswer

http://stackoverflow.com/a/25933973
has comment: http://stackoverflow.com/comment/40600007
has comment: http://stackoverflow.com/comment/40601124
has comment: http://stackoverflow.com/comment/40599491
has comment: http://stackoverflow.com/comment/40602417
score: 0
has comment: http://stackoverflow.com/comment/40599606
has body: Maybe try to define 3 Data sources and 3 Persistence units. jdbc/DS1 ... jdbc/DS2 ... jdbc/DS3 ... And inject Entity manager from whatever Persistence unit you want. @PersistenceContext(unitName = "PU2") EntityManager em; This should work, although I didn't test it.
type: Answer
answers question: http://stackoverflow.com/q/25924716

http://stackoverflow.com/q/25903478
has comment: http://stackoverflow.com/comment/40544150
tagged with: java
has comment: http://stackoverflow.com/comment/40543972
tagged with: concurrency
has title: Multiple threads executing code IF they are the same type
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40544081
has answer: http://stackoverflow.com/a/25913510
type: Question
has body: Basically I have two classes that implement runnable, with n number of instantiations of these two classes, and I want them to be able to access a resource if they are the same type of class that is currently within the critical section. I also want to achieve fairness between the different class types. Pseudocode: if object is currentType, allow access to critical section else, wait What is the best way to achieve this? It's very similar to ReentractReadWriteLock where any amount of readers are allowed, but a writer is mutually exclusive. I need any amount of object of Class1 allowed and any amount of Class2 allowed but not both types at the same time.
has answer: http://stackoverflow.com/a/25903693
has comment: http://stackoverflow.com/comment/40544303
score: 0
answer count: 2
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/25903693
accepted answer: http://stackoverflow.com/a/25913510

http://stackoverflow.com/q/25951758
accepted answer: http://stackoverflow.com/a/26180230
has body: I have a file with some non-ASCII character like set myval;[2K[DESC[DESC[D and I have a Java code to read the file public static void main(String[] args) { BufferedReader br = null; try { String sCurrentLine; br = new BufferedReader(new FileReader("output.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(); } } } In Netbeans those non ASCII are not shown but in Eclipse console those character are displayed as it is. I want to know how Netbeans were able to remove those character as i need to clean up my files for those non ASCII characters. Thanks
tagged with: netbeans
tagged with: non-ascii-characters
score: 0
has title: Eclipse console vs Netbeans Console
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26180230
tagged with: eclipse
answer count: 1
tagged with: ide

http://stackoverflow.com/q/25965294
has comment: http://stackoverflow.com/comment/40673815
has title: Extraction of unique values form a array list
tagged with: text-extraction
accepted answer: http://stackoverflow.com/a/25965442
upvote count: 0
has comment: http://stackoverflow.com/comment/40654584
has body: I'm pretty new to programming in Java and I want to make a program that will print out some values from a file. I want to import a array list from a file which contains a large set of repeated numbers. The program should print out only one unique number of set. For example, the array contains these numbers: 0,0,0,0,2,2,2,2,2,3,3,3,3,3,5,5,5,5,8,8,10,10,2,2,2,3,3,7,7 and what I should get out of it is this: 0,2,3,5,8,10,2,3,7 The same would be needed if the array wasn't containing integers, but floating point numbers: 0.23, 0.23, 0.23, 0.23, 1.89, 1.89, 1.89, 1.89, 1.89, 2.56, 2.56, 2.56, 2.56, 2.56, 3.13, 3.13 The output should be: 0.23, 1.89, 2.56, 3.13 Has anyone some suggestions on how should I build the loop? Thanks in advance
has answer: http://stackoverflow.com/a/25965442
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25965324
has answer: http://stackoverflow.com/a/25965453
tagged with: java
has answer: http://stackoverflow.com/a/25965324
tagged with: loops
type: Question
linked to: http://stackoverflow.com/q/1011344
downvote count: 2
score: -2
favorite count: 0
answer count: 3

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/25897148
type: Tag

http://stackoverflow.com/comment/64269383
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25884219
has text: @lilalinux no doubt. still, implementation may vary. i've seen some bad examples in templating that were ridiculously slow.
score: 0

progress-bar
tags question: http://stackoverflow.com/q/25907727
tag name: progress-bar
type: Tag

http://stackoverflow.com/comment/108466531
type: AnswerComment
has text: AWS can't create a decent API to save itself. For my next project I am moving to Google Cloud. It can hardly be worse.
type: Comment
comment on: http://stackoverflow.com/a/29201989
score: 2

http://stackoverflow.com/a/25884029
type: Answer
has comment: http://stackoverflow.com/comment/40508473
upvote count: 5
answers question: http://stackoverflow.com/q/25883994
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40508551
downvote count: 0
has body: Use : if (x.intValue() % 2 == 0) PS : if(x % 2==0) should also work because integer.intValue() should be called internally. Byte code for :if(x % 2==0) 11: invokevirtual #23; //Method java/lang/Integer.intValue:()I --&gt; line of interest 14: iconst_2 15: irem
accepted answer of: http://stackoverflow.com/q/25883994

http://stackoverflow.com/comment/40631939
type: Comment
type: AnswerComment
has text: Thanks for the prompt reply but, when I do this, I get a compilation error. I will update my original question with the error as it is quite long.
comment on: http://stackoverflow.com/a/25953132
score: 0

http://stackoverflow.com/a/25886988
accepted answer of: http://stackoverflow.com/q/25886675
upvote count: 3
answers question: http://stackoverflow.com/q/25886675
type: AcceptedAnswer
has body: Try something like Platform.runLater(new Runnable() { @Override public void run() { Node n = listView1.lookup(".scroll-bar"); if (n instanceof ScrollBar) { final ScrollBar bar = (ScrollBar) n; if (bar.getOrientation().equals(Orientation.VERTICAL)) { // get the second scrollbar of another listview and bind values of them } } } });
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/q/25988192
type: Question
has answer: http://stackoverflow.com/a/25988426
has answer: http://stackoverflow.com/a/25988596
answer count: 2
linked to: http://stackoverflow.com/q/21852917
has comment: http://stackoverflow.com/comment/40696654
downvote count: 0
has title: In which fragment method we need to consume weservice of long run
favorite count: 0
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/23333092
has body: In which method it will be appropriate to call the web service from an android fragment? oncreateView() or oncreate() or onViewCreated()
has comment: http://stackoverflow.com/comment/40696637
tagged with: android-fragments
linked to: http://stackoverflow.com/q/21282126
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/25963087
tagged with: tomcat
favorite count: 0
has title: Spring MVC Controller invoked but getting 404 rendering view
accepted answer: http://stackoverflow.com/a/25967323
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has body: My apologies up front if this is answered elsewhere, but some extensive googling of the site has come up with nothing that has helped me thus far, so I'm going to ask here. So, I have a Spring MVC application that I'm trying to map out using annotations, and while for some requests it works fine, for others I'm getting 404's even after the controller has been invoked. So, here's my setup... web.xml : org.springframework.web.context.ContextLoaderListener org.springframework.web.util.Log4jConfigListener log4jConfigLocation /WEB-INF/classes/log4j.properties springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* REQUEST ERROR FORWARD INCLUDE sitemesh org.sitemesh.config.ConfigurableSiteMeshFilter sitemesh /* requiredVariableFilter org.springframework.web.filter.DelegatingFilterProxy targetBeanName requiredVariableFilter requiredVariableFilter /* REQUEST ERROR appServlet org.springframework.web.servlet.DispatcherServlet 1 appServlet / My appServlet-servlet.xml : /WEB-INF/pages/ .jsp My controller. It's pretty simple for now : @Controller @RequestMapping("/user") public class UserController { static Logger log = Logger.getLogger(UserController.class); @Autowired private UserService userService; @RequestMapping(method = RequestMethod.GET) public ModelAndView getBaseUserInfo(HttpServletRequest request, HttpServletResponse response) { log.info("got into the user controller"); ModelAndView mav = new ModelAndView("user/baseinfo"); User user = this.userService.getCurrentUser(); mav.addObject("user", user); log.info("passing off to view"); return mav; } } I can assure you that I have the relevant jsp at /WEB-INF/pages/user/baseinfo.jsp, so it's not that the JSP isn't there. Also, my logging shows that the log messages in the controller are being fired, so it gets as far as returning the view, then Tomcat gives me it's oh-so-pretty 404 page, and my logs only say that /user is returning a 404. Alternatively, though, I have anoth…
has comment: http://stackoverflow.com/comment/40656844
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25967323
has comment: http://stackoverflow.com/comment/40652187
type: Question
has comment: http://stackoverflow.com/comment/40658340
has comment: http://stackoverflow.com/comment/40658185
tagged with: java
answer count: 1
downvote count: 0
tagged with: jsp

http://stackoverflow.com/comment/40624082
comment on: http://stackoverflow.com/q/25944389
score: 0
type: Comment
type: QuestionComment
has text: Yes, it returns user 1 as it should

http://stackoverflow.com/comment/45339806
score: 0
comment on: http://stackoverflow.com/a/26705646
type: Comment
has text: It is fun watching it work live in analytics, isn't it? To make sure it doesn't slow down my program startup, I put the above code in a java Thread. That way if the user has a slow internet connection it won't slow down the whole program. p.s. I updated my answer again and put the example library first.
type: AnswerComment

http://stackoverflow.com/a/26019567
has comment: http://stackoverflow.com/comment/40753685
score: 3
has body: You are changing the contents of the array while iterating over it. When removing an item at position x, the item at position x+1 will get the new position x, but since x has already been visited by the loop, the next iteration will be position x+1, and the item that now holds position x will be skipped. You need to do something like shown here: removing items from list in java I.e. implement Iterable, and remove items using an Iterator
type: Answer
has comment: http://stackoverflow.com/comment/40753650
upvote count: 3
has comment: http://stackoverflow.com/comment/40753312
downvote count: 0
answers question: http://stackoverflow.com/q/26019463
has comment: http://stackoverflow.com/comment/40753203

http://stackoverflow.com/q/25935447
has answer: http://stackoverflow.com/a/25935580
accepted answer: http://stackoverflow.com/a/25935580
tagged with: saxparser
upvote count: 1
has body: I'm currently trying to make a java file that can do an export with xml. The only thing I need to actually retrieve is the staff id's and nothing else.If my xml file looks like this: &lt;? xml version= "1.0" ?&gt; &lt; company&gt; &lt; staff id = "22" &gt; &lt; firstname&gt; kate &lt;/firstname &gt; &lt; lastname&gt; kim &lt;/lastname &gt; &lt; nickname&gt; lolo &lt;/nickname &gt; &lt; salary&gt; 10560&lt;/ salary &gt; &lt;/ staff&gt; &lt; staff&gt; &lt; firstname&gt; Chelsea &lt;/firstname &gt; &lt; lastname&gt; young&lt;/ lastname &gt; &lt; nickname&gt; cheloung &lt;/nickname &gt; &lt; salary&gt; 200700&lt;/ salary &gt; &lt;/ staff&gt; &lt; staff id = "23" &gt; &lt; firstname&gt; Dani &lt;/firstname &gt; &lt; lastname&gt; Heil &lt;/lastname &gt; &lt; nickname&gt; Heily &lt;/nickname &gt; &lt; salary&gt; 300000&lt;/ salary &gt; &lt;/ staff&gt; &lt;/ company&gt; and my java code looks like this: package xmlfunctions; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class saxParser { public static void main(String argv[]) { try { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); DefaultHandler handler = new DefaultHandler() { boolean bfname = false; public void startElement(String uri, String localName,String qName, Attributes attributes) throws SAXException { System.out.println("Start Element :" + qName); if (qName.equalsIgnoreCase("FIRSTNAME")) { bfname = true; } } public void endElement(String uri, String localName, String qName) throws SAXException { System.out.println("End Element :" + qName); } public void characters(char ch[], int start, int length) throws SAXException { if (bfname) { System.out.println("First Name : " + new String(ch, start, length)); bfname = false; } } }; saxParser.parse("KatesFile.xml", handler); } catch (Exception e) { e.printStackTrace(); } }…
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: Using SaxParser to get an ID
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/25964911
type: Answer
answers question: http://stackoverflow.com/q/25964452
has body: In no place are you actually generating a password. You need to replace the body of generatePassword with some sort of loop that accumulates characters. Right now, all it does is allocate a new instance of Password and recurse into that instance, which does the same thing, ad infinitum until you exhaust the stack or heap.
score: 0
has comment: http://stackoverflow.com/comment/40653888
has comment: http://stackoverflow.com/comment/40688850

http://stackoverflow.com/q/25912439
upvote count: 1
has comment: http://stackoverflow.com/comment/40559847
has comment: http://stackoverflow.com/comment/40559696
type: Question
accepted answer: http://stackoverflow.com/a/25912479
has comment: http://stackoverflow.com/comment/40559765
score: -2
tagged with: java
linked to: http://stackoverflow.com/q/1732348
has title: Java regex to extract text INSIDE tags
answer count: 1
duplicate of: http://stackoverflow.com/q/1732348
has comment: http://stackoverflow.com/comment/40559752
favorite count: 0
has answer: http://stackoverflow.com/a/25912479
has comment: http://stackoverflow.com/comment/40559962
has comment: http://stackoverflow.com/comment/40559912
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40559678
has body: I'm not very good with Regex (using JAVA) and i would like some help to get texts that are inside the tags &lt;> For example, the text: Hello, my name is &lt;NAME&gt;, i'm &lt;YEAR&gt; years old, and i live in &lt;ADRESS&gt; And i need an ArrayList or array[] of Strings with: NAME, YEAR, ADRESS
downvote count: 3

http://stackoverflow.com/a/25933335
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25932971
has body: Given that you're using MySQL you could use the INSERT ... ON DUPLICATE KEY UPDATE ... statement, which functions similarly to the SQL standard MERGE statement. MYSQL doc reference here and general Wikipedia reference to SQL MERGE functionality here. The statement would look something like INSERT INTO MY_TABLE (PRIMARY_KEY_COL, COL2, COL3, COL4) VALUES (1, 2, 3, 4) ON DUPLICATE KEY UPDATE COL2 = 2, COL3 = 3, COL4 = 4 In this example I'm assuming that PRIMARY_KEY_COL is a primary or unique key on MY_TABLE. If the INSERT statement would fail due to a duplicate value on the primary or unique key then the UPDATE clause is executed. Also note (on the MySQL doc page) that there are some gotcha's associated with auto-increment columns on an InnoDB table. Share and enjoy.

http://stackoverflow.com/comment/40631471
score: 0
type: Comment
type: QuestionComment
has text: i guess i find the way its all about UA-XXXXXXXX-1 and UA-XXXXXXXX-2 thing beacuse when i switch to UA-XXXXXXXX-1 i can see real-time data after switch to UA-XXXXXXXX-2 only see screen views not real-time i guess we should add both to app_tracker.xml
comment on: http://stackoverflow.com/q/25949303

http://stackoverflow.com/comment/40558221
score: 0
type: AnswerComment
has text: Actually suggested approach is faster and easy to use !
type: Comment
comment on: http://stackoverflow.com/a/25911639

http://stackoverflow.com/comment/40554763
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25908918
has text: In the other system your web application is running or not? If its running it will appear in the jconsole along with the PID(Process Id)
type: AnswerComment

http://stackoverflow.com/a/26026017
has comment: http://stackoverflow.com/comment/40779843
has comment: http://stackoverflow.com/comment/40779205
has comment: http://stackoverflow.com/comment/40779230
has comment: http://stackoverflow.com/comment/40779465
type: Answer
has comment: http://stackoverflow.com/comment/40779530
has comment: http://stackoverflow.com/comment/40779912
answers question: http://stackoverflow.com/q/26024974
has comment: http://stackoverflow.com/comment/40779583
has body: change these lines: public MessageAdapter(Context context, List&lt;TextMessage&gt; message) super(context, R.layout.message_layout); MessageAdapter my_adapter = new MessageAdapter(this, posts); to public MessageAdapter(Context context, int resource, List&lt;TextMessage&gt; message) super(context, resource ,message); MessageAdapter my_adapter = new MessageAdapter(this, R.layout.message_layout , posts); you have not passed any objects to your adapter super constructor so when calling notifyDataSetChanged he changes nothing because he dose not have your list items to apply. after that make sure you are changing the message object that you passed to your adapter, you must change one object reference not creating another and change that. hope it helps you!
has comment: http://stackoverflow.com/comment/40780039
score: 0

http://stackoverflow.com/q/25878017
has body: I saw the following recently on this site: for (HashMap.Entry&lt;Object,Object&gt; e : new TreeMap&lt;&gt;().entrySet()) System.out.println(e); To my surprise, this compiles and runs fine. I have also tried adding entries to the map so there is actually something to downcast and fail doing so, this worked fine as well. How can a TreeMap entry be cast to HashMap.Entry? These two aren't even on the same branch of the hierarchy. Update Although this matter is resolved now, I include the following just for fascination—the following does not compile: for (TreeMap.Entry&lt;Object,Object&gt; e : new HashMap&lt;&gt;().entrySet()) System.out.println(e); It happens that TreeMap defines TreeMap.Entry, which hides Map.Entry.
favorite count: 0
has comment: http://stackoverflow.com/comment/40498109
accepted answer: http://stackoverflow.com/a/25878086
has comment: http://stackoverflow.com/comment/40498140
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40497999
has title: Confusing type relationship
possible better answer: http://stackoverflow.com/a/25878074
type: Question
has answer: http://stackoverflow.com/a/25878074
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25878086
answer count: 2
score: 5
downvote count: 0

http://stackoverflow.com/comment/40788977
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26019770
has text: If at all possible, you should try to eliminate the arduino part altogether, especially since you said you've eliminated that as the culprit. We can't run your Arduino stuff, so this is currently impossible to debug.
type: Comment

http://stackoverflow.com/q/25995129
tagged with: android
has comment: http://stackoverflow.com/comment/40710909
answer count: 0
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/40709017
has comment: http://stackoverflow.com/comment/40708638
tagged with: java
type: Question
has title: apache poi library error 2
score: 0
has body: I'm trying to include the apache poi library with Maven. All is fine except when I try to compile it I get the following error. How would I reduce the method references? I only need to read and write .xlsx files. Has anyone successfully utilised apache poi in an android app without getting this error? Cheers Error:Execution failed for task ':app:preDexDebug'. &gt; com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\tsuyoshiq\AppData\Local\Android\android-studio2\sdk\build-tools\android-4.4W\dx.bat --dex --output C:\Users\tsuyoshiq\Desktop\Prensa\app\build\intermediates\pre-dexed\debug\poi-ooxml-schemas-3.11-beta2-74bd62d2e75e960b3f516758040beb598c0c3c0a.jar C:\Users\tsuyoshiq\.gradle\caches\modules-2\files-2.1\org.apache.poi\poi-ooxml-schemas\3.11-beta2\76e88385937608ef805a040b35185220e5d95ea1\poi-ooxml-schemas-3.11-beta2.jar Error Code: 2 Output: trouble writing output: Too many method references: 73431; max is 65536. You may try using --multi-dex option. References by package: 460 com.microsoft.schemas.office.x2006.encryption 136 com.microsoft.schemas.office.x2006.encryption.impl 35 com.microsoft.schemas.office.x2006.keyEncryptor.certificate 17 com.microsoft.schemas.office.x2006.keyEncryptor.certificate.impl 71 com.microsoft.schemas.office.x2006.keyEncryptor.password 53 com.microsoft.schemas.office.x2006.keyEncryptor.password.impl 13 java.lang 1 java.lang.reflect 5 java.util 1 javax.xml.namespace 66 org.apache.xmlbeans 19 org.apache.xmlbeans.impl.values 1 org.apache.xmlbeans.impl.xb.xmlschema 2971 org.openxmlformats.schemas.drawingml.x2006.chart 1738 org.openxmlformats.schemas.drawingml.x2006.chart.impl 8827 org.openxmlformats.schemas.drawingml.x2006.main 5294 org.openxmlformats.schemas.drawingml.x2006.main.impl 86 org.openxmlformats.schemas.drawingml.x2006.picture 33 org.openxmlformats.schemas.drawingml.x2006.picture.impl 745 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing 417 org.openxmlformats.schemas.drawingml.x2…

http://stackoverflow.com/comment/40599299
type: QuestionComment
has text: Have you tried which _huge error_ occurs?
score: 2
comment on: http://stackoverflow.com/q/25934134
type: Comment

http://stackoverflow.com/q/25976391
tagged with: jaxb
has comment: http://stackoverflow.com/comment/40675101
score: 9
type: Question
has comment: http://stackoverflow.com/comment/40675270
downvote count: 0
possible better answer: http://stackoverflow.com/a/25977013
favorite count: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25990080
accepted answer: http://stackoverflow.com/a/25990080
has title: How to resolve collision in the ObjectFactory on wsdl2java?
tagged with: web-services
has answer: http://stackoverflow.com/a/25977013
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22425306
has body: I'm using CXF and wsdl2java to autogenerate webservice classes. Problem: somehow the webservice I want to connect to has duplicate names for some elements: Two declarations cause a collision in the ObjectFactory class The xsd is like: &lt;xs:schema targetNamespace="http://thenamespace"&gt; &lt;xs:complexType name="ViolatingName"&gt; ... &lt;/xs:complexType&gt; &lt;xs:element name="ViolatingName" nillable="true" type="tns:ViolatingName"/&gt; &lt;/xs:schema&gt; The xsd itself is imported inside the wsdl that is used to autogenerate the jaxb classes like this: &lt;wsdl:types&gt; &lt;xsd:schema targetNamespace="http://imports"&gt; &lt;xsd:import schemaLocation="https://path.to.xsd" namespace="http://thenamespace" /&gt; I'm trying to cover this using jaxb-bindings.xml: &lt;jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc" jaxb:version="2.1"&gt; &lt;jaxb:bindings schemalocation="https://path.to.xsd" node="//xs:schema"&gt; &lt;jaxb:bindings node=".//xs:element[@name='ViolatingName']"&gt; &lt;jaxb:property name="ViolatingNameBinding" /&gt; &lt;/jaxb:bindings&gt; &lt;/jaxb:bindings&gt; &lt;/jaxb:bindings&gt; Result: [ERROR] XPath evaluation of "//xs:schema" results in empty target node (org.apache.cxf:cxf-codegen-plugin:3.0.1:wsdl2java:generate-sources:generate-sources) Why is the node wrong here? The xsd has a xs:schema tag, so why is this failing? Interesting fact: when I use any xpath tool, download the XSD to my local machine an check the path, then //xs:schema/xs:element[@name='ViolatingName'] evaluates to the proper tag.
has answer: http://stackoverflow.com/a/25977528
upvote count: 9
tagged with: cxf
tagged with: java

http://stackoverflow.com/comment/40530242
comment on: http://stackoverflow.com/q/25895899
has text: It reads from a XML file. The XML attribute has Question marks. ???????????????? ????????????????
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40576379
score: 0
comment on: http://stackoverflow.com/q/25920991
type: QuestionComment
has text: It works, but this one, if applicable, is more readable. For example, in the main, we can say: (Class1)hm1.get("field1").field1 instead of fields[i]. The number of files and their different fields are too many and may cause mistakes.
type: Comment

http://stackoverflow.com/q/25954035
upvote count: 0
answer count: 1
tagged with: drjava
has comment: http://stackoverflow.com/comment/40633686
favorite count: 0
accepted answer: http://stackoverflow.com/a/25954048
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/40633684
has comment: http://stackoverflow.com/comment/40633690
has title: 'in' is never closed
downvote count: 1
type: AnsweredQuestion
has body: there is a error in my code it is giving me a warning Warning: Resource leak: 'in' is never closed I have never had this problem before, in fact I tried old programs that I have written and it is still giving me the same issue. How do I fix this ? import java.util.Scanner ; public class CountVowels { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter a word: "); String word = in.next(); int vowelCount = 0; for (int i = 0; i &lt; word.length(); i++) { char currentCharacter = word.charAt(i); if (currentCharacter == 'a' || currentCharacter == 'A' || currentCharacter == 'e' || currentCharacter == 'E' || currentCharacter == 'i' || currentCharacter == 'I' || currentCharacter == 'o' || currentCharacter == 'O' || currentCharacter == 'u' || currentCharacter == 'U') { vowelCount++; } } System.out.println(vowelCount + " vowel(s)."); } }
has answer: http://stackoverflow.com/a/25954048
tagged with: java
linked to: http://stackoverflow.com/q/15613626
score: -1
type: Question

http://stackoverflow.com/q/26028122
score: 1
type: Question
has comment: http://stackoverflow.com/comment/40997725
tagged with: java
has title: Roguelike game has blinking drawing
tagged with: ascii
upvote count: 1
tagged with: game-engine
answer count: 1
has comment: http://stackoverflow.com/comment/40770281
tagged with: roguelike
favorite count: 0
has comment: http://stackoverflow.com/comment/40770268
has comment: http://stackoverflow.com/comment/40770236
has answer: http://stackoverflow.com/a/26029403
accepted answer: http://stackoverflow.com/a/26029403
tagged with: drawing
type: AnsweredQuestion
has body: I'm writing the drawing system for a roguelike game based on ascii characters (graphics similar to dwarf fortress). I'm using the AsciiPanel from here. My problem is that when I draw entities on my map, they seem to blink, when they should be solid. In this gif, the r characters in the top row are the entities. This is the map's draw method that is called every frame. public void draw(final Display display) { for (int x = getViewportX(); x &lt; getViewportX() + viewportWidthInTiles; x++) { for (int y = viewportY; y &lt; viewportY + viewportHeightInTiles; y++) { final char character = background[x][y].getCharacter(); final Color foreground = background[x][y].getForeground(); final Color backgroundColor = background[x][y].getBackground(); final AsciiCharacterData data = new AsciiCharacterData( character, foreground, backgroundColor); display.setCharacterAt(x - getViewportX(), y - viewportY, background[x][y].getDrawingLayer(), data); } } display.clearLayer(DrawingLayer.PRIMARY); for (int i = 0; i &lt; entities.size(); i++) { final Entity e = entities.get(i); final char character = e.getCharacter(); final Color foreground = e.getForeground(); final Color backgroundColor = e.getBackground(); final AsciiCharacterData data = new AsciiCharacterData(character, foreground, backgroundColor); display.setCharacterAt(e.getX() - getViewportX(), e.getY() - viewportY, e.getDrawingLayer(), data); } } I think I know what causes the problem, because if I write display.clearLayer(DrawingLayer.BACKGROUND); (the layer the tiles are drawn to) before I draw the background tiles, it creates something even more ridiculous. This is the Display class, where I think I am making some mistake. public class Display { private static final char TRANSPARENT_CHARACTER = ' '; private final AsciiPanel displayPanel; private final int widthInCharacters, heightInCharacters; private final static int Z_LEVELS = DrawingLayer.values().length; private final AsciiCharacterData[][][] characterMap; public Display(f…
downvote count: 0

http://stackoverflow.com/comment/40547568
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25905604
has text: how to use [Enum] type in switch statement?.. plz tell me with example. i am fresher

http://stackoverflow.com/comment/40578260
type: QuestionComment
has text: When you add that line you create a new object which can store your new data
score: 1
comment on: http://stackoverflow.com/q/25921955
type: Comment

http://stackoverflow.com/a/25900108
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40565545
answers question: http://stackoverflow.com/q/25898995
has comment: http://stackoverflow.com/comment/40605469
has body: since it happens only under load, I bet the consumer is getting throttled. Try using jconsole to monitor the size of the queue. I'll try looking for a size limit on direct queues.

http://stackoverflow.com/comment/100507714
has text: Has to be final or *effectively* final, i.e. for the duration of computations in the current code block.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/37924394
type: Comment

http://stackoverflow.com/comment/40681091
has text: @brso05 Main purpose of SO is not to help only asker, but to help people with same problem. That is why questions needs to be valid (it needs to be clear, and contain short but full code which will let us and future reader reproduce described problem).
score: 4
comment on: http://stackoverflow.com/q/25979664
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25926781
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/10294338
has comment: http://stackoverflow.com/comment/40588714
has comment: http://stackoverflow.com/comment/40630403
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: orm
upvote count: 1
downvote count: 1
type: Question
has body: I need help with Hibernate and many-to-many relationship. Here is my sample schema on this link. It's simple enough so you can easily get the point. Concentration is on tables PERSON, ADDRESS and PERSON_ADDRESS. Java model is here on this link. My questions are: Is it totally wrong to have that class PersonAddress? If I leave it like that what are the problems I could encounter with, at some later stage of development? How can I optimize it? Git repo with my sample code is here.
tagged with: jpa
has answer: http://stackoverflow.com/a/25927686
has title: Hibernate - optimizing ManyToMany relationship
score: 0

http://stackoverflow.com/q/26018963
tagged with: tomcat
favorite count: 0
has title: deploy a war file on apache tomcat issue : no permission for reading/writing a file
has answer: http://stackoverflow.com/a/26019307
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has body: i have this problem since a while, i have a web,that can read files from many server. when it running from eclipse..all is well. the problem is that when i've published the web on apache tomcat..i cannot read the file on server(permission issue) i change the username and password for the apache to give it all privileges. i noticed that the only time i haven't access to read a file,its when the server machine has password protection sharing. i cannot turn off this password,how to solve it throw the code.
tagged with: eclipse
type: Question
tagged with: apache
answer count: 1
downvote count: 0

http://stackoverflow.com/a/60850055
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25979336
upvote count: 7
score: 7
has body: Always use waitFor(long timeout,TimeUnit unit) instead of waitFor(), so that the thread will not be blocked indefinitely.

junit
type: Tag
tags question: http://stackoverflow.com/q/25901465
tags question: http://stackoverflow.com/q/25962250
tags question: http://stackoverflow.com/q/25997438
tags question: http://stackoverflow.com/q/25888996
tags question: http://stackoverflow.com/q/25948804
tags question: http://stackoverflow.com/q/25978716
tags question: http://stackoverflow.com/q/25989575
tags question: http://stackoverflow.com/q/26011829
tags question: http://stackoverflow.com/q/25915490
tags question: http://stackoverflow.com/q/25915696
tags question: http://stackoverflow.com/q/25912503
tag name: junit
tags question: http://stackoverflow.com/q/26030426
tags question: http://stackoverflow.com/q/25874078
tags question: http://stackoverflow.com/q/25981712
tags question: http://stackoverflow.com/q/25995760
tags question: http://stackoverflow.com/q/26018045
tags question: http://stackoverflow.com/q/25887688
tags question: http://stackoverflow.com/q/25938772
tags question: http://stackoverflow.com/q/25922956
tags question: http://stackoverflow.com/q/25991191
tags question: http://stackoverflow.com/q/25978267
tags question: http://stackoverflow.com/q/25979304
tags question: http://stackoverflow.com/q/25907630
tags question: http://stackoverflow.com/q/25878127
tags question: http://stackoverflow.com/q/25901985
tags question: http://stackoverflow.com/q/25908914
tags question: http://stackoverflow.com/q/25906990
tags question: http://stackoverflow.com/q/25940720
tags question: http://stackoverflow.com/q/25959584
tags question: http://stackoverflow.com/q/25894821
tags question: http://stackoverflow.com/q/25912029
tags question: http://stackoverflow.com/q/25928253
tags question: http://stackoverflow.com/q/25929351
tags question: http://stackoverflow.com/q/25894665
tags question: http://stackoverflow.com/q/25922749
tags question: http://stackoverflow.com/q/25940571
tags question: http://stackoverflow.com/q/26015004
tags question: http://stackoverflow.com/q/25939204
tags question: http://stackoverflow.com/q/26016311
tags question: http://stackoverflow.com/q/25990147
tags question: http://stackoverflow.com/q/25988270
tags question: http://stackoverflow.com/q/25906976
tags question: http://stackoverflow.com/q/25976856
tags question: http://stackoverflow.com/q/26007772
tags question: http://stackoverflow.com/q/26001713

http://stackoverflow.com/comment/40761108
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26011305
has text: I think marking this ans as duplicate is wrong.in pointed link The marked answer is wrong there according to saddle point in matrix rule. So this guy did not deserve this. But i agree that this person clearly did not research before asking question.

http://stackoverflow.com/comment/68415743
type: Comment
type: QuestionComment
score: 0
has text: How it turned out for you? did you manage to get POS from arabic?
comment on: http://stackoverflow.com/q/25974338

http://stackoverflow.com/comment/40663413
type: QuestionComment
comment on: http://stackoverflow.com/q/25969716
has text: @JavaBeigner Am inserting username like "John" to the table signup and CustId is a primary key which is auto incremented on each update. So in where clause in readcustomer() method am trying to fetch the CustID through rs.getInt corresponding to the user name "John" but its throwing a run time exception unknown column name John.
score: 0
type: Comment

http://stackoverflow.com/comment/40693883
score: 0
type: Comment
has text: Test test = (Test) sessionFactory.getCurrentSession().createCriteria(Test.class).add(Restrictions.eq("id", id)).uniqueResult(); Test t=test.clone(); t.setName(test.getName()); t.setAge(test.getAge()); sessionFactory.getCurrentSession().save(t);
comment on: http://stackoverflow.com/a/25904965
type: AnswerComment

http://stackoverflow.com/q/25995975
score: 0
has answer: http://stackoverflow.com/a/25996187
has answer: http://stackoverflow.com/a/26009105
type: UnansweredQuestion
tagged with: interface
has body: I'm Trying to update 3 interfaces elements, but it wont, is also my implementation correct ? The elements are txtName, txtClarety, txtDesc. I don't know why... I cant understood the problem.. protected String doInBackground(String... params) { // updating UI from Background Thread Thread th = new Thread(new Runnable() { public void run() { // Check for success tag int success; try { // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("pid", pid)); // getting dream details by making HTTP request // Note that dream details url will use GET request JSONObject json = jsonParser.makeHttpRequest( url_dream_detials, "GET", params); // check your log for json response Log.d("Single Dream Details", json.toString()); // json success tag success = json.getInt(TAG_SUCCESS); if (success == 1) { // successfully received dream details JSONArray dreamObj = json.getJSONArray(TAG_DREAM); // JSON Array // get first dream object from JSON Array JSONObject dream = dreamObj.getJSONObject(0); // dream with this pid found // Edit Text txtName = (EditText) findViewById(R.id.inputEditName); txtClarety = (EditText) findViewById(R.id.inputEditClarety); txtDesc = (EditText) findViewById(R.id.inputEditDesc); // display dream data in EditText txtName.setText(dream.getString(TAG_NAME)); txtClarety.setText(dream.getString(TAG_CLARETY)); txtDesc.setText(dream.getString(TAG_DESCRIPTION)); }else{ // dream with pid not found } } catch (JSONException e) { e.printStackTrace(); } } }); return null; } I've tried with something like renaming my inputs, differents name, but nothing... The JSON execution is correct.
tagged with: android
has title: doInBackground and updating Interface
answer count: 4
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40710179
has answer: http://stackoverflow.com/a/26000725
has answer: http://stackoverflow.com/a/26009367

memory
tags question: http://stackoverflow.com/q/25875948
tag name: memory
tags question: http://stackoverflow.com/q/25899431
tags question: http://stackoverflow.com/q/25971895
type: Tag
tags question: http://stackoverflow.com/q/25963222
tags question: http://stackoverflow.com/q/25891022
tags question: http://stackoverflow.com/q/25902761

http://stackoverflow.com/comment/40572565
score: 0
type: Comment
type: QuestionComment
has text: How can you check if it returns null? Assign it to a variable, System.out.print, debugger???
comment on: http://stackoverflow.com/q/25918569

objectinputstream
tags question: http://stackoverflow.com/q/25971942
tag name: objectinputstream
tags question: http://stackoverflow.com/q/25924067
type: Tag
tags question: http://stackoverflow.com/q/26006230
tags question: http://stackoverflow.com/q/26010179

http://stackoverflow.com/a/25897936
score: 0
accepted answer of: http://stackoverflow.com/q/25897580
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25897580
type: Answer
has body: Here's your code. for (Player p : users) { System.out.println(p.getNick() + "'s turn!"); System.out.println("Your score is: " + p.getScoreTotal() + "!"); takeTurn(p); if (p.getScoreTotal() &gt;= 100) { System.out.println(p.getNick() + "wins! Congratulations"); return; } } This only goes through the users once. for goes through each user and then it's done. You need a while loop. //this is somewhat messy, but it gets the point across Player p = users.get(0); int playerIndex = users.size(); while(p.getScoreTotal() &lt; 100) { if(playerIndex == users.size()) { playerIndex = 0; } p = users.get(playerIndex); playerIndex++; System.out.println(p.getNick() + "'s turn!"); System.out.println("Your score is: " + p.getScoreTotal() + "!"); takeTurn(p); } System.out.println(p.getNick() + "wins! Congratulations"); return;
has comment: http://stackoverflow.com/comment/40535463

http://stackoverflow.com/a/25983563
has body: Solved this problem by writing to a temp file and doing a .deleteonexit on the temp file once the gzip uploading was done. Thanks for the help!
type: Answer
has comment: http://stackoverflow.com/comment/40688209
answers question: http://stackoverflow.com/q/25981428
has comment: http://stackoverflow.com/comment/40688518
score: 0

http://stackoverflow.com/a/26013473
has comment: http://stackoverflow.com/comment/40742000
has comment: http://stackoverflow.com/comment/40742220
has comment: http://stackoverflow.com/comment/40744827
has comment: http://stackoverflow.com/comment/40745947
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26013116
has body: Like this make one class package com.comment; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Documented @Target(ElementType.METHOD) @Inherited @Retention(RetentionPolicy.RUNTIME) public @interface MethodInfo{ public enum Developer { Ashish,Chetan,Jatin,Dipesh } public enum Status { Complet,Running,Pending } Developer createdBy(); Status status(); String modifyDate(); String comments(); } use like in controller @RequestMapping({ "/home" }) @MethodInfo(comments = "", createdBy = Developer.Ashish, modifyDate = "06-03-2014", status = Status.Running) public String home() { return "home"; }

http://stackoverflow.com/a/26157868
has comment: http://stackoverflow.com/comment/86317808
downvote count: 0
has comment: http://stackoverflow.com/comment/85725710
type: Answer
has body: The current answer according to AspectJ maintainer Andy Clement is that there are problems due to ECJ (Eclipse Compiler for Java) packages being included and renamed in the AspectJ compiler infrastructure. For more information there is ongoing discussion between Eric B. and A. Clement on the AspectJ users mailing list: Discussion thread Discussion thread continued Maybe we can close the issue here with this answer and report back when the problem is solved.
answers question: http://stackoverflow.com/q/25903686
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/85718579
has comment: http://stackoverflow.com/comment/85726175

http://stackoverflow.com/a/25994993
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25994842
score: 5
answers question: http://stackoverflow.com/q/25994842
type: AcceptedAnswer
upvote count: 5
has body: I would say you mean "Template method pattern" http://en.wikipedia.org/wiki/Template_method_pattern And maybe one suggestion: If every subclass has to override the method, then it should be abstract.

http://stackoverflow.com/comment/40601927
type: Comment
comment on: http://stackoverflow.com/a/25935580
has text: Thank you you absolute legend!Helper of the day!
type: AnswerComment
score: 0

http://stackoverflow.com/a/25911639
has body: Hope it helps you, instead of xml parsing use this approach which gives json data [Easy to code]:: String xml = "xml here..."; XMLSerializer xmlSerializer = new XMLSerializer(); JSON json = xmlSerializer.read( xml ); You can get json-lib -- http://json-lib.sourceforge.net/index.html
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25911585
accepted answer of: http://stackoverflow.com/q/25911585
has comment: http://stackoverflow.com/comment/40558221
type: Answer
has comment: http://stackoverflow.com/comment/40558192

http://stackoverflow.com/a/27988062
upvote count: 1
answers question: http://stackoverflow.com/q/26025405
type: Answer
has comment: http://stackoverflow.com/comment/114733828
has body: I encountered the same problem today with OrmLite 4.48 and PostgreSQL 9.1. What I ended doing is the following: // create the table if it does not exist if(!dao.isTableExists()) { // use dao.isTableExists() first, as createTableIfNotExists() fails with postgreSQL 9.1 (OrmLite 4.48) TableUtils.createTableIfNotExists(_pooledConnectionSrc, entityClass); } Obviously this code assumes that you have any interest in creating the corresponding DAO instance. I do, in my project. To create the DAO corresponding to your table, see "createDao" method from the class DaoManager. (Code tested on both PgSQL 9.1 and MySQL 5.5)
downvote count: 0
score: 1

http://stackoverflow.com/q/26025477
type: AnsweredQuestion
has title: SimpleDateFormatter not working correctly
tagged with: simpledateformat
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26025532
has body: I have the following code snippet. @Override public String toString() { try { String calString = "Sat Sep 27 00:00:00 EDT 2014"; SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss z YYYY"); System.out.println("calString " + calString); Date date = formatter.parse(calString); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); System.out.println("month " + calendar.get(Calendar.MONTH)); System.out.println("day " + calendar.get(Calendar.DAY_OF_MONTH)); DateFormat df = new SimpleDateFormat("YYYYMMdd"); System.out.println("format date" + df.format(date)); return df.format(date); } catch (ParseException ex) { return null; } } Expected output should be 20140927 but I'm getting this instead. calString Sat Sep 27 00:00:00 EDT 2014 month 0 day 3 format date 20140103 Anybody know why the day and month are off?
answer count: 3
has answer: http://stackoverflow.com/a/26025537
has answer: http://stackoverflow.com/a/26056974
favorite count: 0
accepted answer: http://stackoverflow.com/a/26025532
upvote count: 2
possible better answer: http://stackoverflow.com/a/26025537
downvote count: 1

http://stackoverflow.com/q/25975203
score: 1
tagged with: java
type: Question
answer count: 2
tagged with: docx4j
has answer: http://stackoverflow.com/a/25984021
has body: I am trying to replace a simple 'Place Holderin MS Word 2007 usingDocx4J. I created the placeholder byReference > Insert Citation > Add New Placeholder` Below is my Docx4J code import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.xml.bind.JAXBElement; import org.docx4j.openpackaging.exceptions.Docx4JException; import org.docx4j.openpackaging.packages.WordprocessingMLPackage; import org.docx4j.wml.ContentAccessor; import org.docx4j.wml.Text; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Yohan */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here new Main(); } public Main() { try { WordprocessingMLPackage template = getTemplate("C:/Users/Yohan/Desktop/Yohan.docx"); replacePlaceholder(template,"Plane","Placeholder1"); writeDocxToStream(template,"C:/Users/Yohan/Desktop/Yohan2.docx"); System.out.println("Operation Completed"); } catch(Exception e) { e.printStackTrace(); } } private WordprocessingMLPackage getTemplate(String name) throws Docx4JException, FileNotFoundException { WordprocessingMLPackage template = WordprocessingMLPackage.load(new FileInputStream(new File(name))); return template; } private static List&lt;Object&gt; getAllElementFromObject(Object obj, Class&lt;?&gt; toSearch) { List&lt;Object&gt; result = new ArrayList&lt;Object&gt;(); if (obj instanceof JAXBElement) obj = ((JAXBElement&lt;?&gt;) obj).getValue(); if (obj.getClass().equals(toSearch)) result.add(obj); else if (obj instanceof ContentAccessor) { List&lt;?&gt; children = ((ContentAccessor) obj).getContent(); for (Object child : children) { result.addAll(getAllElementFromObject(child, toSearch)); } } return result; } private void…
downvote count: 0
has title: Docx4J is not replacing placeholders
tagged with: io
has answer: http://stackoverflow.com/a/26779725
favorite count: 0
tagged with: http://stackoverflow.com/tag/docx
type: UnansweredQuestion
upvote count: 1

custom-exceptions
type: Tag
tags question: http://stackoverflow.com/q/25891317
tag name: custom-exceptions

http://stackoverflow.com/comment/40569435
score: 0
type: AnswerComment
has text: @TechieTalk : leave out the allowStatichMethodAccess from the game, it should be irrelevant (leave it to `true`). Which version of Struts are you using ? Can you post the generated HTML with the url ?
comment on: http://stackoverflow.com/a/25912460
type: Comment

http://stackoverflow.com/q/25983919
has comment: http://stackoverflow.com/comment/40714694
has comment: http://stackoverflow.com/comment/40694440
has comment: http://stackoverflow.com/comment/40688990
tagged with: android-layout
has comment: http://stackoverflow.com/comment/40753090
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40723003
has comment: http://stackoverflow.com/comment/40719204
has comment: http://stackoverflow.com/comment/40688968
has comment: http://stackoverflow.com/comment/40713044
has comment: http://stackoverflow.com/comment/40723341
type: Question
has comment: http://stackoverflow.com/comment/40692898
upvote count: 1
has comment: http://stackoverflow.com/comment/40713140
downvote count: 0
has comment: http://stackoverflow.com/comment/40689366
has comment: http://stackoverflow.com/comment/40689107
has body: Hi I'm trying to inflate a RelativeLayout inside a LinearLayout but I keep getting the OutOfMemoryError in my device. I am not quite sure if I'm supposed to inflate a view inside a loop bit I just don't know how else to achieve this. This code works just fine If I remove the loop and inflate the TextView just one time. This is the layout i'm inflating: activity_academic_status_period_layout.xml <?xml version="1.0" encoding="utf-8"?> EDIT code where I call inflatePeriodGrade() @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); instanceType = super.instance; instanceId = super.instanceId; inflater = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflatePeriodGrade(); } This is the code in my activity: public void inflatePeriodGrade() { AcademicStatusController.getInstance(this); ArrayList<PeriodInfo> periodsInfo = AcademicStatusController .getPeriodsInfo(instanceType, instanceId); Iterator<PeriodInfo> it = periodsInfo.iterator(); // Find LinearLayout where the period grade will be placed LinearLayout llDisplayData = (LinearLayout) findViewById(R.id.help_relative_layout_for_periods); while (it.hasNext()) { // Inflate the view of the period View customView = inflater.inflate( R.layout.activity_academic_status_period_layout, null); // Remove all the items in the LinearLayout llDisplayData.removeAllViews(); // Set the text to the TextView. TextView tvtxt = (TextView) customView .findViewById(R.id.academic_status_grade); tvtxt.setText(it.next().getName()); llDisplayData.addView(customView); } } Thing is I need to inflate the layout for each element in the periods ArrayList (which has max 5 elements) but it doesn't work and I'm not really sure why. Also, how can I add the TextViews one right of the other so I could have something like this: I'm just trying to inflate the layout that contains the little blue circle with the text into the RelativeLayout that contains the whole view. EDIT StackTrace usg…
has comment: http://stackoverflow.com/comment/40714171
has comment: http://stackoverflow.com/comment/40718964
tagged with: android
has comment: http://stackoverflow.com/comment/40689132
favorite count: 0
has comment: http://stackoverflow.com/comment/40727921
has title: Inflate RelativeLayout inside LinerLayout in a loop gets OutOfMemoryError
has comment: http://stackoverflow.com/comment/40753352
answer count: 0
has comment: http://stackoverflow.com/comment/40754204
has comment: http://stackoverflow.com/comment/40689189
type: UnansweredQuestion

http://stackoverflow.com/a/26263163
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26028626
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26028626
type: Answer
score: 1
upvote count: 1
has body: I found this solution, to use escapeString on maven-resources-plugin, here is the code snippet: ... org.apache.maven.plugins maven-resources-plugin 2.6 \ ... ... src/main/resources true and on log4j configuration file, need to add "\", before the property. <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/> See documentation: Escape Filtering I hope someone find it useful.

http://stackoverflow.com/a/25958191
upvote count: 3
answers question: http://stackoverflow.com/q/25958044
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25958044
type: Answer
has body: Instead of serializing multiple objects, you should serialize a List like so : FileOutputStream outputStream=new FileOutputStream(new File("Output.ser")); ObjectOutputStream objectOutputStream=new ObjectOutputStream(outputStream); ArrayList&lt;Employee&gt; employees = new ArrayList&lt;Employee&gt;(); employees.add(employee); employees.add(employee2); employees.add(employee3); employees.add(employee4); objectOutputStream.writeObject(employees); objectOutputStream.close(); You can deserialize it like so : FileInputStream fileInputStream=new FileInputStream(new File(fileName)); ObjectInputStream stream=new ObjectInputStream(fileInputStream); for(Employee emp : (ArrayList)stream.readObject()) { String uName = emp.getUserId(); String uPass = emp.getPassword(); map.put(uName, uPass); }

http://stackoverflow.com/q/25935889
tagged with: entitymanager
has comment: http://stackoverflow.com/comment/40604063
favorite count: 0
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/40609877
downvote count: 0
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40609708
has title: Multiple EntityManagers managed by the container (CMT)
tagged with: ejb
has comment: http://stackoverflow.com/comment/40603838
tagged with: glassfish
upvote count: 2
has body: I have the following situation: My applications needs to dynamically connect to multiple databases, so after a lot of search I think the best option is to do create multiple EntityManagers and decide at runtime which one to use. Here is the code: public class GenericDao { @PersistenceContext(unitName = "db1") protected EntityManager em1; @PersistenceContext(unitName = "db2") protected EntityManager em2; @PersistenceContext(unitName = "db3") protected EntityManager em3; } This way I can connect to all databases, and still have my transactions managed by the container. The problem is when one of the connections fails, my application don't even deploy in this case, and a get the following exception: [#|2014-09-19T10:04:41.006-0300|SEVERE|glassfish3.1.2|org.eclipse.persistence.session.file:/usr/local/glassfish-3.1.2.2/glassfish/domains/domain2/applications/teste/WEB-INF/classes/_db1.ejb|_ThreadID=104;_ThreadName=Thread-2;|Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: The connection attempt failed. Error Code: 0 at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:309) at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:135) at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:685) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:215) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:542) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.ja…
tagged with: jpa

http://stackoverflow.com/q/25964435
has body: I have implemented a routine where when a user submits a form an email is sent to the administrator. For this I have used Java Mail API. And I setup a dummy account on Microsoft Outlook for sending out the emails. In the code I have hard-coded the password. I am concerned this will be a security issue when I host the webpage. Here is my code. I have written a private function: private void getSession(){ this.session = Session.getDefaultInstance(properties, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("xxxxxxxxx@outlook.com", "xxxxx_password_xxx"); } }); } In my public execute() method I call the getSession() method and generate the message. public String execute() throws Exception { getSession(); Message message = new MimeMessage(this.session); message.setFrom(new InternetAddress("xxxxxxxxxxxxx@outlook.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("admins.email@xxxxx.com")); message.setSubject("Form submit notification"); //... } Is it secure to hard code the password in the session method when I host the web page? And if not, then some pointers to implement the alternatives. Thanks!
has comment: http://stackoverflow.com/comment/40653035
type: Question
tagged with: passwords
tagged with: java
linked to: http://stackoverflow.com/q/8195099
upvote count: 2
tagged with: jakarta-mail
answer count: 2
favorite count: 0
tagged with: security
has comment: http://stackoverflow.com/comment/40653236
possible better answer: http://stackoverflow.com/a/25964758
has answer: http://stackoverflow.com/a/25969056
has answer: http://stackoverflow.com/a/25964758
accepted answer: http://stackoverflow.com/a/25969056
score: 2
has title: Different ways to store a password variable in a Java web application?
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/26031391
answer count: 2
tagged with: printing
has answer: http://stackoverflow.com/a/26031685
score: 0
accepted answer: http://stackoverflow.com/a/26031457
has comment: http://stackoverflow.com/comment/40774956
has answer: http://stackoverflow.com/a/26031457
has body: Trying to see what is wrong with my program. I don't know why the output is not printing all the way, since every method is the same, just with different names. It stops after a certain point near the end, but the code has more to it. public static void main(String[] args) { //x^3 + x^2 + 1 //2x^3 - 2x^2 - 2 //3x^3 + 3x^2 + 3 newrap1(); newrap2(); newrap3(); } public static double func1(double x) { double f1; f1 = Math.pow(x, 3) + Math.pow(x, 2) + 1; return f1; } public static double func2(double x) { double f2; f2 = 2*Math.pow(x, 3) - 2*Math.pow(x, 2) - 2; return f2; } public static double func3(double x) { double f3; f3 = 3*Math.pow(x, 3) + 3*Math.pow(x, 2) + 3; return f3; } public static double der1(double x) { double d1; d1 = 3*Math.pow(x, 2) + 2*x; return d1; } public static double der2(double x) { double d2; d2 = 6*Math.pow(x, 2) - 4*x; return d2; } public static double der3(double x) { double d3; d3 = 9*Math.pow(x, 2) + 6*x; return d3; } public static void newrap1() { double x = 100; for (int i = 0; i &lt; 30; i++) { double diff; diff = func1(x)/der1(x); if (diff == 0) return; x -= diff; System.out.println(Math.floor(x * 1e6) / 1e6); } System.out.println("The root is -1.465572 after 20 iterations."); System.out.println(); } public static void newrap2() { double x = 100; for (int i = 0; i &lt; 30; i++) { double diff; diff = func2(x)/der2(x); if (diff == 0) return; x -= diff; System.out.println(Math.floor(x * 1e6) / 1e6); } System.out.println("The root is 1.465571 after 15 iterations."); System.out.println(); } public static void newrap3() { double x = 100; for (int i = 0; i &lt; 30; i++) { double diff; diff = func3(x)/der3(x); if (diff == 0) return; x -= diff; System.out.println(Math.floor(x * 1e6) / 1e6); } System.out.println("The root is -1.465572 after 20 iterations."); System.out.println(); }
possible better answer: http://stackoverflow.com/a/26031685
has title: Output Not Printing Everything?
tagged with: output
tagged with: methods
has comment: http://stackoverflow.com/comment/40775191
type: Question
type: AnsweredQuestion
tagged with: call
has comment: http://stackoverflow.com/comment/40774986
has comment: http://stackoverflow.com/comment/40774992
tagged with: java
has comment: http://stackoverflow.com/comment/40774918
has comment: http://stackoverflow.com/comment/40774976

http://stackoverflow.com/q/25979884
answer count: 4
type: AnsweredQuestion
score: 2
tagged with: oop
accepted answer: http://stackoverflow.com/a/25979983
upvote count: 3
tagged with: java
has title: What is the best way to extend the functionality of a class?
has body: Suppose I have a class called Task. I want to add some additional functionality to it, so I extend it. I do this by creating a class which extends Task. public class TaskHelper extends Task { public void getName() { .... } // more additional functionality } So, I start using this, and when I have a task object, and downcast to TaskHelper, I get a ClassCastException. So I understand that I can't downcast, and I try to create a copy constructo something like public class TaskHelper extends Task { TaskHelper(Task t) { Task(t); } } However, there is no copy constructor for Task, and I can't modify Task because it's a third-party class. What can I do?
has comment: http://stackoverflow.com/comment/40681354
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25980864
has comment: http://stackoverflow.com/comment/40682602
possible better answer: http://stackoverflow.com/a/25980266
has answer: http://stackoverflow.com/a/25980266
favorite count: 0
has answer: http://stackoverflow.com/a/25979985
has comment: http://stackoverflow.com/comment/40681245
has comment: http://stackoverflow.com/comment/40681291
tagged with: classcastexception
has answer: http://stackoverflow.com/a/25979983

http://stackoverflow.com/q/25876966
upvote count: 1
tagged with: fatal-error
has comment: http://stackoverflow.com/comment/40495812
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25877010
tagged with: java
type: Question
answer count: 1
downvote count: 0
score: 1
has body: I am new to android developement, while trying to create an editable TextView I ran into the following exception. Here is the full stack trace of the exception 09-17 01:25:14.749: E/AndroidRuntime(8436): FATAL EXCEPTION: main 09-17 01:25:14.749: E/AndroidRuntime(8436): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.timer/com.example.timer.TimerHomeActivity}: java.lang.ClassCastException: android.widget.TextView 09-17 01:25:14.749: E/AndroidRuntime(8436): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) 09-17 01:25:14.749: E/AndroidRuntime(8436): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 09-17 01:25:14.749: E/AndroidRuntime(8436): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 09-17 01:25:14.749: E/AndroidRuntime(8436): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935) 09-17 01:25:14.749: E/AndroidRuntime(8436): at android.os.Handler.dispatchMessage(Handler.java:99) 09-17 01:25:14.749: E/AndroidRuntime(8436): at android.os.Looper.loop(Looper.java:130) 09-17 01:25:14.749: E/AndroidRuntime(8436): at android.app.ActivityThread.main(ActivityThread.java:3687) 09-17 01:25:14.749: E/AndroidRuntime(8436): at java.lang.reflect.Method.invokeNative(Native Method) 09-17 01:25:14.749: E/AndroidRuntime(8436): at java.lang.reflect.Method.invoke(Method.java:507) 09-17 01:25:14.749: E/AndroidRuntime(8436): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 09-17 01:25:14.749: E/AndroidRuntime(8436): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 09-17 01:25:14.749: E/AndroidRuntime(8436): at dalvik.system.NativeStart.main(Native Method) 09-17 01:25:14.749: E/AndroidRuntime(8436): Caused by: java.lang.ClassCastException: android.widget.TextView 09-17 01:25:14.749: E/AndroidRuntime(8436): at com.example.timer.TimerHomeActivity.onCreate(TimerHomeActivity.java:23) 09-17 01:25:14.749: E/AndroidRuntime(8436…
has title: cast exception android.widget.TextView
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/25877010
tagged with: classcastexception

http://stackoverflow.com/comment/40524455
comment on: http://stackoverflow.com/a/25892652
score: 0
type: AnswerComment
has text: Sorry, this didn't work. And also, since I'm pretty sure having two classes doesn't count as having two different threads, I don't think synchronizing is the issue. But thanks anyway!
type: Comment

http://stackoverflow.com/q/25956767
has answer: http://stackoverflow.com/a/25958122
tagged with: file-upload
has comment: http://stackoverflow.com/comment/40651048
type: UnansweredQuestion
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/32970215
score: 0
tagged with: java
tagged with: selenium
type: Question
has body: I am new to Selenium Webdriver, i want to open the file upload window after clicking on Browse button but i am not able to open it using webdriver. Here is my code : import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class Login_Page { static WebDriver driver; public static void main(String args[]) { driver = new FirefoxDriver(); driver.manage().window().maximize(); WebDriverWait wait = new WebDriverWait(driver, 40); WebDriverWait wait = new WebDriverWait(driver, 40); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.get("http://www.toolsqa.com/automation-practice-form"); driver.findElement(By.id("photo")).click(); } } I am not able to see any file upload window. I am using Firefox 14.0.1 and selenium-server-standalone-2.24.1.jar Please let me know how can i do it? Thanks
has title: Unable to open File Upload window using Selenium Webdriver
has answer: http://stackoverflow.com/a/25956853
answer count: 3

http://stackoverflow.com/a/26019260
type: Answer
answers question: http://stackoverflow.com/q/26019123
upvote count: 1
score: 1
downvote count: 0
has body: What is meant by "consistent with equals" just means that for two objects that equal each other, the comparator should return 0, or: obj1.equals(obj2) should be the same boolean value as comparator.compare(obj1, obj2) == 0; But you're free to just use your own comparator which puts low costs ahead of high costs, as long as the comparator returns 0 for equal states.

http://stackoverflow.com/comment/40578784
comment on: http://stackoverflow.com/q/25922201
score: 0
type: QuestionComment
type: Comment
has text: That's kind of like saying why do we need ArrayList if we can do it with Arrays.

http://stackoverflow.com/a/25951544
has comment: http://stackoverflow.com/comment/40629828
has comment: http://stackoverflow.com/comment/40629067
has comment: http://stackoverflow.com/comment/40631730
score: 0
has body: Try this: Button createDateButton = (Button) rootView.findViewById(R.id.create_date_button); This should be working.
has comment: http://stackoverflow.com/comment/40628909
has comment: http://stackoverflow.com/comment/40643297
answers question: http://stackoverflow.com/q/25951523
type: Answer
has comment: http://stackoverflow.com/comment/40628946
has comment: http://stackoverflow.com/comment/40631620

http://stackoverflow.com/comment/58752098
score: 0
comment on: http://stackoverflow.com/a/26021695
type: Comment
has text: @David: i think what Martin is saying is that sometimes encapsulation is helpful and sometimes it isn't, and when it isn't helpful then he tries not to call it an object. At the time Martin wrote that book he was dipping his toes in the FP paradigm and he seemed to be getting more of an appreciation for OOP being relevant more in some places than in others, which I didn't notice so much in earlier writing.
type: AnswerComment

http://stackoverflow.com/a/25917862
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25916099
has comment: http://stackoverflow.com/comment/40570458
answers question: http://stackoverflow.com/q/25916099
type: Answer
has body: As mentioned in comments, you want to restrict your query to the Inbox, and you shouldn't be using constants for the Cursor indices. Also, we can eliminate the looping altogether if we query on the number. public String getSmsContent(String number, Context context) { String smsContent = "No entry for " + number; Cursor cursor = context.getContentResolver() .query(Uri.parse("content://sms/inbox"), new String[]{"body"}, "address=?", new String[]{number}, null); if(cursor != null &amp;&amp; cursor.moveToFirst()) { smsContent = cursor.getString(cursor.getColumnIndex("body")); } return smsContent; } After further testing, it appears that the number stored in the SMS Provider might not exactly match that received from the incoming call. In this case, I believe we will have to resort to looping in order to check possible matches. Here we use the PhoneNumberUtils.compare() method, which will return true if the numbers are "identical enough for caller ID purposes." public String getSmsContent(String number, Context context) { Cursor cursor = context.getContentResolver() .query(Uri.parse("content://sms/inbox"), new String[]{"address", "body"}, null, null, null); if (cursor != null &amp;&amp; cursor.moveToFirst()) { do { if(PhoneNumberUtils.compare(number, cursor.getString(cursor.getColumnIndex("address")))) { return cursor.getString(cursor.getColumnIndex("body")); } } while(cursor.moveToNext()); } return "No entry for " + number; }
upvote count: 1
has comment: http://stackoverflow.com/comment/40570586

http://stackoverflow.com/comment/40583092
comment on: http://stackoverflow.com/q/25924868
type: QuestionComment
type: Comment
score: 0
has text: Create a new `Writer` which uses the new `File`...

http://stackoverflow.com/a/25933760
has comment: http://stackoverflow.com/comment/40598501
accepted answer of: http://stackoverflow.com/q/25933697
type: Answer
answers question: http://stackoverflow.com/q/25933697
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40598589
has body: You need to call adapter.notifyDatasetChanged(). This will update your list view when new data has arrived. What I grasp from your question is that when the button is clicked, you want your list to be updated based on some criteria, right?
has comment: http://stackoverflow.com/comment/40598607
type: AcceptedAnswer
downvote count: 0

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/25984275
tag name: ksoap2

http://stackoverflow.com/q/25885260
tagged with: java
has comment: http://stackoverflow.com/comment/40510801
type: Question
tagged with: image
tagged with: boolean
score: 0
has comment: http://stackoverflow.com/comment/40510713
answer count: 1
type: UnansweredQuestion
has body: I am making a game where my character walks over images of coins. What I want to happen is that when he passes over the coins they disappear. I have researched and understand that it is possible to do this with boolean expressions but I am not sure on how to construct the statements. I would appreciate an explanation on how i would go about doing this and perhaps an example. Thank you This is how i have displayed the coins and the character "Hood": g.drawImage(coin1, cx1, cy1, this); int heightd = coin1.getHeight(this); int widthd = coin1.getWidth(this); g.drawImage(coin2, cx2, cy2, this); int heighte = coin1.getHeight(this); int widthe = coin1.getWidth(this); g.drawImage(coin3, cx3, cy3, this); int heightf = coin1.getHeight(this); int widthf = coin1.getWidth(this); g.drawImage(coin4, cx4, cy4, this); int heightg = coin1.getHeight(this); int widthg = coin1.getWidth(this); g.drawImage(Hood,hx , hy,this); int width = Hood.getWidth(this); int height = Hood.getHeight(this);
has title: Making a image disappear on collision
has answer: http://stackoverflow.com/a/25885402
has comment: http://stackoverflow.com/comment/40510689

http://stackoverflow.com/q/25944695
tagged with: java
has title: How should I maintain a cache of values read from a file?
type: Question
has comment: http://stackoverflow.com/comment/40618728
has comment: http://stackoverflow.com/comment/40618856
tagged with: caching
score: 0
answer count: 1
tagged with: scala
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/25945076
has body: Setup There is a program running that is performing arbitrary computations and writing a status (an integer value, representing progress) to a file. The integer values can only be incremented. Now I am developing an other application that can (among other things) perform arithmetic operations, e.g., comparisons, on those integer values. The files are permanently deleted and written by a different program. As such, there is no guarantee that a file exists at any time. Basically, the application needs to execute something arbitrary, but has a constraint on the other program's progress, i.e., it may only execute something if the other program has done enough work. Problem When performing the arithmetic operations, the application should not care about where the integer values come from. Especially, accessing those integer values must not throw an exception. How should I separate all the bad things that can happen when performing io access? Note that I do not want the execution thread to block until a value can be read from the file. E.g., say the file system dies somehow, then the integer values will not be updated, but the main thread should still continue to work. This desire is driven by the definition of the arithmetic comparison as a predicate, which has exactly two outcomes, true and false, but no third "error"-outcome. That's why I think that the values that are read from the file would need to be cached somehow. Limitation Java 1.7, Scala 2.11 Current Approach I have a solution that looks as if it would work, but I am not sure if there could something go wrong. The solution is to maintain a cache of those integer values for each file. The core functionality is provided the getters of the cache, while there is a separate "updater"-thread that constantly reads the files and updates the chaches. If an error occurs the producer should take notice (i.e., log the error), but continue to run, because an incomplete computation should not affect subsequent computations.…

http://stackoverflow.com/q/25880952
answer count: 1
tagged with: tomcat
has title: Tomcat / JBoss post deployment script
has comment: http://stackoverflow.com/comment/40504218
has answer: http://stackoverflow.com/a/25882468
type: AnsweredQuestion
has body: Is there a way to execute a post deployment script in Tomcat / JBoss? I want this script to execute when ever a new WAR file is deployed. Also the war files will not know anything about the script, so I can not use Startup Servlets.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40504950
has comment: http://stackoverflow.com/comment/40503672
accepted answer: http://stackoverflow.com/a/25882468
tagged with: jboss
score: 0
has comment: http://stackoverflow.com/comment/40532647

http://stackoverflow.com/comment/40719910
has text: @MarsAtomic I've just followed the instructions in the Readme.txt in jayu_0.4.zip. I've tried putting the Stream1.java as the first arg as well. Didn't work either :).
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26001077
type: QuestionComment

http://stackoverflow.com/q/25988030
tagged with: java
type: Question
tagged with: mongodb
score: 0
has body: I have a web application where I have to use multiple dbs (static set of dbs) in mongodb. For a given request, the db depends on few parameters passed as part of request. I use spring framework's mongoTemplate for interacting with the DB. There are 2 ways in which I can get MongoTemplate instance for a particular DB. By using just Mongo instance which will be initialized as part of web application context. Using this, I can get MongoTemplate for a given DB. Using a MongoDBFactory In the first method, @Autowired private Mongo mongo; MongoTemplate getMongoTemplate(String dbName) { return new MongoTemplate(mongo, dbName); } Second method, @Autowired private MongoDbFactory factory; MongoTemplate getMongoTemplate(String dbName) { DB db = factory.getDb(dbName); Mongo mongo = db.getMongo(); return new MongoTemplate(mongo); } Which of these 2 is ideal?
answer count: 1
tagged with: mongotemplate
type: UnansweredQuestion
tagged with: spring-data-mongodb
tagged with: spring
has answer: http://stackoverflow.com/a/25988509
has title: Connecting to multiple databases in mongodb

maven-3
tags question: http://stackoverflow.com/q/25915793
tags question: http://stackoverflow.com/q/26033823
type: Tag
tag name: maven-3
tags question: http://stackoverflow.com/q/25898900
tags question: http://stackoverflow.com/q/26012661

http://stackoverflow.com/comment/40832924
has text: + 1 for mentioning Bayesian. FYI: ASM and AAM are processing intensive! As far as I know, there isn't a great haar classifier for smiles. This is a more difficult problem than it seems.
comment on: http://stackoverflow.com/a/26020969
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25940042
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40610414
has body: Your example is so simple that it's hard to avoid code duplication whilst being less verbose, but presumably you have more complicated situations in mind. You could do it like this: public class Example { public void f() { (new F()).execute(); } public void g() { (new G()).execute(); } public void h() { (new H()).execute(); } public void i() { (new I()).execute(); } private class F extends AbstractX { @Override public void executeFunction() { AnotherExample.funct1(); } } private class G extends AbstractX { @Override public void executeFunction() { AnotherExample.funct2(); } } private class H extends AbstractX { @Override public void executeFunction() { AnotherExample.funct3(); } } private class I extends AbstractX { @Override public void executeFunction() { AnotherExample.funct4(); } } private abstract class AbstractX { public void execute() { System.out.println("Start"); OtherExample.start(); executeFunction(); OtherExample.end(); System.out.println("End"); } public abstract void executeFunction(); } }
answers question: http://stackoverflow.com/q/25939699
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/25984930
type: UnansweredQuestion
has body: The variable netPay on System.out.println("\t Regular Pay for 40.0 hour(s): $" + netPay); keep saying that it was not initialized. The only time it works is when I take of the if-else statements. public static void main(String [] args){ int employeeNumber; double hourlySalary, weeklyTime, netPay, overTime, overTimehours; Scanner keyboard= new Scanner(System.in); System.out.println("Welcome to \"TEMPLE HUMAN RESOURCES\""); System.out.println(); System.out.print("\t Enter Employee Number: "); employeeNumber=keyboard.nextInt(); System.out.print("\t Enter Hourly Salary: "); hourlySalary=keyboard.nextDouble(); System.out.print("\t Enter Weekly Time: "); weeklyTime=keyboard.nextDouble(); System.out.println(); overTimehours=weeklyTime-40; overTime=(1.5*10)*hourlySalary; if (weeklyTime&gt;40) { netPay=(weeklyTime*hourlySalary)+(overTime*overTimehours); }else if (weeklyTime==40){ netPay=40*hourlySalary; }else { overTimehours=0; overTime=0; } System.out.println("\t Employee #: " + employeeNumber); System.out.println("\t Hourly Salary: $" + hourlySalary); System.out.println("\t Weekly Time: " + weeklyTime + " hour(s)"); System.out.println("\t Regular Pay for 40.0 hour(s): $" + netPay); System.out.println("\t Overtime Pay for " +overTimehours+ " hour(s): $" + overTime); System.out.println("\t Net Pay: $" + (overTime+ netPay)); System.out.println(); System.out.println("Thank you for using \"Temple Human Resources\""); }
has title: The variable netPay keeps saying that it was not initialized
has answer: http://stackoverflow.com/a/25985040
upvote count: 0
has answer: http://stackoverflow.com/a/25986432
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40690943
has comment: http://stackoverflow.com/comment/40690777
score: -1
has comment: http://stackoverflow.com/comment/40690792
has answer: http://stackoverflow.com/a/25984949
tagged with: revenue
answer count: 3
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40690813
has comment: http://stackoverflow.com/comment/40690803

http://stackoverflow.com/a/43377237
type: Answer
score: 0
has body: Here's my solution in JavaScript, it swaps values between a row and a column starting from the top-right edge, going inwards until the bottom-leftmost pair is swapped. function rotateMatrix(arr) { var n = arr.length - 1; for (var i = 0; i &lt; n; i++) { for (var j = 0; j &lt; n - i; j++) { var temp = arr[i][j]; arr[i][j] = arr[n - j][n - i]; // top row arr[n - j][n - i] = temp; // right column } } return arr; }
answers question: http://stackoverflow.com/q/25882480

http://stackoverflow.com/comment/40525615
score: 0
type: Comment
type: QuestionComment
has text: yup.. however, i tried a few times and i'm not sure what's the problem, it just couldnt configured well..
comment on: http://stackoverflow.com/q/25887792

http://stackoverflow.com/a/25993437
downvote count: 0
type: Answer
score: 2
has body: You can consider looking at https://jersey.java.net/ As a web container you can use anything like Tomcat. I have used Google App Engine in the past.
answers question: http://stackoverflow.com/q/25993256
upvote count: 2

http://stackoverflow.com/q/26002636
has body: I am using jaxb to autogenerate classes for unmarshalling xml content into a java application. I notice that the resulting classes have a lot of redundancy. In particular, the model into which they will ultimately be transferred uses inheritance to avoid the redundancy. I am tempted to re-write all the generated classes so that they also use inheritance. Is there a reason not to do this? For example: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "A", propOrder = {"p1","p2","p3"}) Class A { @XmlElement(required = true) property p1; @XmlElement(required = true) property p2; @XmlElement(required = true) property p3; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "B", propOrder = {"p1","p2","p4"}) class B { @XmlElement(required = true) property p1; @XmlElement(required = true) property p2; @XmlElement(required = true) property p4; } would become: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Root", propOrder = {"p1","p2"}) @XmlSeeAlso({A.class, B.class}) Class Root { @XmlElement(required = true) property p1; @XmlElement(required = true) property p2; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "A", propOrder = {"p3"}) Class A extends Root{ @XmlElement(required = true) property p3; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "B", propOrder = {"p4"}) Class B extends Root{ @XmlElement(required = true) property p4; } If I make this kind of transformation, will the @Xml... annotations stop working? Will jaxb still be able to unmarshal correctly? If I do not simplify the code as shown above, I think the alternative is to build another set of middle classes to translate the unmarshalled data into my app's model. Anyone care to comment or improve?
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26003407
tagged with: jaxb
upvote count: 1
type: Question
has title: inheritence in jaxb-generated classes
accepted answer: http://stackoverflow.com/a/26003407
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26016910
score: 1
upvote count: 1
has body: The format you're looking for is this: SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd hh:mm:ss z yyyy"); You can check all the valid formats here http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
answers question: http://stackoverflow.com/q/26016728
type: Answer
downvote count: 0

http://stackoverflow.com/q/25917641
possible better answer: http://stackoverflow.com/a/79131881
tagged with: calendar
has body: I have the following test that from my understanding should pass. Is there something I'm missing or is this a bug in Calendar? Calendar inputC = new GregorianCalendar(TimeZone.getTimeZone("UTC"), Locale.US); // Sunday inputC.set(2014, Calendar.JUNE, 22, 0, 0, 0); inputC.set(Calendar.MILLISECOND, 0); // START code impl // Given a date returns back the date with it's day being first day of week and resets time. Calendar dc = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.US); dc.set(inputC.get(Calendar.YEAR), inputC.get(Calendar.MONTH), inputC.get(Calendar.DAY_OF_MONTH), 0, 0 , 0); dc.set(Calendar.MILLISECOND, 0); // dc.getTimeInMillis(); // dc.set(Calendar.WEEK_OF_YEAR, inputC.get(Calendar.WEEK_OF_YEAR)); dc.set(Calendar.DAY_OF_WEEK, dc.getFirstDayOfWeek()); Date output = dc.getTime(); // END code impl Calendar expectedSundayC = new GregorianCalendar(TimeZone.getTimeZone("UTC"), Locale.US); expectedSundayC.set(2014, Calendar.JUNE, 22, 0, 0, 0); expectedSundayC.set(Calendar.MILLISECOND, 0); assertEquals(output, expectedSundayC.getTime()); Output:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2014-06-15T00:00:00Z Expected: 2014-06-22T00:00:00Z The above test fails unless I uncomment either one of the 2 following lines: // dc.getTimeInMillis(); // dc.set(Calendar.WEEK_OF_YEAR, inputC.get(Calendar.WEEK_OF_YEAR)); Why is that dc.getTimeInMillis() affects the output? Uncommenting line 2 above seems redundant because I already set year,month,day,hour,minute,seconds, milliseconds fields which should be enough data for complete datetime.
type: Question
type: AnsweredQuestion
has title: java calendar returns wrong week
has answer: http://stackoverflow.com/a/25918745
has comment: http://stackoverflow.com/comment/40570055
score: 12
has comment: http://stackoverflow.com/comment/40569959
accepted answer: http://stackoverflow.com/a/25918745
answer count: 2
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/40570300
favorite count: 0
has answer: http://stackoverflow.com/a/79131881
has comment: http://stackoverflow.com/comment/40570183
has comment: http://stackoverflow.com/comment/40570421
tagged with: java

java-memory-model
tags question: http://stackoverflow.com/q/25952056
tags question: http://stackoverflow.com/q/25972394
type: Tag
tag name: java-memory-model

http://stackoverflow.com/q/26017767
tagged with: java
has title: get same session object in jsp and Servlet Filter?
tagged with: servlets
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/40749953
tagged with: jsp
score: 0
has answer: http://stackoverflow.com/a/26018285
type: UnansweredQuestion
has body: I am setting an attribute to the session object in jsp page as shown below: String remoteAddr = request.getRemoteAddr(); session.setAttribute("remoteAddr",remoteAddr); Then, I am trying to retrieve that session attribute in the servlet filter: public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) request; String remoteIP = httpServletRequest.getSession(false).getAttribute("remoteAddr"); } But I am getting a null value for the session object here. What is the correct way to get same session object here?
tagged with: jakarta-ee

http://stackoverflow.com/a/26013085
answers question: http://stackoverflow.com/q/26012942
score: 0
type: Answer
has body: You can try in this way public static void main(String a[]) { int[] arr = {1,2,2,3,4,5,5}; for (int i = 0; i &lt; arr.length; i++) { boolean isDistinct = false; for (int j = 0; j &lt; arr.length; j++) { if (arr[i] == arr[j] &amp;&amp; i!=j) { isDistinct = true; break; } } if (!isDistinct) { System.out.print(arr[i] + " "); } } } Out put: 1 3 4

http://stackoverflow.com/comment/40604664
comment on: http://stackoverflow.com/q/25936349
type: Comment
type: QuestionComment
score: 1
has text: Maybe [this](https://gist.github.com/joshdholtz/4522551) will be helpful.

http://stackoverflow.com/comment/40633161
score: 0
type: Comment
type: AnswerComment
has text: Sorry, but cant conclude anything from UserFunctions code, Log the result of `jsonParser.getJSONFromUrl(loginURL, params);` see if its null. If not go into the `getJSONFromUrl` and see what response you are getting from server.
comment on: http://stackoverflow.com/a/25952821

http://stackoverflow.com/comment/40744336
type: QuestionComment
comment on: http://stackoverflow.com/q/26013921
has text: Miche is correct, although the use of 'new' can be hidden.. either within another objects constructor, or the short hand array syntax
score: 0
type: Comment

http://stackoverflow.com/comment/40575086
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25920330
has text: http://stackoverflow.com/questions/10623913/can-i-override-a-private-method-in-java
score: 0

http://stackoverflow.com/comment/40604023
type: Comment
has text: My application is web application based on Spring MVC
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25935140

http://stackoverflow.com/a/25880004
has body: Until the delay in responding to a button click reaches about 1/10th of a second, humans perceive it as instantaneous, so optimizing reflection out of a button click response doesn't matter. You should not worry about this kind of issue so that optimization effort can focus on the code where there is a measurable performance problem.
answers question: http://stackoverflow.com/q/25878531
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/25953533
answer count: 2
downvote count: 0
tagged with: string
favorite count: 0
has title: How do I reference a string in another class?
tagged with: jframe
has answer: http://stackoverflow.com/a/25953598
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25953587
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25953587
has body: I am making a login applet to install on my wireless hardrive and am currently building the frameworks for it, (Every time I try to declare the Strings as anything BUT final it shows an error saying only final permitted) I am trying to use the String user and the String pass in if statements which are found in my Skeleton class: package open; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; public class Skeleton extends JFrame implements ActionListener{ private static final long serialVersionUID = 1248L; public static void addComponentsToPane(Container pane, Container container) { //Adding in text fields for login JButton b1 = new JButton("Login"); final JTextField field2 = new JTextField(2); final JTextField field = new JTextField(1); //Creating Box Layout - Subject to change GroupLayout layout = new GroupLayout(pane); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); //Setting alignments b1.setAlignmentX(Component.CENTER_ALIGNMENT); field.setAlignmentY(BOTTOM_ALIGNMENT); field2.setAlignmentY(BOTTOM_ALIGNMENT); b1.setAlignmentY(CENTER_ALIGNMENT); //Dimensions for User field.setMaximumSize(new Dimension(235, 20)); field.setMinimumSize(new Dimension(235, 20)); //Dimensions for Password field2.setMaximumSize(new Dimension(235, 20)); field2.setMinimumSize(new Dimension(235, 20)); //Dimensions for Button b1.setMaximumSize(new Dimension(100, 40)); b1.setMinimumSize(new Dimension(100, 40)); //Adding space between components container.add(Box.createRigidArea(new Dimension(275,20))); container.add(field); container.add(Box.createRigidArea(new Dimension(275,10))); container.add(field2); container.add(Box.createRigidArea(new Dimension(275,12))); container.add(b1); //Listen to the login button b1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { St…
upvote count: 1
tagged with: swing
tagged with: import
type: Question
accepted answer: http://stackoverflow.com/a/25953598

http://stackoverflow.com/comment/40604715
type: Comment
type: QuestionComment
has text: I still don't understand how XML and an `HashMap` are in any way related. XML = complex structural data; `HashMap` = key -> value mapping. Please rephrase your question explaining clearly and concisely what you actually want to do.
score: 0
comment on: http://stackoverflow.com/q/25936568

http://stackoverflow.com/comment/40768196
score: 0
type: AnswerComment
type: Comment
has text: Hello Bryan, thanks for the answer. Excuse my poor english. If I create the database using code like "String host = "jdbc: derby: // localhost: 1527 / EmployeesCreateTrue; create = true"" the database is created, I can check this on the Windows directory of my Derby databases, but the database created is not listed on NetBeans - Services - JB, so I can't use NetBeans to create the schema and tables and populate data. That's my problem at this moment.
comment on: http://stackoverflow.com/a/26018405

http://stackoverflow.com/comment/40618364
comment on: http://stackoverflow.com/q/25944370
type: Comment
type: QuestionComment
has text: What the JVM really does is allocate a single very large block of memory, and then it makes new objects in that one single block (which are almost certainly smaller than the very large block). But the JVM never allocates one object "inside" another as immibis said. At most you have a reference to an object inside another object, not the object itself.
score: 1

http://stackoverflow.com/comment/40599621
comment on: http://stackoverflow.com/q/25933432
score: 0
has text: sry, no time at the moment. here's a tutorial which might help you out: http://www.javacodegeeks.com/2014/09/angularjs-tutorial-getting-started-with-angularjs.html
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26021056
downvote count: 0
possible better answer: http://stackoverflow.com/a/26021241
tagged with: awt
favorite count: 0
has answer: http://stackoverflow.com/a/26021241
type: Question
has answer: http://stackoverflow.com/a/26021107
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/40756038
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/40756413
has body: I am a newbie in java. I am working on a code. It is a swing piece for form. I have created the form but my text boxes and buttons are not present when I run my code. Please help me with this problem. Thanks import java.awt.*; class Test1 { Frame fr; Button b1,b2,b3; TextField tf1,tf2,tf3,tf4,tf5,tf6,tf7; Label lb1,lb2,lb3,lb4,lb5,lb6,lb7; Test1() { fr=new Frame("Student Form"); fr.setLayout(null); lb1=new Label("Name"); lb2=new Label("Address"); lb3=new Label("Course"); lb4=new Label("Phone"); lb5=new Label("Gmail"); lb6=new Label("Pincode"); lb7=new Label("State"); tf1=new TextField(); tf2=new TextField(); tf3=new TextField(); tf4=new TextField(); tf5=new TextField(); tf6=new TextField(); tf7=new TextField(); b1=new Button("Submit"); b2=new Button("Reset"); b3=new Button("Cancel"); lb1.setBounds(30,50,100,50); lb2.setBounds(30,120,100,50); lb3.setBounds(30,190,100,50); lb4.setBounds(30,260,100,50); lb5.setBounds(30,330,100,50); lb6.setBounds(300,260,100,50); lb7.setBounds(300,330,100,50); tf1.setBounds(150,50,100,50); tf2.setBounds(150,120,100,50); tf3.setBounds(150,190,100,50); tf4.setBounds(150,260,100,50); tf5.setBounds(150,330,100,50); tf6.setBounds(450,260,100,50); tf7.setBounds(450,330,100,50); b1.setBounds(30,500,100,50); b2.setBounds(150,500,100,50); b3.setBounds(300,500,100,50); fr.setSize(700,700); fr.setVisible(true); } public static void main(String s[]) { new Test1(); } }
tagged with: swing
linked to: http://stackoverflow.com/q/6255106
has comment: http://stackoverflow.com/comment/40758017
has comment: http://stackoverflow.com/comment/40756227
accepted answer: http://stackoverflow.com/a/26021107
tagged with: java
has title: Java Swing text boxes and buttons not showing in the form?
linked to: http://stackoverflow.com/q/5621338
score: 2
has comment: http://stackoverflow.com/comment/40758058
type: AnsweredQuestion

http://stackoverflow.com/comment/40564392
type: QuestionComment
comment on: http://stackoverflow.com/q/25907380
type: Comment
has text: @CristianSulea it solved my problem. Thank you very much (just closed the fileinputstream aaaaaand *magic* it works)!
score: 0

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/25955386
tags question: http://stackoverflow.com/q/25911710
type: Tag

http://stackoverflow.com/comment/40505123
comment on: http://stackoverflow.com/a/25881988
score: 0
type: AnswerComment
has text: Yes he is incrementing and then only adding. but he has to do the other way around
type: Comment

http://stackoverflow.com/a/67108865
type: Answer
answers question: http://stackoverflow.com/q/25909611
has body: The following worked for me Go to .settings File Then add project Facet "File.org.eclipse.wst.common.project.facet.core" then add the following file <?xml version="1.0" encoding="UTF-8"?> - <fixed facet="jst.java"/> <fixed facet="jst.web"/> <installed facet="jst.web" version="3.0"/> <installed facet="jst.java" version="1.8"/> <installed facet="jst.web" version="2.4"/> </faceted-project> save it and refresh the project 4. then try to add Dynamic web module in project facets.
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/26022199
type: AcceptedAnswer
has body: Classes are loaded as they are needed, so if you load one, and later it needs another, it will need the jar
accepted answer of: http://stackoverflow.com/q/26022165
type: Answer
answers question: http://stackoverflow.com/q/26022165
score: 0

java-8
tags question: http://stackoverflow.com/q/26012434
tags question: http://stackoverflow.com/q/26000242
tags question: http://stackoverflow.com/q/26011086
tags question: http://stackoverflow.com/q/25974488
tags question: http://stackoverflow.com/q/25905445
tags question: http://stackoverflow.com/q/25988707
tags question: http://stackoverflow.com/q/25921761
tags question: http://stackoverflow.com/q/25991249
tags question: http://stackoverflow.com/q/25880331
tags question: http://stackoverflow.com/q/25873571
tags question: http://stackoverflow.com/q/25903137
tags question: http://stackoverflow.com/q/25912185
tags question: http://stackoverflow.com/q/25931856
tags question: http://stackoverflow.com/q/25876750
tags question: http://stackoverflow.com/q/25922434
tags question: http://stackoverflow.com/q/25898849
tags question: http://stackoverflow.com/q/25912455
tags question: http://stackoverflow.com/q/25939263
tags question: http://stackoverflow.com/q/25965212
tags question: http://stackoverflow.com/q/25876064
tags question: http://stackoverflow.com/q/25961018
tags question: http://stackoverflow.com/q/25942999
tags question: http://stackoverflow.com/q/25893374
tags question: http://stackoverflow.com/q/25937872
tags question: http://stackoverflow.com/q/25989449
tags question: http://stackoverflow.com/q/25900265
tags question: http://stackoverflow.com/q/26004012
tags question: http://stackoverflow.com/q/26016854
tag name: java-8
tags question: http://stackoverflow.com/q/25885591
type: Tag
tags question: http://stackoverflow.com/q/25878948
tags question: http://stackoverflow.com/q/25942010
tags question: http://stackoverflow.com/q/25941528
tags question: http://stackoverflow.com/q/26000017
tags question: http://stackoverflow.com/q/25985287
tags question: http://stackoverflow.com/q/25916821

http://stackoverflow.com/comment/40553773
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25909055
has text: I tried this with lists only, to create another list for every occurence
score: 0

http://stackoverflow.com/q/25894459
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/25894556
tagged with: java
tagged with: hibernate
has title: java.lang.ClassNotFoundException: javax.persistence.NamedStoredProcedureQuery
score: 0
answer count: 1
tagged with: tomcat
has body: I've have this exception in Tomcat. I'm working on a Maven project with Hibernate and I configured everything. I have used Hibernate annotations in bean file and also in my code there is a Rpc call. Any ideas? Grave: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.util.List com.test.projectname.client.TestService.getDataTest(java.lang.String)' threw an unexpected exception: java.lang.ExceptionInInitializerError at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.…

http://stackoverflow.com/q/25943788
upvote count: 0
tagged with: libgdx
has title: Mouse offset in LibGDX
has body: I recently started making my new game in LibGDX and I'm encountering a small problem. I found out how to make the player rotate towards the mouse, but it's always offset by a few degrees. The problem is that I don't know the exact amount of degrees it is offset by. Does anyone know how to fix this? I don't have any code that changes the mouse or anything like that.
has comment: http://stackoverflow.com/comment/40618282
answer count: 1
favorite count: 0
score: -1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25991523
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40617261

http://stackoverflow.com/comment/40631954
comment on: http://stackoverflow.com/a/25953132
score: 0
type: AnswerComment
has text: Why `valueOf` instead of `parseInt`? In this case, there is no reason to use an `Integer` instead of `int`.
type: Comment

http://stackoverflow.com/comment/40769077
comment on: http://stackoverflow.com/q/26027668
score: 0
type: Comment
type: QuestionComment
has text: When I remove /schoolmanagement..it does not work...thanks anyway

http://stackoverflow.com/q/25881263
has title: IntelliJ - Access is denied when building Artifacts
accepted answer: http://stackoverflow.com/a/26260534
has body: I'm trying to export my JavaFX 2 application using IntelliJ 13.1.2 on Windows 8 x64. This is my setup: But when I build the artifact I get an error, this is the log: Information:Compilation completed with 1 error and 0 warnings in 7 sec Information:1 error Information:0 warnings Error:Java FX Packager: D:\Dropbox\Development\MultiWork-PC\out\artifacts\MultiWork_PC (Access is denied) I don't know if it is a bug or more probably some problem with Windows permission. All the files are copied in the Artifact output folder: Except the app itself! What I have tried: Running IntelliJ as Administrator Changing folder permission so everyone can write/modify it Changing folder location from D:\, to C:\, Desktop and Documents but still getting the error NOTE: this doesn't happen if I deploy a jar instead of a JavaFX Application
upvote count: 7
has comment: http://stackoverflow.com/comment/40503975
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40503982
type: Question
has answer: http://stackoverflow.com/a/26260534
answer count: 2
possible better answer: http://stackoverflow.com/a/32503764
tagged with: permission-denied
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/32503764
downvote count: 0
score: 7
favorite count: 0

http://stackoverflow.com/a/26000343
answers question: http://stackoverflow.com/q/26000144
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40730498
score: 1
upvote count: 1
has body: Try something like this: public static void main(String[] args) { List&lt;String&gt; flatList = Arrays.asList( "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"); List&lt;List&lt;String&gt;&gt; outer = new ArrayList&lt;List&lt;String&gt;&gt;(); int cnt = 0; List&lt;String&gt; inner = new ArrayList&lt;String&gt;(5); for (String str : flatList) { inner.add(str); // fill inner list if (++cnt == 5) { outer.add(inner); inner = new ArrayList&lt;String&gt;(5); cnt = 0; } } if (!inner.isEmpty()) { outer.add(inner); } System.out.println(outer); } Result of this code is: [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11]]
has comment: http://stackoverflow.com/comment/40737956

http://stackoverflow.com/comment/40525680
type: Comment
comment on: http://stackoverflow.com/q/25892852
has text: The problem is that the functions aren't called. so the back button goes to activity2 and after that, if I press the back button again, it goes to the activity 1, and then to the activity2. And the timer doesn't stop when I go from Activity 1 to activity 2. And when I come to activity 1, there are more timers running in the same time. And some timer that wasn't stopped earlier is closing my game, even if the current timer is not finished. I would like to solve this problem, my game stops all the time because of this. And I'm using a CountDownTimer with a ProgressBar to count the seconds/level
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40534195
has text: @ManjunathAnand k cool cuz the op seems very confused
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25881659
score: 0

http://stackoverflow.com/comment/40506643
type: QuestionComment
has text: how is `listXXX` being stored?
comment on: http://stackoverflow.com/q/25882944
score: 0
type: Comment

http://stackoverflow.com/comment/40689590
has text: Can you please explain how I would go about using this.memory to save a variable to the Memory class?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25984289

http://stackoverflow.com/comment/40640024
type: Comment
comment on: http://stackoverflow.com/a/25957519
score: 0
type: AnswerComment
has text: Thanks for your answer, but I need to also store the data in a constructor like in my c++ code.

http://stackoverflow.com/comment/40548507
has text: @Martin: nah, I just love foisting my opinion on others :-)
comment on: http://stackoverflow.com/a/25905220
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/q/25996987
tagged with: angularjs
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40715700
has comment: http://stackoverflow.com/comment/40713074
has title: Java not recognized while trying to run selinium server
has comment: http://stackoverflow.com/comment/40711944
score: 2
answer count: 0
has body: I am trying to run the selinium webdriver manager for e2e testing on angular app but i get hit with the error - 'java' is not recognized as an internal or external command, operable program or batch file. I know for a fact that java is configured on my machine, when i run java -version i get - java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) Client VM (build 24.65-b04, mixed mode, sharing)
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40712413
type: Question
has comment: http://stackoverflow.com/comment/40715283
tagged with: protractor
has comment: http://stackoverflow.com/comment/40712157
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26019608
has comment: http://stackoverflow.com/comment/40753582
linked to: http://stackoverflow.com/q/10687200
tagged with: sslexception
answer count: 0
downvote count: 0
tagged with: java
has body: We recently moved our code from Java 5 to Java 7, Tomcat 6 to Tomcat 7 and Spring 2.5 to Spring 4.0.6. All of this together. Unix servers were upgraded as well in Memory and disc space. But since release we are getting below error in Production when batch job sends an email. We are not really sure what is causing this error. I see some other posts like DH keypair exception in salesforce Java 7 and Could not generate DH keypair Is there a workaround for: java.lang.RuntimeException: Could not generate DH keypair Could not generate DH keypair from proxy server But they are not not helping. Can someone please explain in easy language what is causing this issue. org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Exception reading response; nested exception is: javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair. Failed messages: javax.mail.MessagingException: Exception reading r esponse; nested exception is: javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair; message exception details (1) are: Failed message 1: javax.mail.MessagingException: Exception reading response; nested exception is: javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1611) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412) at javax.mail.Service.connect(Service.java:288) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:397) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:346) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:363) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:351) at xxx.AbstractEmailServices.send…
linked to: http://stackoverflow.com/q/14253039
favorite count: 0
has comment: http://stackoverflow.com/comment/40755698
type: Question
score: 3
linked to: http://stackoverflow.com/q/23784016
upvote count: 3
has title: Could not generate DH keypair
has comment: http://stackoverflow.com/comment/47617191
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40753408
linked to: http://stackoverflow.com/q/23559000
has comment: http://stackoverflow.com/comment/54246818

http://stackoverflow.com/q/26005530
has title: Why am I getting this error: "error: { expected" in JCreator?
has answer: http://stackoverflow.com/a/26005629
favorite count: 0
has body: I am in an introductory networking class this semester and we are working with Server/Client chat rooms. This is my Server program so far, and I can't figure out why I'm getting the error in the title. It show the error on lines 17, 33, and 53, which are all lines where I've named new classes. Any help with me appreciated! import java.io.*; import java.net.*; public class Server { public static void main(String[] args) throws Exception { new MyServer().start(); //Creates new Server for Clients to connect } } public class MyServer() extends Thread { ServerSocket SS = new ServerSocket(11200); Socket S; ClientManager CM = new ClientManager(); public void run() { while(true) { S = SS.Accept; //Endless loop allowing clients to repeatedly connect CM.Add(); //Calls the Add method in ClientManager, which adds the Client to the Array } } } public class MyClient() extends Thread { MyClient Client = new MyClient(Socket, CM); Scanner S; public void run() { while(true) { S = new Scanner(System.in); CM.SendToAllClients(S); //Calls the method that will send each client the received message } } public void Send(String S) { PrintWriter.println(S); } } public class ClientManager() { MyClient[] X = new MyClient[15]; int num = 0; public synchronized void Add(MyClient C) { X[num] = C; num++; C.start(); } public synchronized void SendToAllClient(String S) { for(i = 0;i &lt; num;i++); { X[i].Send(S); } } }
has comment: http://stackoverflow.com/comment/40728262
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40736999
accepted answer: http://stackoverflow.com/a/26005629
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40728194
answer count: 1

http://stackoverflow.com/comment/40649252
has text: @Mureinik I think he has sorted the arrays that he already has i.e. `list` and `listCopy` with 2 algorithm. He is new to programming and want to sort array with all his algos.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25962367

http://stackoverflow.com/comment/40651130
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25961464
has text: Thank you for bringing light into my way derhass, do you have some useful sources to learn the proper and modern way of coding openGL? And yes, I'm learning and making mistakes, I apologize for that.
score: 0

http://stackoverflow.com/comment/65633396
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26021026
score: 0
has text: Also do you know how to add headers to the sent messages, in the StreamingOutput ?

http://stackoverflow.com/comment/40629823
comment on: http://stackoverflow.com/q/25952098
type: Comment
type: QuestionComment
has text: Who is writing uncompilable source code? Are you refactoring?
score: 0

http://stackoverflow.com/a/26001384
type: AcceptedAnswer
has body: What you have now is called busy waiting (also sometimes referred as polling), and yes its inefficient in terms of processor usage and also in terms of energy usage. You code executes whenever the OS allows it, and in doing so it prevents the use of a CPU for other work, or when there is no other work it prevents the CPU from taking a nap, wasting energy (heating the CPU, draining the battery...). What you should do is put your thread to sleep until the time where you want to do something arrives. This allows the CPU to perform other tasks or go to sleep. There is a method on java.lang.Thread to do just that: Thread.sleep(long milliseconds) (it also has a cousin taking an additional nanos parameter, but the nanos may be ignored by the VM, and that kind of precision is rarely needed). So first you determine when you need to do some work. Then you sleep until then. A naive implementation could look like that: public static void waitUntil(long timestamp) { long millis = timestamp - System.currentTimeMillis(); // return immediately if time is already in the past if (millis &lt;= 0) return; try { Thread.sleep(millis); } catch (InterruptedException e) { throw new RuntimeException(e.getMessage(), e); } } This works fine if you don't have too strict requirements on precisely hitting the time, you can expect it to return reasonably close to the specified time (a few ten ms away probably) if the time isn't too far in the future (a few secs tops). You have however no guarantees that occasionally when the OS is really busy that it possily returns much later. A slightly more accurate method is to determine the reuired sleep time, sleep for half the time, evaluate required sleep again, sleep again half the time and so on until the required sleep time becomes very small, then busy wait the remaining few milliseconds. However System.currentTimeMillis() does not guarantee the actual resolution of time; it may change once every millisecond, but it might as well only change every ten …
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25997498
answers question: http://stackoverflow.com/q/25997498
score: 4

sorting
tags question: http://stackoverflow.com/q/25880500
tags question: http://stackoverflow.com/q/26012123
tags question: http://stackoverflow.com/q/25918281
tags question: http://stackoverflow.com/q/25933331
tags question: http://stackoverflow.com/q/25951877
tags question: http://stackoverflow.com/q/25961018
tags question: http://stackoverflow.com/q/25927050
tags question: http://stackoverflow.com/q/26030602
tags question: http://stackoverflow.com/q/25957745
tags question: http://stackoverflow.com/q/25963157
tags question: http://stackoverflow.com/q/25924445
tags question: http://stackoverflow.com/q/26014621
tags question: http://stackoverflow.com/q/26009336
type: Tag
tags question: http://stackoverflow.com/q/25962367
tags question: http://stackoverflow.com/q/25943144
tags question: http://stackoverflow.com/q/25933919
tags question: http://stackoverflow.com/q/26006318
tag name: sorting
tags question: http://stackoverflow.com/q/25982998
tags question: http://stackoverflow.com/q/25882697
tags question: http://stackoverflow.com/q/25941261
tags question: http://stackoverflow.com/q/25963689
tags question: http://stackoverflow.com/q/25899929

http://stackoverflow.com/comment/85635817
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25953317
has text: path_to_key_store requires also a file name. is it important how we name it? what extension should it have?

http://stackoverflow.com/comment/126968169
has text: did it the same way with XmlElements and JAXM marshalling.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25983995

linechart
tag name: linechart
tags question: http://stackoverflow.com/q/25993430
type: Tag

http://stackoverflow.com/comment/40636322
type: Comment
type: QuestionComment
has text: can you suggest one?
score: 0
comment on: http://stackoverflow.com/q/25955445

http://stackoverflow.com/comment/40575784
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25920735
has text: There is a good explanation here: http://docs.oracle.com/javase/tutorial/essential/io/formatting.html

http://stackoverflow.com/q/25944522
tagged with: http://stackoverflow.com/tag/c
type: Question
has comment: http://stackoverflow.com/comment/40618638
has comment: http://stackoverflow.com/comment/40618444
has comment: http://stackoverflow.com/comment/40618527
downvote count: 0
has comment: http://stackoverflow.com/comment/40618457
has body: Finding 2's complement. If a number is positive, then its representation is same as that of its signed repesentation 0101 +5 0110 +6 0111 +7 If a number is negative, we convert first take one's complement of its signed representation and add one to it. Like for -7 it is 0111+1=1000 for -128 it is one's complement of +128 and add one to it.signed representation of +128 is 010000000 (first zero is for sign). its ones complement is 101111111. adding one to i t gives 110000000 which is a nine bit numbers. Hence we cannot store -128 in two's complement form????
has answer: http://stackoverflow.com/a/25944554
answer count: 1
favorite count: 0
tagged with: binary
has title: Two's complement error
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40618491
upvote count: 1
tagged with: twos-complement
score: 1
tagged with: math
tagged with: java

http://stackoverflow.com/a/25976550
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25976291
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25976291
has body: The best practice on linking Activity and Fragment is using callbacks. For example, let's imagine you want take some objects from the hosting Activity and use them at the your Fragment. It's obvious, that in such a case Activity should have some functionality to satisfy Fragment. Thus, we can use interfaces. public interface MyCallback { Object takeObject(); } Then, make Activity to implement this interface: public class MyActivity extends Activity implements MyCallback { } After that, you can save a link to this Activity at the onAttach callback: public class MyFragment extends Fragment { MyCallback callback; @Override public void onAttach(Activity activity) { try { callback = (MyCallback) activity; } catch (ClassCastException ex){ throw new ClassCastException("Hosting activity must implement " + MyCallback.class.getSimpleName()); } super.onAttach(activity); } } Later in code you can use this callback as following: if (callback != null){ Object object = callback.takeObject(); }

http://stackoverflow.com/comment/40509130
type: Comment
type: QuestionComment
has text: Thanx. Soy templates should be compiled, too. I just don't like the java output of JSPs, there are like thousands of line that just write simple strings to the output streams. I know that overall performance gain would not be drastically changed, but still - if I can save some cycles, lets do that :) Btw, which template engine would you use? Soy seems interesting because of language-agnostic (sort of) compilation, to javascript and java; which can be further used to optimize web pages.
score: 0
comment on: http://stackoverflow.com/q/25884219

http://stackoverflow.com/comment/40550843
type: Comment
comment on: http://stackoverflow.com/q/25905368
type: QuestionComment
score: 0
has text: Once upon a time there was no such thing as the service providers in java hence one needed to manually load the drivers. The main differences betweeen the `Class.forName` and the `new Driver()` is the latter is statically linked to the driver (resulting in a classnotfound if you start yuour application, the other will result in a classnotfound also but not kill your application, you could load another driver if you want).

http://stackoverflow.com/a/25928296
score: 0
answers question: http://stackoverflow.com/q/25928123
type: Answer
has body: Thank you all for the answers. I think I will solve the problem in the following way: 1. dynamically determine the size of my array 2. initialize my array with that size.

http://stackoverflow.com/q/25936132
tagged with: android
has title: Unfortunately, app name has stopped in Eclipse
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40604212
has body: I'm having a problem with the application I'm trying to run. I had tried many solutions available here but no luck. Maybe you can help. Better If you also try to import it in eclipse. bts, I'm new to eclipse and this program isn't mine, but i have permission. Please do help :| Here's my logcat: 09-19 09:28:44.355: E/Term(2264): onCreate 09-19 09:28:46.278: E/AndroidRuntime(2264): FATAL EXCEPTION: main 09-19 09:28:46.278: E/AndroidRuntime(2264): Process: jackpal.androidterm, PID: 2264 09-19 09:28:46.278: E/AndroidRuntime(2264): java.lang.UnsatisfiedLinkError: Couldn't load jackpal-androidterm4 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/jackpal.androidterm-2.apk"],nativeLibraryDirectories=[/data/app-lib/jackpal.androidterm-2, /vendor/lib, /system/lib]]]: findLibrary returned null 09-19 09:28:46.278: E/AndroidRuntime(2264): at java.lang.Runtime.loadLibrary(Runtime.java:358) 09-19 09:28:46.278: E/AndroidRuntime(2264): at java.lang.System.loadLibrary(System.java:610) 09-19 09:28:46.278: E/AndroidRuntime(2264): at jackpal.androidterm.Exec.<clinit>(Exec.java:33) 09-19 09:28:46.278: E/AndroidRuntime(2264): at jackpal.androidterm.Exec.createSubprocess(Native Method) 09-19 09:28:46.278: E/AndroidRuntime(2264): at jackpal.androidterm.ShellTermSession.createSubprocess(ShellTermSession.java:198) 09-19 09:28:46.278: E/AndroidRuntime(2264): at jackpal.androidterm.ShellTermSession.initializeSession(ShellTermSession.java:135) 09-19 09:28:46.278: E/AndroidRuntime(2264): at jackpal.androidterm.ShellTermSession.<init>(ShellTermSession.java:87) 09-19 09:28:46.278: E/AndroidRuntime(2264): at jackpal.androidterm.Term.createTermSession(Term.java:489) 09-19 09:28:46.278: E/AndroidRuntime(2264): at jackpal.androidterm.Term.createTermSession(Term.java:498) 09-19 09:28:46.278: E/AndroidRuntime(2264): at jackpal.androidterm.Term.populateViewFlipper(Term.java:411) 09-19 09:28:46.278: E/AndroidRuntime(2264): at jackpal.androidterm.Term.access$5(Term.java:405) 09-19…
type: Question
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40618176
score: 0
has answer: http://stackoverflow.com/a/25936940
answer count: 1

http://stackoverflow.com/a/25971194
upvote count: 0
has comment: http://stackoverflow.com/comment/40666121
has comment: http://stackoverflow.com/comment/40666266
has comment: http://stackoverflow.com/comment/40665551
has comment: http://stackoverflow.com/comment/40709290
answers question: http://stackoverflow.com/q/25971031
score: -1
has body: Your code does not compile with javac: incompatible types: bad return type in lambda expression missing return value I suspect this is a bug in eclipse.
downvote count: 1
has comment: http://stackoverflow.com/comment/40710037
type: Answer
has comment: http://stackoverflow.com/comment/40666199

http://stackoverflow.com/q/25941528
tagged with: java
has answer: http://stackoverflow.com/a/76161005
has answer: http://stackoverflow.com/a/76842335
has title: Collapse List<List<String>> into List<String> using a lambda?
accepted answer: http://stackoverflow.com/a/25941582
answer count: 4
downvote count: 0
has body: Say I have a list of Lists.. List&lt;List&lt;String&gt;&gt; lists = new ArrayList&lt;&gt;(); Is there a clever lambda way to collapse this into a List of all the contents ?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25941558
score: 7
has answer: http://stackoverflow.com/a/25941558
favorite count: 0
type: Question
upvote count: 7
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/25941582

http://stackoverflow.com/comment/40660369
score: 1
type: Comment
has text: you should type the String param of the main method as java.lang.String
type: QuestionComment
comment on: http://stackoverflow.com/q/25968390

alloy-ui
tags question: http://stackoverflow.com/q/25931108
tag name: alloy-ui
type: Tag

http://stackoverflow.com/comment/40617594
has text: Why do you think you need a recursive solution? _" I debugged it but still can't see where is the problem"_ -- sorry, if you actually traced through the code you should be able to provide more details on what you don't understand.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25943943

http://stackoverflow.com/a/26001990
downvote count: 0
type: Answer
upvote count: 1
has body: If it must be regex, I would keep it simple and use a capturing group to match and capture the word after "what is" what\sis\s(\w+) Note: You need to reference match group #1 to return your match result. Explanation: what # 'what' \s # whitespace (\n, \r, \t, \f, and " ") is # 'is' \s # whitespace (\n, \r, \t, \f, and " ") ( # group and capture to \1: \w+ # word characters (a-z, A-Z, 0-9, _) (1 or more times) ) # end of \1
score: 1
answers question: http://stackoverflow.com/q/26001856

http://stackoverflow.com/comment/40600952
comment on: http://stackoverflow.com/a/25934930
has text: -1: I was the one who downvoted this, as this simply rewrites what I already have and doesn't solve the problem. I still receive run-time errors if a no-arg constructor doesn't exist.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/52299003
comment on: http://stackoverflow.com/a/25973778
type: Comment
type: AnswerComment
score: 1
has text: @EviatarS I've updated the answer with that information. Good luck!

http://stackoverflow.com/comment/40707498
score: 0
type: Comment
type: QuestionComment
has text: didn't get your question
comment on: http://stackoverflow.com/q/25994710

http://stackoverflow.com/q/25941965
has title: How does the ProcessBuilder constructor parameter work?
type: Question
accepted answer: http://stackoverflow.com/a/25942282
linked to: http://stackoverflow.com/q/23933335
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm doing this: String[] command = {ffmpegLoc+"ffmpeg.exe", "-i ", "\""+dir+params.getString(4)+".flv"+"\"", "-copyts", "-crf 18", "-profile:v baseline", "-level 3.0", "-pix_fmt yuv420p", "-preset veryslow", "\""+dir+params.getString(4)+".mp4"+"\""}; try { getLogger().info("ffmpeg command " + command); ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); getLogger().info("Starting process"); Process process = builder.start(); InputStream stream = process.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = null; while((line = in.readLine()) != null) { System.out.println(line); } process.waitFor(); And I get this error from ffmpeg, which initializes correctly: Unrecognized option 'i '. Error splitting the argument list: Option not found So I thought "Maybe I don't need to split out each argument into an array" So I replaced the command with this: String[] command = {ffmpegLoc+"ffmpeg.exe", "-i " + "\""+dir+params.getString(4)+".flv"+"\"" + " -copyts -crf 18 -profile:v baseline -level 3.0 -pix_fmt yuv420p -preset veryslow "+"\""+dir+params.getString(4)+".mp4"+"\""}; And now I get this: Unrecognized option 'i C:/Program'. Error splitting the argument list: Option not found What happened to that hyphen before i? What happened to those double quotes wrapping the path to the .flv file? What is going on here? Edit: I dropped the escaped double-quotes, as per this answer, and now I get this: Unrecognized option 'i C:/Program Files (x86)/Wowza Media Systems/Wowza Streaming Engine 4.1.0/content/recorder/vid_test001.flv -copyts -crf 18 -profile:v baseline -level 3.0 -pix_fmt yuv420p -preset veryslow C:/Program Files (x86)/Wowza Media Systems/Wowza Streaming Engine 4.1.0/content/recorder/vid_test001.mp4'. Error splitting the argument list: Option not found And again that hyphen in front of the i is missing. Edit 2: Let's combine them: No escaped double-quotes combined with ar…
tagged with: ffmpeg
upvote count: 2
has answer: http://stackoverflow.com/a/25942282
score: 2
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40719502
comment on: http://stackoverflow.com/a/26000852
score: 0
type: AnswerComment
has text: Make sure to do i>=0 instead of i>0 if you want to hit all elements otherwise you will skip the first element(see my post).
type: Comment

http://stackoverflow.com/comment/40692762
type: QuestionComment
comment on: http://stackoverflow.com/q/25985711
has text: Yeah I've been working my way through it. Thanks for your answers on both my questions.
score: 0
type: Comment

http://stackoverflow.com/comment/40609338
comment on: http://stackoverflow.com/a/25939290
type: AnswerComment
has text: IMO, this answer works only if the elements in the collection are unique.
score: 0
type: Comment

http://stackoverflow.com/comment/40528680
has text: You are right but the critical code is the same for both the environment BMT and CMT but the time processing change
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25894686
type: Comment

http://stackoverflow.com/comment/40530528
has text: already answered here http://stackoverflow.com/questions/240546/remove-html-tags-from-a-string
type: Comment
comment on: http://stackoverflow.com/a/25888631
score: 0
type: AnswerComment

http://stackoverflow.com/a/26016404
accepted answer of: http://stackoverflow.com/q/25974431
answers question: http://stackoverflow.com/q/25974431
has comment: http://stackoverflow.com/comment/40936757
type: Answer
has comment: http://stackoverflow.com/comment/40894232
has comment: http://stackoverflow.com/comment/40936961
has comment: http://stackoverflow.com/comment/40937195
has comment: http://stackoverflow.com/comment/40779642
has comment: http://stackoverflow.com/comment/40785007
upvote count: 1
has comment: http://stackoverflow.com/comment/40778076
has comment: http://stackoverflow.com/comment/40934785
score: 1
has body: I don't know how to hide the previous window, but I as a Windows user can also tell you that it's often found frustrating to have a pop-up dissapear beneath a pile of programs, so would advise against that. As to the actual question: have you tried JDialog? Just stack a JOptionPane in the dialog window that'll be displayed upon a button being pressed. see http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html EDIT: here's the code snippet that should work, I haven't tested it. import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; public class Snippet99 { public static void main(String[] args) { final private Display display = new Display(); final private Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); final Composite container = new Composite(shell, SWT.NULL); container.setLayout(new FillLayout()); final private Button btn = new Button(container, SWT.PUSH).setText("Button 1"); final private PopupComposite pc1 = new PopupComposite(Display.getDefault().getActiveShell(), SWT.NULL); final private Button btn2 = new Button(pc1, SWT.PUSH).setText("Button 2"); final private PopupComposite pc2 = new PopupComposite(pc1.getShell(),SWT.NULL); private Text text = new Text(pc2, SWT.BORDER); /* only use final if you're setting the value immediately and will never change it again, make sure you set the accessibility of your items (protected/private/public) */ Listener listener = new Listener() { public void handleEvent(Event event) { pc1.show(btn.getLocation()); } }; btn.addListener(SWT.Selection, listener); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40736664
type: QuestionComment
score: 0
has text: Make use of a didicated library like [opencsv](http://opencsv.sourceforge.net/)
type: Comment
comment on: http://stackoverflow.com/q/26010221

http://stackoverflow.com/comment/40514849
score: 0
has text: The problem is in testing?
comment on: http://stackoverflow.com/q/25887729
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26041148
accepted answer of: http://stackoverflow.com/q/26021400
answers question: http://stackoverflow.com/q/26021400
score: 0
type: AcceptedAnswer
type: Answer
has body: In reading this blog post: http://www.jobinesh.com/2009/06/adf-with-mysql.html I realized my mistake was the difference from Project Properties and Default Project Properties. I had added the library to the wrong one. They are both under the Application menu in JDeveloper 11G. Thanks, Tom

http://stackoverflow.com/a/26056386
type: Answer
has comment: http://stackoverflow.com/comment/40875894
has body: As per now, this is a known bug with vaadin4spring, when used outside of spring-boot (and with XML based config). As stated in the comments of the question, mixing with code annotated config gives a little remedy (adding @EnableVaadin to a config class). The author states in the ticket, that he did not test yet outside of spring-boot I have not used this add-on without Spring Boot myself, so I'm pretty sure there are some problems there.
answers question: http://stackoverflow.com/q/26032806
score: 0

http://stackoverflow.com/q/25934917
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/31468296
has title: Cannot resolve method placeholderfragment error
has body: I'm really stuck on this error (below): @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_vehiclerecall); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } I have the container referenced correctly to XML layout (below): &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout 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:id="@+id/container" tools:context="com.customerautomotivenetwork.VehicleRecall"/&gt; But I keep getting an error of cannot resolve method for PlacehlderFragment, any idea of what I'm doing wrong?
has comment: http://stackoverflow.com/comment/40609970
tagged with: android
has comment: http://stackoverflow.com/comment/40600861
tagged with: android-activity
type: AnsweredQuestion
tagged with: error-handling
has comment: http://stackoverflow.com/comment/40605537
accepted answer: http://stackoverflow.com/a/25949139
type: Question
has comment: http://stackoverflow.com/comment/40604812
possible better answer: http://stackoverflow.com/a/31468296
score: 3
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/40604051
has answer: http://stackoverflow.com/a/25949139
upvote count: 3

http://stackoverflow.com/q/25884250
upvote count: 1
has comment: http://stackoverflow.com/comment/40509047
answer count: 7
has answer: http://stackoverflow.com/a/74948817
has comment: http://stackoverflow.com/comment/40510141
has answer: http://stackoverflow.com/a/25884362
favorite count: 0
has comment: http://stackoverflow.com/comment/40508987
has comment: http://stackoverflow.com/comment/40508817
has answer: http://stackoverflow.com/a/37676730
has answer: http://stackoverflow.com/a/49103145
has answer: http://stackoverflow.com/a/40097353
type: AnsweredQuestion
downvote count: 0
has body: I need to format the input string into IP address format, so I have the following code;however,the numbers are fixed and I am not sure how to generated different values for a single input. Other constraints would be to make sure no group of numbers is more than 255, but in this case I just want to put them in four separate groups and each group must have 1 to 3 members. Vimal's question: From provided string 19216801, I think you cant identify exact ip. It can be 192.168.0.1 or 19.216.80.1 or any other combination. Answer: I am not looking for any specific IP I just need to show all the possible combinations. Sample formats Some of the combinations would be as following Expected result | number of input characters 1.1.1.1 4 .... 1.1.1.2 5 1.1.2.1 1.2.1.1 2.1.1.1 .... 1.1.1.3 6 1.1.3.1 1.3.1.1 3.1.1.1 .... 2.2.2.1 7 2.2.1.2 .... 2.2.2.2 8 3.2.2.1 1.2.2.3 .... 2.2.2.3 9 3.3.2.1 1.2.3.3 .... 3.3.3.1 10 3.3.1.3 3.1.3.3 1.3.3.3 .... 3.3.3.2 11 3.3.2.3 3.2.3.3 .... 3.3.3.3 12 Code String number = "19216801"; if (number.length() == 4) { StringBuilder sb = new StringBuilder(number) .insert(1, ".") .insert(1, ".") .insert(1, ".") .insert(1, "."); String output = sb.toString(); System.out.println(output); } if (number.length() == 8) { StringBuilder sb = new StringBuilder(number) .insert(2, ".") .insert(2, ".") .insert(2, ".") .insert(2, "."); String output = sb.toString(); System.out.println(output); } if (number.length() == 12) { StringBuilder sb = new StringBuilder(number) .insert(3, ".") .insert(3, ".") .insert(3, ".") .insert(3, "."); String output = sb.toString(); System.out.println(output); }
accepted answer: http://stackoverflow.com/a/25884652
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25884362
type: Question
has comment: http://stackoverflow.com/comment/40508954
has answer: http://stackoverflow.com/a/25884652
has comment: http://stackoverflow.com/comment/40512422
tagged with: data-structures
has comment: http://stackoverflow.com/comment/40509063
has answer: http://stackoverflow.com/a/41318179
linked to: http://stackoverflow.com/q/25886289
has title: How to show all combinations of IP address that can be created from a string of numbers?
has comment: http://stackoverflow.com/comment/40508934

http://stackoverflow.com/a/25992698
upvote count: 1
has comment: http://stackoverflow.com/comment/40705591
answers question: http://stackoverflow.com/q/25991953
has body: public static void main(String[] args) throws Exception { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); String fileContent = readFile("SearchPromotions.xml");// Read trimmed file InputStream in = new ByteArrayInputStream(fileContent.getBytes("UTF-8"));// Create stream to pass it to parser() DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(in); NodeList l = doc.getElementsByTagName("TestCase"); Node parentNode = l.item(0); int count = parentNode.getChildNodes().getLength(); System.out.println(count); } private static String readFile(String pathname) throws IOException { File file = new File(pathname); StringBuilder fileContents = new StringBuilder((int) file.length()); Scanner scanner = new Scanner(file); try { while (scanner.hasNextLine()) { fileContents.append(scanner.nextLine().trim()); // Trim the whitespace. This resuls in TEXT_NODE. } return fileContents.toString(); } finally { scanner.close(); } } There are some white space charcters in your XML which will result in extra nodes. Try the above solution hope it helps.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/26030586
has comment: http://stackoverflow.com/comment/40774015
answer count: 0
score: 0
has body: Why RESTful web services are always synchronous while SOAP web services can be implemented as either synchronous or asynchronous?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40774593
has title: RESTful and SOAP web services
tagged with: rest
type: UnansweredQuestion
tagged with: soap

http://stackoverflow.com/a/25974693
answers question: http://stackoverflow.com/q/25974194
upvote count: 2
has body: You need to import 'core' context into 'web' context using @Import annotation.
has comment: http://stackoverflow.com/comment/40671281
has comment: http://stackoverflow.com/comment/40672642
has comment: http://stackoverflow.com/comment/40671339
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/40614732
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25922802
has text: What font are you using?
type: AnswerComment

apache
tag name: apache
tags question: http://stackoverflow.com/q/25955287
tags question: http://stackoverflow.com/q/26024486
tags question: http://stackoverflow.com/q/26018963
tags question: http://stackoverflow.com/q/26009223
tags question: http://stackoverflow.com/q/25934846
tags question: http://stackoverflow.com/q/25950140
tags question: http://stackoverflow.com/q/25957721
tags question: http://stackoverflow.com/q/25906818
tags question: http://stackoverflow.com/q/25946666
tags question: http://stackoverflow.com/q/25993330
tags question: http://stackoverflow.com/q/25988156
tags question: http://stackoverflow.com/q/25927230
tags question: http://stackoverflow.com/q/26023804
tags question: http://stackoverflow.com/q/26022614
tags question: http://stackoverflow.com/q/25999559
tags question: http://stackoverflow.com/q/25913127
tags question: http://stackoverflow.com/q/25930250
tags question: http://stackoverflow.com/q/25887511
tags question: http://stackoverflow.com/q/26023653
tags question: http://stackoverflow.com/q/25945902
tags question: http://stackoverflow.com/q/25987762
tags question: http://stackoverflow.com/q/25928147
tags question: http://stackoverflow.com/q/25887766
tags question: http://stackoverflow.com/q/25931750
tags question: http://stackoverflow.com/q/25906058
type: Tag
tags question: http://stackoverflow.com/q/25976314
tags question: http://stackoverflow.com/q/25954990
tags question: http://stackoverflow.com/q/26033029
tags question: http://stackoverflow.com/q/26013414

http://stackoverflow.com/a/25874533
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25874457
has body: No, not really. The purpose of a map is to map from one thing to another: think of it as a source and a destination, or a label on a box and the contents of the box. There isn't room for a third "type of thing" in there. It might be that what you really want is to map the String onto a combination of the other two; in other words, you want to look up both of the other values using the String; you want to store two things in the box. If so, you can certainly do that, but you need to create a new Class panelAndLabel that contains the other two items. You can then use that as the value type of your HashMap. (Or, for a quick hack, the value could be of type Object[], or List&lt;Object&gt;, and then you could put what you want into the value wrapper. But, as I say, that would be a bit of a hack.)
upvote count: 2

http://stackoverflow.com/a/25921584
answers question: http://stackoverflow.com/q/25921510
has body: State from the docs IllegalArgumentException if fromKey is greater than toKey; or if this map itself has a restricted range, and fromKey or toKey lies outside the bounds of the range
score: 0
type: Answer

http://stackoverflow.com/comment/40747528
comment on: http://stackoverflow.com/a/26011320
type: Comment
has text: Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [META-INF/cxf/cxf.xml]; nested exception is java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf.xml] cannot be opened because it does not exist - Any clue?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40661619
score: 0
type: Comment
type: QuestionComment
has text: What exactly you want to ask here?
comment on: http://stackoverflow.com/q/25969044

http://stackoverflow.com/comment/40707147
type: AnswerComment
comment on: http://stackoverflow.com/a/25989170
has text: the Reason behind that is there are some white spaces. Between your nodes and the parser considers those also to as A Node. Please see update.
type: Comment
score: 0

http://stackoverflow.com/q/25996464
tagged with: jdeveloper
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/25997045
type: Question
has body: I am using transformer to transform one type to another type. Code for this is TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");//Getting error here DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new FileWriter(outputFilePath)); transformer.transform(source, result); The Stack trace of the exception is java.lang.IllegalArgumentException at oracle.xml.jaxp.JXTransformer.setOutputProperty(JXTransformer.java:798) I am using Jdeveloper and its java version 1.6 added jars jdom1.0 and xercesimpl.jar Will any one help on this.
tagged with: xslt
has comment: http://stackoverflow.com/comment/40711159
has comment: http://stackoverflow.com/comment/40711332
answer count: 1
downvote count: 0
tagged with: jar
favorite count: 0
has answer: http://stackoverflow.com/a/25997045
has title: IllegalArgumentException at oracle.xml.jaxp.JXTransformer.setOutputProperty
has comment: http://stackoverflow.com/comment/40711554

http://stackoverflow.com/q/25939862
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40610811
has comment: http://stackoverflow.com/comment/40610202
tagged with: java
has title: Exception in thread "main" IllegalArgumentException: adding container's parent to itself
has answer: http://stackoverflow.com/a/25939890
has comment: http://stackoverflow.com/comment/40610148
answer count: 1
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/40610178
has body: I just started learning programming and am trying to create a program that calculates the income tax at 20%. the program compiles but keeps getting errors. The error states Exception in thread "main" java.lang.IllegalArgumentException: adding container's parent to itself I don't understand what to change. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.*; public class IncomeTax extends JFrame { // declarations Color black = new Color(0, 0, 0); Color white = new Color(255, 255, 255); Color light_gray = new Color(192, 192, 192); DecimalFormat currency; JLabel grossIncomeJLabel; JTextField grossIncomeJTextField; JLabel amountTaxedJLabel; JTextField amountTaxedJTextField; JTextField currencyJTextField; JLabel amountDeductedJLabel; JTextField amountDeductedJTextField; JLabel netIncomeJLabel; JTextField netIncomeJTextField; JButton enterJButton; JButton clearJButton; double grossIncome; double amountTaxed; double amountDeducted; double netIncome; public IncomeTax() { createUserInterface(); } public void createUserInterface() { Container contentPane = getContentPane(); contentPane.setBackground(white); contentPane.setLayout(null); // initialize components // input grossIncomeJLabel = new JLabel (); grossIncomeJLabel.setBounds (50, 20, 150, 20); grossIncomeJLabel.setFont(new Font("Default", Font.PLAIN, 12)); grossIncomeJLabel.setText ("Enter Gross Income:"); grossIncomeJLabel.setForeground(black); grossIncomeJLabel.setHorizontalAlignment(JLabel.LEFT); contentPane.add(grossIncomeJLabel); grossIncomeJTextField = new JTextField(); grossIncomeJTextField.setBounds(200, 20, 100, 20); grossIncomeJTextField.setFont(new Font("Default", Font.PLAIN, 12)); grossIncomeJTextField.setHorizontalAlignment(JTextField.CENTER); grossIncomeJTextField.setForeground(black); grossIncomeJTextField.setBackground(white); grossIncomeJTextField.setEditable(true); contentPane.add(grossIncomeJTextField); //outputs amountTaxedJLabel = new JLabel(); amountTaxedJLabel.s…
has comment: http://stackoverflow.com/comment/40610070
type: UnansweredQuestion

http://stackoverflow.com/q/25995551
type: AnsweredQuestion
tagged with: reflection
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40709100
linked to: http://stackoverflow.com/q/7313559
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40709186
has answer: http://stackoverflow.com/a/25995751
accepted answer: http://stackoverflow.com/a/25995751
answer count: 1
downvote count: 0
favorite count: 0
has body: public static void printType(Object o){ type = **someWayToDeduceTheObjectType()** fields = type.getDeclaredFields() System.out.println("The type of the object is : " + type); System.out.println("The fields of this type of class is : " + fields); } Is it possible to infer the object type of a passed object from a generic reference type? If not, what is the reason? I assume this is not possible, because of the existence of casting, but I can't pinpoint the exact reason. EDIT: I'm not referring to instanceof operator here. Assume I don't have a list of Types to compare with.
has title: Java - Is there any way to infer the object type from a reference type

http://stackoverflow.com/comment/40710890
type: QuestionComment
has text: Two questions: could `dataSource.getAll()` itself return an empty `ArrayList`, and if so, is it important to distinguish between that and `null`?
score: 1
comment on: http://stackoverflow.com/q/25996289
type: Comment

http://stackoverflow.com/q/25975313
downvote count: 1
type: Question
has body: hi im new to javacv and as ive searche in the internet i counter this piece of code and i decided to use it but everytime i run the project it always return a java.lang.NumberFormatExcepti error. plesase help me to get through with this, please help me to fix this package com.shekhar.facedetection; import com.googlecode.javacv.cpp.opencv_core; import static com.googlecode.javacv.cpp.opencv_highgui.*; import static com.googlecode.javacv.cpp.opencv_core.*; import static com.googlecode.javacv.cpp.opencv_imgproc.*; import static com.googlecode.javacv.cpp.opencv_contrib.*; import java.io.File; import java.io.FilenameFilter; import static com.googlecode.javacv.cpp.opencv_contrib.createEigenFaceRecognizer; public class facerecog { public static void main(String[] args) { IplImage testImage = cvLoadImage("C://Users//Michelle//Desktop//jaffe//testna.jpg"); File root = new File("C://Users//Michelle//Desktop//jaffe//happy"); FilenameFilter pngFilter = new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".jpg"); } }; File[] imageFiles = root.listFiles(pngFilter); MatVector images = new MatVector(imageFiles.length); int[] labels = new int[imageFiles.length]; int counter = 0; int label; IplImage img; IplImage grayImg; for (File image : imageFiles) { img = cvLoadImage(image.getAbsolutePath()); label = Integer.parseInt(image.getName().split("\\-")[0]); grayImg = IplImage.create(img.width(), img.height(), IPL_DEPTH_8U, 1); cvCvtColor(img, grayImg, CV_BGR2GRAY); images.put(counter, grayImg); labels[counter] = label; counter++; } IplImage greyTestImage = IplImage.create(testImage.width(), testImage.height(), IPL_DEPTH_8U, 1); // FaceRecognizer faceRecognizer = createFisherFaceRecognizer(); FaceRecognizer faceRecognizer = createEigenFaceRecognizer(); // FaceRecognizer faceRecognizer = createLBPHFaceRecognizer() faceRecognizer.train(images, labels); cvCvtColor(testImage, greyTestImage, CV_BGR2GRAY); int predictedLabel = faceRecognizer…
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25975516
tagged with: javacv
upvote count: 0
answer count: 1
has title: Javacv: eigenface face recognition
has comment: http://stackoverflow.com/comment/40672754
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/40570458
type: AnswerComment
has text: Let me know if you've any problems. I can't do a full test right now. I only have one phone, and I can't reach anybody to call me. The only problem I foresee is if the numbers don't match exactly, but I'd think they'd be consistent across the API.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25917862

http://stackoverflow.com/a/25994280
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25993330
downvote count: 0
has body: I have verified it. Issue with id - PDFBOX-2261 has not been added until 1.8.7 release. Was added in 2.0.0-SNAPSHOT http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/ http://www.apache.org/dist/pdfbox/1.8.7/RELEASE-NOTES.txt
score: 1

http://stackoverflow.com/comment/40702799
comment on: http://stackoverflow.com/a/25991820
type: AnswerComment
score: 0
type: Comment
has text: There are many libraries for Android out there that can help you with that like RoboSpice, Retrofit, Volley and others. If you wish to download it manually then http://developer.android.com/reference/android/os/AsyncTask.html is a maybe not perfect but good enough solution.

http://stackoverflow.com/comment/40693792
comment on: http://stackoverflow.com/q/25984586
has text: The code you posted really doesn't look like "String a contains in String b". Edit your question and state clearly what's the goal. Also add more code. Modifying a string to find out something sounds plain wrong. Optimizing line by line is pure nonsense, that's surely not how computers/compilers work.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26018903
type: Answer
has body: You are looking for the EditText at the wrong View. Its not part of the Activity, its part of the dialog. So check the dialog for the view: Dialog dialogView = dialog.getDialog(); EditText paymentEt = (EditText) dialogView.findViewById(R.id.edittext_payment);
upvote count: 4
has comment: http://stackoverflow.com/comment/40752261
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/26018709
downvote count: 0
answers question: http://stackoverflow.com/q/26018709

http://stackoverflow.com/q/25923060
downvote count: 0
has title: JButton KeyBinding and setActionCommand
tagged with: key
favorite count: 0
accepted answer: http://stackoverflow.com/a/25923118
has comment: http://stackoverflow.com/comment/40579955
type: AnsweredQuestion
has body: I'm fairly new to Swing and am having trouble understand a KeyBinding concept. I'm trying to add a JButton to my JPanel and then setting its action command and KeyBinding. Here's my code: JButton b = new JButton("1"); MyAction myaction = new MyAction("1"); b.setAction(myaction); b.getInputMap(JButton.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_1, 0), "one"); b.getActionMap().put("one", myaction); b.setActionCommand("one"); MyAction here, is an inner class class MyAction extends AbstractAction { public MyAction(String text) { super(text); } @Override public void actionPerformed(ActionEvent e) { System.out.println("Action command is: " + e.getActionCommand()); } } Now if I press the button, I get this output: Action command is: one However, if I press '1' on the keyboard, I get this: Action command is: 1 Why is that so? And what should I do to get the same action command irrespective of whether the action is fired by button press or a keybinding?
has comment: http://stackoverflow.com/comment/40579975
score: 1
tagged with: java
upvote count: 1
tagged with: swing
possible better answer: http://stackoverflow.com/a/25923122
type: Question
tagged with: key-bindings
has answer: http://stackoverflow.com/a/25923122
has answer: http://stackoverflow.com/a/25923118
answer count: 2

http://stackoverflow.com/comment/89682041
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/45939758
score: 1
has text: Thank you, Short and clear, this should be the accepted answer in my opinion, I also think the annotations should be renamed to be self descriptive instead of this ambiguity.

http://stackoverflow.com/q/25934901
upvote count: 2
type: UnansweredQuestion
tagged with: jmx
type: Question
score: 2
has body: As you can see, there's the new instructions: https://docs.jboss.org/author/display/AS71/JMX+subsystem+configuration And the old RMI instructions: https://docs.jboss.org/author/pages/viewpage.action?pageId=21627109 I can get the new instructions working, but we use nagios, which only allows checking JMX via RMI, so I need to get RMI JMX working. Does anyone have a solution for this? I can't use the old instructions because it says &lt;jmx-connector&gt; is no longer supported. I've added the following to my JAVA_OPTS on JBoss startup: JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl -Djava.rmi.server.hostname=10.20.2.50 but i can't get jconsole to connect to service:jmx:rmi:///jndi/rmi://10.20.2.50:12345/jmxrmi (PS. If anyone with redhat paywall access could report back on the answer here: https://access.redhat.com/solutions/263763 that would be swell :P)
tagged with: java
tagged with: jboss
tagged with: nagios
has answer: http://stackoverflow.com/a/25940587
answer count: 1
downvote count: 0
favorite count: 0
has title: How to configure JBoss 6.3.0GA to use RMI JMX?

http://stackoverflow.com/comment/40668207
type: QuestionComment
has text: And by the way, instead of using `MouseListener` you can use `MouseAdapter` so that you don't need to implement all the methods.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25930960

http://stackoverflow.com/comment/40740754
comment on: http://stackoverflow.com/a/26012728
has text: Just what I wanted. Thank you.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40599341
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25926455
has text: You can refer this answer for Baseadapter usage http://stackoverflow.com/a/16335923/1677824
score: 0

http://stackoverflow.com/q/26000648
tagged with: java
has answer: http://stackoverflow.com/a/26000731
has title: what is the importance of reference variable type?
type: Question
score: 0
has answer: http://stackoverflow.com/a/26000730
has body: Dog dogObj = new Dog(); Yes I know that we have to give the suitable type to the reference variable so it can reserve a place for the object's location address or whatever we put in it. The reference variable stores a 8 byte address(number) of the real object located in the heap of register. So it's job is just to hold the address of that location. Why does it need a type then? What changes on this 8 byte after giving it a type. It still could point with it 8 byte data to that location even if it has no type. What is the details behind this?
answer count: 3
accepted answer: http://stackoverflow.com/a/26000730
possible better answer: http://stackoverflow.com/a/26000683
has answer: http://stackoverflow.com/a/26000683
type: AnsweredQuestion

http://stackoverflow.com/comment/52827680
score: 0
type: Comment
type: QuestionComment
has text: @HussainAkhtarWahid'Ghouri' That's a different language entirely...
comment on: http://stackoverflow.com/q/25909039

http://stackoverflow.com/q/26004889
has body: i have a little missbehaviour in my program. One of his methods should build an string and then return it to be displayed in an Java Swing GUI. In some parts of it, it needs to store a "line break" (i dont know the proper name) "/n". But when i display this string in the gui it contains /n instead of jumping the line properly. Its a little confusing but with the code i think you can figure it out: public String draw(Robot robot, MapClass mapa) { map = mapa.getMapa(); String mapBuffer = ""; for (int i = 0; i &lt; mapa.getLinhas(); i++) { for (int j = 0; j &lt; mapa.getColunas(); j++) { if ((i == robot.getPosX()) &amp; (j == robot.getPosY())){ System.out.print(robot.convertToChar() + " "); mapBuffer = mapBuffer + robot.convertToChar() + " "; } else{ System.out.print(map[i][j] + " "); mapBuffer = mapBuffer + map[i][j] + " "; } } mapBuffer = mapBuffer + "/n"; System.out.println(); } return mapBuffer; } This string is shown in a swing textArea with: textArea.append(drawer.draw(robot, map)); Thanks.
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40727169
tagged with: string
has comment: http://stackoverflow.com/comment/40726979
favorite count: 0
has title: Storage of /n in String object. Java
has answer: http://stackoverflow.com/a/26005049
linked to: http://stackoverflow.com/q/207947
has comment: http://stackoverflow.com/comment/40726948
type: AnsweredQuestion
tagged with: java
tagged with: swing
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26005049
has comment: http://stackoverflow.com/comment/40727049
score: -1

http://stackoverflow.com/q/25966715
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25966743
type: UnansweredQuestion
has title: how to acces other class method in java
tagged with: java
has comment: http://stackoverflow.com/comment/40657131
tagged with: methods
downvote count: 1
has comment: http://stackoverflow.com/comment/40657241
type: Question
tagged with: class
score: 0
has body: I have two classes: class actUI public class ActUI extends javax.swing.JFrame{ //there are the other classes here private static void writeToFile(java.util.List list, String path) { BufferedWriter out = null; try { File file = new File(path); out = new BufferedWriter(new FileWriter(file, true)); for (Object s : list) { out.write((String) s); out.newLine(); } out.close(); } catch (IOException e) { } UniqueLineReader ULR = new UniqueLineReader(); ULR.setFileName(path); } //there are the other classes here } Class UniqueLineReader: public class UniqueLineReader extends BufferedReader { Set&lt;String&gt; lines = new HashSet&lt;String&gt;(); private Reader arg0; public UniqueLineReader(Reader arg0) { super(arg0); } @Override public String readLine() throws IOException { String uniqueLine; while (lines.add(uniqueLine = super.readLine()) == false); //read until encountering a unique line return uniqueLine; } public void setFileName(String filePath){ try { // Open the file that is the first // command line parameter FileInputStream fstream = new FileInputStream("test.txt"); UniqueLineReader br = new UniqueLineReader(new InputStreamReader(fstream)); String strLine; // Read File Line By Line PrintWriter outFile2 = new PrintWriter(new File("result.txt")); String result = ""; List data = new ArrayList(); while ((strLine = br.readLine()) != null) { // Print the content on the console System.out.println(strLine); data.add(strLine); } writeToFile(data, "result.txt"); // Close the input stream //in.close(); } catch (Exception e) {// Catch exception if any System.err.println("Error: " + e.getMessage()); } } } I want to acces UniqueLineReader from writeToFile method in actUI, but my code is not working, how can i do that with no error?, help me please.

http://stackoverflow.com/a/26016737
has body: Check Spring profiles. You don't need to disable auto wiring, you need to inject different beans for different configuration.
has comment: http://stackoverflow.com/comment/40749152
has comment: http://stackoverflow.com/comment/40748806
score: 4
has comment: http://stackoverflow.com/comment/40749362
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/40748266
has comment: http://stackoverflow.com/comment/40748077
upvote count: 5
has comment: http://stackoverflow.com/comment/40749042
has comment: http://stackoverflow.com/comment/40748313
answers question: http://stackoverflow.com/q/26016311

http://stackoverflow.com/a/25881642
score: 0
has body: You need to declear the j var outside the loop. In you code the j var is assigning every time. So increment is interrupting. It should be int j = 1; for (int i = 0; i &lt; ary1.length; i++) { System.out.println("Enter integer #"+ j++ +":" ); ary1[i] = elementValue.nextInt(); }
answers question: http://stackoverflow.com/q/25881597
type: Answer

http://stackoverflow.com/a/25910894
downvote count: 0
has body: Java does not come with a preprocessor, however there are some out there such as http://code.google.com/p/pre-processor-java/. It is also possible to use C's preprocessor. However in general it is frowned upon in Java, the creators of Java purposefully left it out of the language.
answers question: http://stackoverflow.com/q/25910727
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/40572433
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25918416
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61510/discussion-between-sol4me-and-aaditya-bagga).
score: 0

http://stackoverflow.com/comment/40563806
has text: Large objects can linger around so reusing might be better. The fact that it occurs while reading doesn't mean it is because of the reading. Your memory is filling up and the large `StringBuffer` would be my first to fix. Another note is that you are using `StringBuffer` but still are using String concat to add Strings. I suggest removing the `+ ";"` from your case statement and add a `data.append(';')` after the case statements. Saves creating additional String for concat.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25912394
type: QuestionComment

http://stackoverflow.com/q/25929692
has answer: http://stackoverflow.com/a/27222467
tagged with: java
has title: Java - ArrayList not using formal type parameter for its instance field "elementData "
possible better answer: http://stackoverflow.com/a/25929832
has answer: http://stackoverflow.com/a/25929832
accepted answer: http://stackoverflow.com/a/27222467
type: AnsweredQuestion
score: 3
downvote count: 0
has body: ArrayList chose to just use a reference type of Object in its instance variable elementData. Using Object as its reference type would require explicit cast in getting the correct instance type of its elements. What's the difference if it just used type parameter in declaring said instance field? By that, I think it could eliminate the need for suppressing unchecked explicit cast. // From Java API: public E get(int index) { rangeCheck(index); return elementData(index); } @SuppressWarnings("unchecked") E elementData(int index) { return (E) elementData[index]; } could have been like this? private transient E[] elementData; public E get(int index) { rangeCheck(index); return elementData[index]; } Please share your thoughts. Cheers!
favorite count: 0
type: Question
answer count: 2
upvote count: 3

http://stackoverflow.com/q/26013411
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40910035
has answer: http://stackoverflow.com/a/26013627
score: 0
has comment: http://stackoverflow.com/comment/40755685
answer count: 1
has comment: http://stackoverflow.com/comment/40741968
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/40929690
type: UnansweredQuestion
has title: Java Game - Making the Enemy move on X,Y Point using Threads
has comment: http://stackoverflow.com/comment/40779313
linked to: http://stackoverflow.com/q/13226164
has body: Good Day all. I have the following Declarations and assignments and would like to know how i make my Image (A JLabel which has an Icon - The Enemy Unit) Move. The Label is called Enemy. I have implemented The Runnable and my code below - the switch Cases are situated in the overriden Run() method. Please also indicate PRECISELY where you place/run each method/instance/Thread. I will later implement multiple separate threads to do simultaneous actions, but 1st I need this cleared out. This is developed on Windows - Net beans for a windows project - Not for a handheld device static Point EnemyLocation; // This throws an error - Might it be due to putting an implementable // overridden method in a thread? Thread moveTheEnemy = new Thread(run()); public Window() { initComponents(); EnemyLocation = new Point( (int)(Enemy.getLocation().getX() + Enemy.getWidth()/2 - 7), (int)(Enemy.getLocation().getY() - 3 + Enemy.getHeight()/2) ); } // How do i go about running this run method in that thread? // And Can i Run it on a button click? Simply indicating // ThreadName.start in the Button wont start the actions. @Override public void run(){ boolean stop = false; // A Method is to be added here to flag for when the stop // will change... Dont worry about this part... I need // the Cases below to work. while (stop == false) { for (int i = 0; i &lt; 1; i++) { Random rand = new Random(); int a = rand.nextInt(4); switch (a) { case 0: EnemyLocation.setLocation( EnemyLocation.x + 4, EnemyLocation.y); break; case 1: EnemyLocation.setLocation( EnemyLocation.x - 4, EnemyLocation.y); break; case 2: EnemyLocation.setLocation( EnemyLocation.x, EnemyLocation.y + 4); break; case 3: EnemyLocation.setLocation( EnemyLocation.x, EnemyLocation.y - 4); break; default: EnemyLocation.setLocation( EnemyLocation.y + 4, EnemyLocation.y); //It comes down to this Exception Each time... throw new AssertionError("Failure to attempt Move"); } } } }
tagged with: multithreading

methods
tags question: http://stackoverflow.com/q/25903261
tags question: http://stackoverflow.com/q/25944300
tags question: http://stackoverflow.com/q/25964382
tags question: http://stackoverflow.com/q/25900130
tags question: http://stackoverflow.com/q/25875769
tags question: http://stackoverflow.com/q/25996243
tags question: http://stackoverflow.com/q/25898395
tags question: http://stackoverflow.com/q/26001386
tags question: http://stackoverflow.com/q/25902289
tag name: methods
tags question: http://stackoverflow.com/q/26026836
tags question: http://stackoverflow.com/q/26007668
tags question: http://stackoverflow.com/q/25954856
tags question: http://stackoverflow.com/q/25985512
tags question: http://stackoverflow.com/q/26004555
tags question: http://stackoverflow.com/q/25980377
tags question: http://stackoverflow.com/q/26006827
tags question: http://stackoverflow.com/q/25944044
tags question: http://stackoverflow.com/q/26020036
type: Tag
tags question: http://stackoverflow.com/q/25986177
tags question: http://stackoverflow.com/q/25989744
tags question: http://stackoverflow.com/q/25902538
tags question: http://stackoverflow.com/q/25881899
tags question: http://stackoverflow.com/q/25916265
tags question: http://stackoverflow.com/q/25880893
tags question: http://stackoverflow.com/q/25977102
tags question: http://stackoverflow.com/q/25982929
tags question: http://stackoverflow.com/q/25955669
tags question: http://stackoverflow.com/q/25926606
tags question: http://stackoverflow.com/q/26011305
tags question: http://stackoverflow.com/q/25979298
tags question: http://stackoverflow.com/q/25937558
tags question: http://stackoverflow.com/q/26017460
tags question: http://stackoverflow.com/q/25979034
tags question: http://stackoverflow.com/q/26031391
tags question: http://stackoverflow.com/q/25966715
tags question: http://stackoverflow.com/q/25886545
tags question: http://stackoverflow.com/q/25926844
tags question: http://stackoverflow.com/q/25926718
tags question: http://stackoverflow.com/q/25990229
tags question: http://stackoverflow.com/q/26004588
tags question: http://stackoverflow.com/q/25989422
tags question: http://stackoverflow.com/q/26027946
tags question: http://stackoverflow.com/q/25982237

http://stackoverflow.com/q/25979128
answer count: 0
downvote count: 0
type: UnansweredQuestion
has title: Nullpointer exception on initialized array
duplicate of: http://stackoverflow.com/q/24698684
tagged with: nullpointerexception
type: Question
has comment: http://stackoverflow.com/comment/40679852
has body: I created a class called IntegerSet which is basically just an array of Booleans. I have declared and initialized all the Boolean values to be false. When I try to use my insertion function, I get a null pointer exception, which is odd because in my constructor I initialize all the booleans to false, so there should be no null values. Here is the relevant code: class IntegerSet { private final static int size = 101; private Boolean[] myArray; IntegerSet(){ Boolean[] myArray = new Boolean[size]; for(int i = 0; i&lt;size; i++){ myArray[i] = new Boolean(false); } } public IntegerSet insertElement(int data){ this.myArray[data] = true; return this; } } And the main that calls the object's relevant code: public class HW2Tester { public static void main(String[] args) { IntegerSet set1 = new IntegerSet(); IntegerSet set2 = new IntegerSet(); set1.insertElement(0); } }
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40679787
tagged with: java
score: 2
linked to: http://stackoverflow.com/q/24698684

http://stackoverflow.com/comment/40629999
comment on: http://stackoverflow.com/a/25952119
has text: @HovercraftFullOfEels Do you mean those methods in the Customer class?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26018333
tagged with: android-button
has title: Button touch listener blocking custom scrollview touch event listener
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
tagged with: java
tagged with: android-scrollview
upvote count: 1
type: Question
has body: I have a custom diagonal scrollview like this public class Vscroll extends ScrollView { public Vscroll(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public Vscroll(Context context, AttributeSet attrs) { super(context, attrs); } public Vscroll(Context context) { super(context); } public boolean onTouchEvent(MotionEvent ev) { return false; } } and public class Hscroll extends HorizontalScrollView { public Hscroll(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public Hscroll(Context context, AttributeSet attrs) { super(context, attrs); } public Hscroll(Context context) { super(context); } @Override public boolean onTouchEvent(MotionEvent ev) { return false; } } This is the XML &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;com.cukil.schoolfrenzy.Vscroll android:layout_height="fill_parent" android:scrollbars="none" android:layout_width="fill_parent" android:id="@+id/vScroll"&gt; &lt;com.cukil.schoolfrenzy.Hscroll android:id="@+id/hScroll" android:scrollbars="none" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/peta_container" android:background="@drawable/peta_kota" &gt; &lt;ImageView android:id="@+id/bSekolah" android:layout_width="120dp" android:layout_height="100dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="114dp" android:layout_marginTop="248dp" android:src="@drawable/tmuka1" /&gt; &lt;/RelativeLayout&gt; &lt;/com.cukil.schoolfrenzy.Hscroll&gt; &lt;/com.cukil.schoolfrenzy.Vscroll&gt; &lt;RelativeLayout android:id="@+id/dashboard" android:layout_width="fill_parent" android:layout_height="100dp" android:layout_alignParentTop="true" &gt; &lt;…
tagged with: ontouchlistener

http://stackoverflow.com/q/25924716
linked to: http://stackoverflow.com/q/25935889
tagged with: entitymanager
has answer: http://stackoverflow.com/a/25933973
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40582980
score: 2
upvote count: 2
tagged with: java
type: Question
has title: Managing Multiple Database Connections
tagged with: ejb
tagged with: database
has body: I've been struggling with this problem for days, Here is the scenario: I have several databases, one for each of my customers, all of them with the same structure(same tables and columns), so my application needs to decide at runtime with which one it needs to connect. I'm using JPA2, EclipseLink and EJB3. My first attempt was to implement a custom EntityManager with all the logic to performs the operations on the right database, then I configured this EntityManager as an Stateless EBJ in order to make it possible to inject it with the @EBJ annotation (as described at this link: http://www.hostettler.net/blog/2012/11/20/multi-tenancy/). I coundn't make it work because it was throwing an exception when trying to inject the EntityManager. So I decided to try something else, I've created EntityManagerFactory and I passed the JTA_DATASOURCE to it(after decide at runtime which one to use), so it could connect to the right database. Here is the code: @Stateless @TransactionManagement(TransactionManagementType.CONTAINER) public class TestEntDAO { private EntityManager em; private EntityManagerFactory emf; @PostConstruct public void init() { em = getEntityManager(); } public EntityManager getEntityManager() { Map props = new HashMap(); props.put(PersistenceUnitProperties.TRANSACTION_TYPE, "JTA"); props.put(PersistenceUnitProperties.JTA_DATASOURCE, dataSourceName()); emf = Persistence.createEntityManagerFactory("testePU", props); em = emf.createEntityManager(); return em; } public String dataSourceName(){ if(someCondition){ return "db1"; }else{ return "db2"; } } } This worked perfectly, the only problem is that the transaction is not managed by the container, so I had to explicitly mark the transaction's boundaries(call begin() and commit()). I could just use the @PersistenceContext annotation to make it work, but then I wouldn't have the EntityManagerFactory to pass the datasource. Does anyone know of a way to use the Container-Managed Transactions(CMT) and still be able to…
has comment: http://stackoverflow.com/comment/40582892
tagged with: eclipselink
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/40654689
type: AnswerComment
comment on: http://stackoverflow.com/a/25965324
type: Comment
has text: @IvnBubrov Three Options. 1. Use an `ArrayList<Integer>` to dynamically get it in one pass, or 2. Use two passes and count the number of elements in the first pass, or 3. Store the number of elements in the file.
score: 0

http://stackoverflow.com/comment/40505311
comment on: http://stackoverflow.com/q/25882094
has text: Try using the Number class's [intValue()](http://docs.oracle.com/javase/7/docs/api/java/lang/Number.html#intValue%28%29) method instead of just casting. Then you can just `== 0`.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/40631636
has text: You didn't answer my question: does it work when you only change your app id to DEFAULT_MEDIA_RECEIVER_APPLICATION_ID and no other changes?
type: AnswerComment
comment on: http://stackoverflow.com/a/25952903
type: Comment
score: 1

http://stackoverflow.com/a/26032052
downvote count: 0
has comment: http://stackoverflow.com/comment/40886408
has comment: http://stackoverflow.com/comment/40826502
upvote count: 3
answers question: http://stackoverflow.com/q/26031187
has body: Intellij IDEA is a Java application and therefore its memory is managed by JVM. Short answer is no, you cannot force JVM to free memory when you tell it to. Depending what do you want to achieve, you can change memory limits for IDEA as described here (you want to decrease it probably): https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties
has comment: http://stackoverflow.com/comment/40889983
type: Answer
score: 3

http://stackoverflow.com/comment/40530669
has text: but how would i send the data to the other class
comment on: http://stackoverflow.com/q/25876047
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40645751
score: 3
type: AnswerComment
has text: No. The code between the braces is a Groovy closure, basically just shorthand for a Java function. That code is being passed an argument. When you define your closure you can define those arguments, just like you would in a regular method declaration (example: `void times(int number)`). The syntax I used above is simply declaring my passed arguments. They can be arbitrarily named. Excluding such syntax the single argument can still be accessed via `it`. I'd suggest anyone working with Gradle to get at least a basic understanding of Groovy since a Gradle build script *is* a Groovy script.
type: Comment
comment on: http://stackoverflow.com/a/25959949

http://stackoverflow.com/comment/40672724
type: Comment
comment on: http://stackoverflow.com/a/25908715
score: 0
type: AnswerComment
has text: Mmmm was not successfull so tried 'First way'. That gives me a `NoClassDefFoundError`. Googling around it looks as if i'm not the first seeing such error. I know now your advices don't work for me out of the box. That is a pitty.

http://stackoverflow.com/comment/76468114
type: Comment
comment on: http://stackoverflow.com/a/37976317
score: 0
type: AnswerComment
has text: @wrestang:Can you send me the Intellij project ? (compressed) @ rudy@rudyvissers.com ? I am curious.

http://stackoverflow.com/q/25984367
has comment: http://stackoverflow.com/comment/40691339
has body: Attempting to send an ArrayList from java class to servlet. The returned values of ResultSet is passed on to a model object and this object is added to an ArrayList. However I need retrieve this ArrayList in vieitems.jsp. DBController.java public void getAvailableItems(String sqlst) throws Exception { Connection connection = getConnection(); Statement stm = connection.createStatement(); ResultSet rst = stm.executeQuery(sqlst); ArrayList<Item> avitems = new ArrayList<Item>(); while (rst.next()) { String itemname = rst.getString("ItemName"); String description = rst.getString("Description"); int qtyonhand = rst.getInt("QtyOnHand"); int reorderlevel = rst.getInt("ReorderLevel"); double unitprice = rst.getDouble("unitprice"); Item item = new Item(itemname, description, qtyonhand, reorderlevel, unitprice); avitems.add(item); } //i need to send avitems to ViewItems.jsp } ViewItems.jsp Item Code Item Name Description Qty On Hand Reorder Level //here i need to set the values of arraylist avitems
has answer: http://stackoverflow.com/a/25987673
has comment: http://stackoverflow.com/comment/40689964
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40690406
answer count: 2
has answer: http://stackoverflow.com/a/25994372
upvote count: 1
tagged with: jsp
has title: How to pass an ArrayList from Java class to jsp
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3608891
has comment: http://stackoverflow.com/comment/40690748
has comment: http://stackoverflow.com/comment/40690229
downvote count: 0
has comment: http://stackoverflow.com/comment/40689843
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40690290
type: Question
has comment: http://stackoverflow.com/comment/40706977

http://stackoverflow.com/q/25948218
has comment: http://stackoverflow.com/comment/40624104
tagged with: java
upvote count: 10
possible better answer: http://stackoverflow.com/a/37714036
has body: My java project has files which have same name but different cases (Test.java &amp; test.java). I have setup a case sensitive file system on my mac and am able to view/edit them via CLI. However, Intellij Idea does not regard them as different and compilation fails. How can I fix Intellij Idea to honor cases for a file name? Thanks
has answer: http://stackoverflow.com/a/26056099
answer count: 3
has answer: http://stackoverflow.com/a/37714036
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/40628831
favorite count: 0
has comment: http://stackoverflow.com/comment/40624122
has answer: http://stackoverflow.com/a/45278443
score: 9
tagged with: macos
accepted answer: http://stackoverflow.com/a/26056099
type: AnsweredQuestion
downvote count: 1
type: Question
has title: Case sensitive files in IntelliJ Idea on Mac OSX

http://stackoverflow.com/a/25897447
upvote count: 1
score: 1
has body: You must keep in mind that even if tomcat and vaadin manage multiple sessions, your server application will have only 1 instance. So if you use singletons, static methods or fields, use them with care: they should never hold session-dependant content. Try to favour stateless methods over statefull. Apart from that, there shouldn't be any problem.
accepted answer of: http://stackoverflow.com/q/25897036
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40550222
answers question: http://stackoverflow.com/q/25897036
type: Answer

http://stackoverflow.com/comment/40587074
type: Comment
has text: Not sure what you mean by "streams are not good for sorting things." The first snippet seems quite reasonable. If `neurons` is a list, the second snippet doesn't work. The `List.sort()` method sorts the list in place and returns void.
comment on: http://stackoverflow.com/a/25922264
score: 0
type: AnswerComment

http://stackoverflow.com/q/25967073
upvote count: 1
answer count: 1
downvote count: 0
has title: http request interceptor - restful web service using cxf
favorite count: 0
has answer: http://stackoverflow.com/a/25967327
tagged with: rest
has body: Trying to add headers to every request that my restful service receives. The below inbound http interceptor gets invoked, but does not add the header. package com.client.interceptors; import java.util.Collections; import java.util.List; import java.util.Map; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; public class ClientInterceptor extends AbstractPhaseInterceptor&lt;Message&gt; { public ClientInterceptor() { super(Phase.PRE_INVOKE); // Put this interceptor in this phase System.out.println("inside constructor"); } public void handleMessage(Message msg) throws Fault { // process the message System.out.println("inside interceptor"); Map&lt;String, List&gt; headers = (Map&lt;String, List&gt;) msg .get(Message.PROTOCOL_HEADERS); headers.put("token", Collections.singletonList("abcd1234xyz56sa")); msg.put(Message.PROTOCOL_HEADERS, headers); } } How can this be achieved?
tagged with: cxf
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40657895
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40657966
has comment: http://stackoverflow.com/comment/40658036
has comment: http://stackoverflow.com/comment/40658004

http://stackoverflow.com/q/25881010
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/40503502
has answer: http://stackoverflow.com/a/25881147
has comment: http://stackoverflow.com/comment/40503560
tagged with: android
has comment: http://stackoverflow.com/comment/40503523
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/25881147
type: Question
has title: Error parsing data org.json.JSONException: Value <!-- of type java.lang.String cannot be converted to JSONObject
has body: I am trying to following a tutorial get json to ListView, this app just shows Array in json. When I use the url source from this site, the app works completely but when I use local data json from my database, I always get an error. The error is Error parsing data org.json.JSONException: Value &lt;!-- of type java.lang.String cannot be converted to JSONObject and show error in line 99 and 68 This my code tes.html &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; { "android": [ { "ver": "1.5", "name": "Cupcake", "api": "API level 3" }, { "ver": "1.6", "name": "Donut", "api": "API level 4" }, { "ver": "2.0-2.1", "name": "Eclair", "api": "API level 5-7" }, { "ver": "2.2", "name": "Froyo", "api": "API level 8" }, { "ver": "2.3", "name": "Gingerbread", "api": "API level 9-10" }, { "ver": "3.0-3.2", "name": "Honeycomb", "api": "API level 11-13" }, { "ver": "4.0", "name": "Ice Cream Sandwich", "api": "API level 14-15" }, { "ver": "4.1-4.3", "name": "JellyBean", "api": "API level 16-18" }, { "ver": "4.4", "name": "KitKat", "api": "API level 19" } ] } &lt;body&gt; &lt;/html&gt; This my JSONParse class private class JSONParse extends AsyncTask&lt;String, String, JSONObject&gt; { // THIS LINE 68 ERROR private ProgressDialog pDialog; @Override protected void onPreExecute() { super.onPreExecute(); ver = (TextView) getActivity().findViewById(R.id.vers); name = (TextView) getActivity().findViewById(R.id.name); api = (TextView) getActivity().findViewById(R.id.api); //head = (TextView) getActivity().findViewById(R.id.head); //note = (TextView) getActivity().findViewById(R.id.note); pDialog = new ProgressDialog(getActivity()); pDialog.setMessage("Getting Data ..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected JSONObject doInBackground(String... args) { JSONParser jParser = new JSONParser(); // Getting JSON from URL JSONObject json = jParser.makeHttpRequestWithoutParams(url); return json; } @Override protected void onPostExecute…
score: 0

http://stackoverflow.com/q/25894559
has comment: http://stackoverflow.com/comment/40527492
has comment: http://stackoverflow.com/comment/40527527
linked to: http://stackoverflow.com/q/27244431
has comment: http://stackoverflow.com/comment/104569231
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40559444
has answer: http://stackoverflow.com/a/25894748
type: Question
score: 12
has answer: http://stackoverflow.com/a/59162404
has comment: http://stackoverflow.com/comment/40527434
upvote count: 12
downvote count: 0
has answer: http://stackoverflow.com/a/65385288
has title: How to edit, modify nested JSONObject
has comment: http://stackoverflow.com/comment/40527308
accepted answer: http://stackoverflow.com/a/26127882
possible better answer: http://stackoverflow.com/a/25894748
favorite count: 0
has answer: http://stackoverflow.com/a/26127882
has body: Could you help me with this issue please. for example I have JSONEObject { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "seeds": "12415", } } } For example, I need change "seeds":"12415" to "seeds":"555". I found some solution: JSONObject js = new JSONObject(jsonString); js.getJSONObject("glossary").getJSONObject("GlossDiv").remove("seeds"); js.getJSONObject("glossary").getJSONObject("GlossDiv").put("seeds","555"); So for editing seeds in my version I need first to get "glossary" then "GlossDiv" after I delete "seeds" and put new "seeds" with new value. Could you help me to find another way to edit? For example: just somemethod(String key,String NewValue).
has comment: http://stackoverflow.com/comment/86481272

http://stackoverflow.com/a/25904133
has comment: http://stackoverflow.com/comment/40545141
type: Answer
has comment: http://stackoverflow.com/comment/40545086
answers question: http://stackoverflow.com/q/25904123
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25904123
score: 3
upvote count: 3
type: AcceptedAnswer
has body: source is an Object and does not have an setEnabled method, so it makes no sense to the compiler to allow you to make such a call. You need to first case the instance of source to it's appropriate class type. Assuming you can guarantee that the source of the action is the button, you can use something like... ((JButton)click.getSource()).setEnabled(false); If you can't guarantee that source is JButton, but might be component of some kind, you might even be able to use something like... ((Component)click.getSource()).setEnabled(false); If you can't guarantee that, then you need to make appropriate checks (which you should do anyway)... Object source = click.getSource(); if (source instanceof JButton) { ((JButton)source).setEnabled(false); } This concept is an example of Polymorphism, where one instance of an Object can act like one it's parents

http://stackoverflow.com/comment/40540127
type: Comment
has text: Sorry but I get the solution from him he explain how to do it in java I have to be fair I apologies again sorry
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25885056

http://stackoverflow.com/comment/40593892
score: 0
comment on: http://stackoverflow.com/q/25929682
type: Comment
type: QuestionComment
has text: Thank you very much that was it. I didn't saw that one.

http://stackoverflow.com/a/64287825
has body: This could be donw with very simple if...else. public static void main(String... args) { int[] one = { 1, 2, 3 }; int[] two = { 44, 55, 66, 77, 88 }; System.out.println(Arrays.toString(alternate(one, two))); } public static int[] alternate(int[] one, int[] two) { int[] res = new int[one.length + two.length]; for (int i = 0, j = 0, k = 0; i &lt; res.length; i++) { if (i % 2 == 0) res[i] = j &lt; one.length ? one[j++] : two[k++]; else res[i] = k &lt; two.length ? two[k++] : one[j++]; } return res; } Output: [1, 44, 2, 55, 3, 66, 77, 88]
score: 0
answers question: http://stackoverflow.com/q/25954495
type: Answer

http://stackoverflow.com/comment/40772160
type: Comment
has text: So I put this in case 'a': vowelsAndConsonantsClass str1 = new vowelsAndConsonantsClass(); and now it says my constructor is undefined. I'm newer to this so I'm pretty confused as to where I'm messing up.
type: AnswerComment
comment on: http://stackoverflow.com/a/26029661
score: 0

bufferunderflowexception
type: Tag
tag name: bufferunderflowexception
tags question: http://stackoverflow.com/q/25947680

http://stackoverflow.com/q/25938052
tagged with: java
possible better answer: http://stackoverflow.com/a/25938154
has answer: http://stackoverflow.com/a/25938154
answer count: 2
has comment: http://stackoverflow.com/comment/40606729
has comment: http://stackoverflow.com/comment/40607408
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25938132
has title: Java distance between two points of an array?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40606657
score: 1
has body: So this is an unique question and I would appreciate any help. The objective: To count and return an integer of 'distance' from min value to max value. The list is not sorted and should not be sorted. Min value might be before max or vise-verse. In a list of { 2, -5, -7, 8, 22, -10 } answer = 1 (the distance from -10 to 22) In a list of { 2, -5, -7, 8, 22, -6 } answer = 2 (the distance from -7 to 22) Thank you for any help.
accepted answer: http://stackoverflow.com/a/25938132
upvote count: 1
has comment: http://stackoverflow.com/comment/40606659
type: Question

http://stackoverflow.com/comment/40739582
has text: Ya now i need to know how to prompt for a workspace location during start up and create a instance of the application @greg-449
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26009383
score: 0

http://stackoverflow.com/q/26012103
score: 0
accepted answer: http://stackoverflow.com/a/26017682
answer count: 1
tagged with: ehcache
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26017682
tagged with: java
tagged with: hibernate
tagged with: caching
type: Question
has title: Internal representation of custom user types in Hibernate's 2nd level cache
has body: Hibernate stores entities in a dehydrated form in its 2nd level cache. This works fine for me until custom user types enter the scene, particulary Jadira's UserType library, which I use to map Joda time types. Persistence works fine out of the box, but I've discovered that Hibernate will put a "raw" (serialized) reference to a LocalDate instance into its 2nd level cache, which causes some problems, because each LocalDate instance keeps tons of references to internal datastructures, which should not turn up in the cache. Is there a way to hook into Hibernate's (de-)hydration strategy to get fine grain control over which data will eventually be stored in it's 2nd level cache?
linked to: http://stackoverflow.com/q/25869959

http://stackoverflow.com/q/25919473
type: Question
tagged with: java
has body: I am using POI 3.9 and SXSSF to create spreadsheets. When there are a small number of rows, creating hyperlinks works. However, as the size grows the processing time greatly increases and the links do not work. It works for 700 rows but not 70,000. When trying to open the file, this error occurs: Excel found unreadable content in 'out.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes. public static void main(String[] args) throws Throwable { Workbook wb = new SXSSFWorkbook(100); // keep 100 rows in memory, exceeding rows will be flushed to disk Sheet sh = wb.createSheet(); for(int rownum = 0; rownum &lt; 70000; rownum++){ Row row = sh.createRow(rownum); for(int cellnum = 0; cellnum &lt; 10; cellnum++){ Cell cell = row.createCell(cellnum); String address = new CellReference(cell).formatAsString(); cell.setCellValue(address); if (address.contains("A")) setHyperlink(cell, address); } } FileOutputStream out = new FileOutputStream("C:/temp/sxssf.xlsx"); wb.write(out); out.close(); } protected static void setHyperlink(Cell cell, String address) { Workbook workbook = cell.getSheet().getWorkbook(); Hyperlink hyperlink = workbook.getCreationHelper() .createHyperlink(Hyperlink.LINK_URL); String encoded = null; try { encoded = URLEncoder.encode(address, "UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } hyperlink.setAddress(encoded); cell.setHyperlink(hyperlink); }
has answer: http://stackoverflow.com/a/25967948
answer count: 1
downvote count: 0
favorite count: 0
has title: Why do hyperlinks stop working when writing large spreadsheets with POI?
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25967948
tagged with: apache-poi
upvote count: 2

http://stackoverflow.com/comment/40567464
type: Comment
comment on: http://stackoverflow.com/a/25887649
score: 1
has text: As far as I can tell, you'd be better off using something else in this scenario. Volley is explicitly async and multi-threaded, so in your case, A, B, and C would be expected to run in parallel with Volley.
type: AnswerComment

http://stackoverflow.com/a/26008009
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26007835
has comment: http://stackoverflow.com/comment/40733544
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40732738
downvote count: 0
has comment: http://stackoverflow.com/comment/40733401
has comment: http://stackoverflow.com/comment/40732767
has body: First things first, you should not declare generic objects with raw types, add a type to your ArrayList: List&lt;Integer&gt; binary = new ArrayList&lt;Integer&gt;(); Since it isn't directly related to your question, you can read why you should do this here Now, so since your list holds individual binary digits, what you can do is use a StringBuilder to build 8-bit binary strings from it. You can also use a StringBuilder to build the converted hex value. Each time you build this 8-bit string, you convert it to it to hex (actually first to decimal and then to hex) and append it to the StringBuilder then builds the hex string. Here is the code: // ... your program StringBuilder hexString = new StringBuilder(); StringBuilder eightBits = new StringBuilder(); for(int i = 0; i &lt; binary.size(); i += 8) { for(int j = i; j &lt; (i + 8) &amp;&amp; j &lt; binary.size(); j++) { // read next 8 bits or whatever bits are remaining eightBits.append(binary.get(j)); // build 8 bit value } int decimal = Integer.parseInt(eightBits.toString(), 2); // get decimal value hexString.append(Integer.toHexString(decimal) + " "); // add hex value to the hex string and a space for readability eightBits.setLength(0); // reset so we can append the new 8 bits } System.out.println(hexString.toString()); // prints "5 43 9d" for the value you gave Note: this program is a continuation of your program
type: Answer
has comment: http://stackoverflow.com/comment/40733520
has comment: http://stackoverflow.com/comment/40733429
accepted answer of: http://stackoverflow.com/q/26007835

http://stackoverflow.com/q/25890430
tagged with: android-volley
has answer: http://stackoverflow.com/a/41360796
has title: volley response time
tagged with: android
linked to: http://stackoverflow.com/q/21378280
has answer: http://stackoverflow.com/a/25891188
upvote count: 3
type: UnansweredQuestion
has body: I have some question about volley How can i get connection response time with volley library? Have a solution for it? can i use timer for getting the response time?how? And also have a method for execute before connection in volley ? my code like this: final String URL = "http://domain.com/conn.php"; StringRequest req = new StringRequest(URL, new Response.Listener&lt;String&gt;() { @Override public void onResponse(String response) { startActivity(new intent(SplashActivity.this,MainActivity.class)); finish(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if(RRequestErrorHelper.getMessage(error) == null || RRequestErrorHelper.getMessage(error).isEmpty()) { } zLog.error(RRequestErrorHelper.getMessage(error)); } }); zRequestHelper.getInstance().addToRequestQueue(req,"TAG");
score: 3
tagged with: java
linked to: http://stackoverflow.com/q/22540120
type: Question
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40568523
has text: You shouldn't be testing the method String#contains(). To test that is to basically test that Java is not broken. You had better expect that Java Strings are not broken.
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25915683

http://stackoverflow.com/q/25915485
has comment: http://stackoverflow.com/comment/40621327
score: -1
has title: My application crashes in production environment but work fine at development environment
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40623007
tagged with: jvm-crash
has comment: http://stackoverflow.com/comment/40657848
has body: I have a problem in production environment. My application start and restart after about 4 minutes. My application work fine in development environment and only in production environment its behavior it. Log of jvm when it crashes as following: # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00002aaaabca5e20, pid=29682, tid=46914145687872 # # JRE version: 6.0_26-b03 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.1-b02 mixed mode linux-amd64 compressed oops) # Problematic frame: # J com.tosan.sipa.security.jceadapter.JCESMAdapter.d([B[B)[B # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # --------------- T H R E A D --------------- Current thread (0x00002aaabef69800): JavaThread "PooledThread-98-running" daemon [_thread_in_Java, id=417, stack(0x00002aab0ced1000,0x00002aab0cfd2000)] siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x00000000b05bccf8 Registers: RAX=0x00000007b05bcd10, RBX=0x00000000b05bcce6, RCX=0x0000000000000002, RDX=0x0000000000000008 RSP=0x00002aab0cfcf580, RBP=0x000000000000000a, RSI=0x0000000000000007, RDI=0x0000000000000001 R8 =0x0000000000000053, R9 =0x0000000000000009, R10=0x0000000000000002, R11=0x0000000000000007 R12=0x0000000000000000, R13=0x00000007b0000510, R14=0x0000000000000010, R15=0x00002aaabef69800 RIP=0x00002aaaabca5e20, EFLAGS=0x0000000000010206, CSGSFS=0x0000000000000033, ERR=0x0000000000000004 TRAPNO=0x000000000000000e Top of Stack: (sp=0x00002aab0cfcf580) 0x00002aab0cfcf580: 0000000700000007 00000007b05bccf0 0x00002aab0cfcf590: 00000006fe19e4ac 00002aab0cfcf5f0 0x00002aab0cfcf5a0: 00000006fe1a3710 00000006ff05fcb8 Instructions: (pc=0x00002aaaabca5e20) 0x00002aaaabca5e00: 48 8b 34 24 4c 63 d1 47 0f be 4c 15 10 45 85 c9 0x00002aaaabca5e10: 0f 8c 4f 01 00 00 47 0f b6 4c 15 10 41 83 e1 0f 0x00002aaaabca5e20: 42 0f be 54 13 10 85 d2 0f 8c 47 01 00 00 42 0f 0x00002aaaabca5e30: b6 54 13 10 83 e2 0f 8b f9 …
has comment: http://stackoverflow.com/comment/40621652
has comment: http://stackoverflow.com/comment/40565591
upvote count: 0
has answer: http://stackoverflow.com/a/25915857
answer count: 1
tagged with: jvm
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26002738
has comment: http://stackoverflow.com/comment/40722807
upvote count: 2
has comment: http://stackoverflow.com/comment/40723426
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40723112
downvote count: 2
has comment: http://stackoverflow.com/comment/40722798
has body: I have a string array and I have an object called ship1 that is in an if statement which is inside an onItemClickListener. I want one of the objects values(addSpend) displayed in one of the strings in the array but for some reason the string array does not recognize or see ship1. How do i fix that? (I want the add Spend value displayed next to "Ranger Ship") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hangar); String[] ship = {"Scout Ship", "Ranger Ship" , "Gun Ship MK.1", "Conquerer Ship", "Gun Ship MK.2", "Tank Ship", "Battle Ship MK.1", "Titan Ship", "Battle Ship MK.2", "Colossal Titan Ship"}; ListView hangarList = (ListView) findViewById(R.id.hangarList); ListAdapter adapter = new HangarAdapter(this, ship); hangarList.setAdapter(adapter); hangarList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick (AdapterView &lt; ? &gt; adapterView, View view,int position, long l){ Intent sendListEvents = new Intent(); if (position == 0) { Ship ship1 = new Ship(); ship1.setAddAmount(50); ship1.setAddTime(5000); ship1.setAddSpend(1000); ship1.shipAdd(); }
tagged with: java
has comment: http://stackoverflow.com/comment/40722838
type: Question
has comment: http://stackoverflow.com/comment/40723338
answer count: 1
has title: String array is not recognizing a value of an object and the object itself
favorite count: 0
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40723214
has comment: http://stackoverflow.com/comment/40723194
has answer: http://stackoverflow.com/a/26003029
has comment: http://stackoverflow.com/comment/40723203

http://stackoverflow.com/comment/40742627
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26013412
has text: @Jaydee: Yes, i know that i have an option to populate only selective data based upon the value selected in dropdown. What I wish to know is that what is the better approach. To load data at once or to have multiple hits to server (Ajax) and load data there.
type: QuestionComment

http://stackoverflow.com/a/25975784
has comment: http://stackoverflow.com/comment/40703798
has body: I'd say you're up to a pretty wild thing. If your only problem is the date type used, you may try to customize the JAXB part (wsimport, whatever) to use Date instead of the XMLGregorianCalender. Heres's a link about that. Next, you may want to consider to use something like Dozer to map between beans instead of remarshalling. This might be a very superficial opinion, but from what I read the approach does not seem right to me. You mention wsimport/JAXB, XStream and an own tool in one question. That does not feel right for me.
has comment: http://stackoverflow.com/comment/40703904
accepted answer of: http://stackoverflow.com/q/25969655
answers question: http://stackoverflow.com/q/25969655
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40700096
type: Answer

http://stackoverflow.com/q/25889241
tagged with: java
accepted answer: http://stackoverflow.com/a/25918227
type: Question
answer count: 1
tagged with: amazon-web-services
score: 0
has body: I've got a dynamodb table with a timestamp ("creationDate") as a range. The model is using a joda DateTime to make it easy to use (compatibility with the rest of the code). To be able to make between queries on this range, I used a numeric type for the attribute in the table, and planned to store it as a java timestamp (milliseconds since epoch). Then, I added a marshaller to convert a joda DateTime to a String representing a long and vice-versa. The table structure (creation): void CreateTable() { CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(LinkManager.TABLE_NAME); ProvisionedThroughput pt = new ProvisionedThroughput() .withReadCapacityUnits(LinkManager.READ_CAPACITY_UNITS) .withWriteCapacityUnits(LinkManager.WRITE_CAPACITY_UNITS); createTableRequest.setProvisionedThroughput(pt); ArrayList&lt;AttributeDefinition&gt; ad = new ArrayList&lt;AttributeDefinition&gt;(); ad.add(new AttributeDefinition().withAttributeName("creationDate").withAttributeType(ScalarAttributeType.N)); ad.add(new AttributeDefinition().withAttributeName("contentHash").withAttributeType(ScalarAttributeType.S)); createTableRequest.setAttributeDefinitions(ad); ArrayList&lt;KeySchemaElement&gt; ks = new ArrayList&lt;KeySchemaElement&gt;(); ks.add(new KeySchemaElement().withAttributeName("contentHash").withKeyType(KeyType.HASH)); ks.add(new KeySchemaElement().withAttributeName("creationDate").withKeyType(KeyType.RANGE)); createTableRequest.setKeySchema(ks); this.kernel.DDB.createTable(createTableRequest); } The model: @DynamoDBTable(tableName="Link") public class Link { private String ContentHash; private DateTime CreationDate; @DynamoDBHashKey(attributeName = "contentHash") public String getContentHash() { return ContentHash; } public void setContentHash(String contentHash) { ContentHash = contentHash; } @DynamoDBRangeKey(attributeName = "creationDate") @DynamoDBMarshalling(marshallerClass = DateTimeMarshaller.class) public DateTime getCreationDate() { return Creati…
tagged with: datetime
has answer: http://stackoverflow.com/a/25918227
has title: Using joda DateTime Range Key with AWS DynamoDB Object Persistence model
tagged with: amazon-dynamodb
tagged with: object-persistence
type: AnsweredQuestion

http://stackoverflow.com/a/66018522
answers question: http://stackoverflow.com/q/25915490
type: Answer
score: 0
has body: so if you need to test some method on string then best way is use reflection method to assign value to your string variable. I used apache common library for it FieldUtils.writeField(yourClass, "variableName", "value", true);

http://stackoverflow.com/q/25962531
tagged with: opera
has title: Java program works when browser is Safari but not Opera/Firefox/Chrome
score: -1
tagged with: google-chrome
downvote count: 1
accepted answer: http://stackoverflow.com/a/25964200
has comment: http://stackoverflow.com/comment/40651719
answer count: 1
tagged with: safari
has body: I have a simple Java program that includes a robot which clicks things inside of a browser based on pixel location. It works on Safari, but not on Opera. Why is this? Is it because of the Java version I have? Is it because Opera is a 32-bit browser? Could somebody explain to me how to allow the Java program to run when my browser is Opera? For reference: http://help.opera.com/opera/Mac/1558/en/index.html (See bottom where it discusses why Java may not be working.) EDIT: I'm running a Mac OS X 64-bit machine. EDIT: I even restored to Java SE 6. EDIT: I even switched to Firefox, a 64-bit browser, but the java program still won't work. Any idea anybody?
tagged with: java
type: AnsweredQuestion
upvote count: 0
tagged with: firefox
favorite count: 0
has answer: http://stackoverflow.com/a/25964200
type: Question

http://stackoverflow.com/q/25998312
answer count: 3
has answer: http://stackoverflow.com/a/25998479
has answer: http://stackoverflow.com/a/26004954
has comment: http://stackoverflow.com/comment/40714710
has body: I'm currently trying to justify the removal of the rule in findbugs/sonar that classifies making a class serializable, or in most of our cases, extending our base class that makes the classes serializable without the dev realising, then not defining a SerialVersionUID a critical error! This of course makes our muggle management (read management that are not developers) panic, thinking we have critical bugs that must be fixed! My argument is that in the current versions of Java, you do not need to provide a SerialVersionUID as the JVM will do that for you in cases where you serialize a class, but can anybody point any reasons why in todays day and age we should still provide a UID ourselves rather than leave it to the JVM? Looking on the web, the only reasoning I can really find for providing a UID nowadays is that not doing it is 'bad practice'. Any ideas?
tagged with: serialization
type: UnansweredQuestion
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/285793
type: Question
has comment: http://stackoverflow.com/comment/40725794
has title: Serialization - Manually defining a SerialVersionUID required?
duplicate of: http://stackoverflow.com/q/285793
tagged with: sonarqube
has comment: http://stackoverflow.com/comment/40714904
has comment: http://stackoverflow.com/comment/40714740
has answer: http://stackoverflow.com/a/25998749

http://stackoverflow.com/comment/40617870
has text: @dovy (2) OP code is correct. In each iteration new StringBuilder is created so we don't add new characters to existing string, but we are actually creating new string which will replace old values with new ones. Using `replace` on original string will cause problems because we will first replace `0` with `01`, but then when we will try to replace `1` with `10` we will also replace newly added `1` (the one from replacing `0`), which is not what we want.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25944053

http://stackoverflow.com/q/25907991
has answer: http://stackoverflow.com/a/25908185
answer count: 3
favorite count: 0
has title: Why should one create List<Object>
score: 0
has comment: http://stackoverflow.com/comment/40551817
has body: I have seen it in some frameworks and tools when there is a generic List&lt;Object&gt;. What is the point of creating List that's type is Object? Is it obsolete or is there a reason behind it? EDIT Yes, IDE might display warning, but you can add SuppressWarning, because in my opinion it is misleading when you use generics for Object type
tagged with: generics
accepted answer: http://stackoverflow.com/a/25908185
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25908135
tagged with: java
possible better answer: http://stackoverflow.com/a/25908028
has answer: http://stackoverflow.com/a/25908028
has comment: http://stackoverflow.com/comment/40551840
has comment: http://stackoverflow.com/comment/40551896
type: Question

http://stackoverflow.com/comment/40722583
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25995760
has text: That just means that every downstream test now needs boilerplate.
score: 0

http://stackoverflow.com/a/25998702
answers question: http://stackoverflow.com/q/25998400
score: 0
has body: Given #smallBricks #largeBricks X Find sb &lt;= smallBricks, lb &lt;= largeBricks such that X == sb * 1 + lb * 5; How would you do that in reality? start using as much of the large bricks as possible (because you are evidently lazy too) fill out the rest with small bricks int lb = 0; int sb = 0; int builtLength = 0; while (built has room for a large brick) { add a large brick } while (built has room for a small brick) { add a small brick } And then use math. For instance how many large bricks can you use at most? Integer division: 17 / 5 = 3 Integer modulus: 17 % 5 = 2 3 * 5 + 2 = 17
type: Answer

http://stackoverflow.com/a/25959496
has body: This may not solve your problem, but improves your code... As first user input you are expecting an integer. You are parsing the String returned by br.readLine() and do not take care of the NumberFormatException parseInt(...) may throw. Just imagine someone hits space or return key as first input. So I propose to put a try-catch-block around the parseInt(...). Here is an example how this may look like.
answers question: http://stackoverflow.com/q/25959246
score: 0
type: Answer

http://stackoverflow.com/a/26085738
accepted answer of: http://stackoverflow.com/q/25916595
has body: I finally realized why. When I changed layout width, it correspondingly scaled the image. But it didn't change layout height. I should make paramseyes.height = ... (In my situation it is layoutHeight/8;) So, the problem is solved.
answers question: http://stackoverflow.com/q/25916595
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/25995675
score: 1
answers question: http://stackoverflow.com/q/25995082
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25995082
has body: Hiding here means making the client of your code independent of the underlying implementation. Interfaces specify what you can do. Implementations specify how to do it. As How tos improve/change with time, the client (another piece of code) using interfaces continues to work without modification. The client still gets what it wants, but probably in a more efficient manner now. Abstraction is a style of programming aimed at easing the lives of programmers and consumers. It has nothing to do with hiding the source code from others. There are probably other ways to do it.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/25987349
answer count: 6
has answer: http://stackoverflow.com/a/25987505
has body: Here am finding the middle letter of each element of the array and making it upper case and merge it so that it'll give me a result like e:g- {bOy, inDia, apPle} Following is the code am trying till now. public class FindMiddle { public static void main(String[] args) { ArrayList&lt;String&gt; al = new ArrayList&lt;String&gt;(); al.add("boy india apple"); String str[] = al.toArray(new String[al.size()]); String newar[]; String delimiter = " "; newar = str[0].split(delimiter); for (int i = 0; i &lt; newar.length; i++) { char[] c = newar[i].toCharArray(); for (int j = 0; j &lt; c.length; j++) { if (j == c.length / 2) { c[j] = Character.toUpperCase(c[c.length / 2]); System.out.println(c[j]); } newar[i] += c[j]; } } } } It's only giving me O D P. I want them merged with the original elements like bOy inDia apPle.
has comment: http://stackoverflow.com/comment/40695082
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25987546
has answer: http://stackoverflow.com/a/25987516
upvote count: 0
has comment: http://stackoverflow.com/comment/40695280
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/40695044
has comment: http://stackoverflow.com/comment/40695147
has answer: http://stackoverflow.com/a/25987479
has comment: http://stackoverflow.com/comment/40695035
has comment: http://stackoverflow.com/comment/40695114
favorite count: 0
has title: Finding the middle letter and make it uppercase.. am stuck and the end .. :(
type: Question
has answer: http://stackoverflow.com/a/25987453
has answer: http://stackoverflow.com/a/25987448

http://stackoverflow.com/comment/40647336
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25959139
has text: As @MarkoTopolnik notes, a GUI editor typically _does_ generate a call to `EventQueue.invokeLater()`, but I don't let it [handle the frame](http://stackoverflow.com/a/2561540/230513). A Java 8 lambda expression makes the invocation somewhat less verbose, for [example](http://stackoverflow.com/a/25736893/230513).
score: 0

http://stackoverflow.com/a/26092071
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41184187
score: 0
has comment: http://stackoverflow.com/comment/41128385
has comment: http://stackoverflow.com/comment/41234086
type: Answer
has comment: http://stackoverflow.com/comment/41184355
has comment: http://stackoverflow.com/comment/40889654
has comment: http://stackoverflow.com/comment/41316363
has comment: http://stackoverflow.com/comment/41213666
has comment: http://stackoverflow.com/comment/41164316
has comment: http://stackoverflow.com/comment/40925994
has comment: http://stackoverflow.com/comment/41244232
has comment: http://stackoverflow.com/comment/41131849
has body: This is a demonstration of how to use the extended VTD parser to process large XML file. You need 64-bit JVM to take full advantage of extended VTD. import com.ximpleware.extended.*; public class mem_mapped_read { public static void main(String[] s) throws Exception{ VTDGenHuge vg = new VTDGenHuge(); if (vg.parseFile("test.xml",true,VTDGenHuge.MEM_MAPPED)){ VTDNavHuge vnh = vg.getNav(); AutoPilotHuge aph = new AutoPilotHuge(vnh); aph.selectXPath("//*"); int i = 0; while ((i=aph.evalXPath())!=-1){ System.out.println(" element name is "+vnh.toString(i)); } } } }
accepted answer of: http://stackoverflow.com/q/25977594
has comment: http://stackoverflow.com/comment/41331584
answers question: http://stackoverflow.com/q/25977594
has comment: http://stackoverflow.com/comment/41234120
has comment: http://stackoverflow.com/comment/41316300
has comment: http://stackoverflow.com/comment/40970745
has comment: http://stackoverflow.com/comment/41173500
has comment: http://stackoverflow.com/comment/41184682
has comment: http://stackoverflow.com/comment/40970405
has comment: http://stackoverflow.com/comment/40970729

http://stackoverflow.com/q/25954752
has comment: http://stackoverflow.com/comment/40634959
score: 5
has comment: http://stackoverflow.com/comment/40635486
linked to: http://stackoverflow.com/q/6793257
accepted answer: http://stackoverflow.com/a/25955293
tagged with: preferredsize
answer count: 1
has body: I've read Oracle's API hundreds of times, read countless articles, both here and elsewhere, and i still cannot resize columns after the jtable becomes visible. As you can deduce, i'm also trying to set the visibilty of the columns using jcheckboxes. Using addColumn and removeColumn, as other articles have noted, does not return columns to their original positions. I've previously used an additional class to hold column information eg the column itself, its identifier and original index. This became messy as well the problem of adding/removing data after a column's visibility has been changed. I noticed the data was not in its correct column. As a result, ive opted for setting the column's minWidth, preferredWidth and maxWidth. Now to my problem, the below code does not adjust the column's width when setColumnVisible is set to true. In the words of julius summner miller, why is it so? import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; import javax.swing.table.*; class run { public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { public void run() { Viewer viewer = new Viewer(); JFrame jframe = new JFrame(); jframe.add(viewer); jframe.createBufferStrategy(1); // required for dual monitor issues jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setLocation(50,100); jframe.pack(); jframe.setVisible(true); } }); } } class Viewer extends JPanel { static final long serialVersionUID = 0; DefaultTableModel defaultTableModel; JTable jtable; JCheckBox jcheckBox[]; public Viewer() { this.setLayout(new BorderLayout()); JPanel jpanel = new JPanel(new BorderLayout()); String columnNames[] = {"a","b","c","d","e"}; Object tableData[][] = { {"a1","b1","c1","d1","e1"}, {"a2","b2","c2","d2","e2"}, {"a3","b3","c3","d3","e3"} }; defaultTableModel = new DefaultTableModel(tableData,columnNames); jtable = new JTable(defaultTableModel); JScrollPane jscrollPane …
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40635205
has comment: http://stackoverflow.com/comment/40635183
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40635394
has comment: http://stackoverflow.com/comment/40635069
has comment: http://stackoverflow.com/comment/40635661
tagged with: jtableheader
has answer: http://stackoverflow.com/a/25955293
tagged with: swing
has comment: http://stackoverflow.com/comment/40635013
type: Question
has comment: http://stackoverflow.com/comment/40635704
has comment: http://stackoverflow.com/comment/40635362
has comment: http://stackoverflow.com/comment/40635087
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/40635836
has title: unable to set column width after jtable becomes visible
tagged with: jtable

http://stackoverflow.com/comment/40606126
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25901117
score: 0
has text: That was the answer. Yay! I had SWT v4.3, and updated to SWT v4.4 and that did the trick. When I went to eclipse.org/SWT I say that it said "SWT/GTK+". SWT comes integrated with GTK, which is what I thought, and you have to have a matching component on Linux. Thanks Baz, you should put your comment as an answer, then you can get some points. :)

spring-mvc
tags question: http://stackoverflow.com/q/26018079
tags question: http://stackoverflow.com/q/25981158
tags question: http://stackoverflow.com/q/25877154
tags question: http://stackoverflow.com/q/25893283
tags question: http://stackoverflow.com/q/25894393
tags question: http://stackoverflow.com/q/25950686
tags question: http://stackoverflow.com/q/25951849
tags question: http://stackoverflow.com/q/25885971
tags question: http://stackoverflow.com/q/25999077
tags question: http://stackoverflow.com/q/25968883
tags question: http://stackoverflow.com/q/25915002
tags question: http://stackoverflow.com/q/25901985
tags question: http://stackoverflow.com/q/25932370
tags question: http://stackoverflow.com/q/25947668
tags question: http://stackoverflow.com/q/25939859
tags question: http://stackoverflow.com/q/25931640
tags question: http://stackoverflow.com/q/25906287
tags question: http://stackoverflow.com/q/26026521
tags question: http://stackoverflow.com/q/26026684
tags question: http://stackoverflow.com/q/25955389
tags question: http://stackoverflow.com/q/26021459
tags question: http://stackoverflow.com/q/25963087
tags question: http://stackoverflow.com/q/25876956
tags question: http://stackoverflow.com/q/26020514
tags question: http://stackoverflow.com/q/25972440
tags question: http://stackoverflow.com/q/25926286
tags question: http://stackoverflow.com/q/25942358
tags question: http://stackoverflow.com/q/26019323
tags question: http://stackoverflow.com/q/25953056
tags question: http://stackoverflow.com/q/25975159
tags question: http://stackoverflow.com/q/25881212
tags question: http://stackoverflow.com/q/25968663
tags question: http://stackoverflow.com/q/26012037
tags question: http://stackoverflow.com/q/25952258
tags question: http://stackoverflow.com/q/25945902
tags question: http://stackoverflow.com/q/26024016
tags question: http://stackoverflow.com/q/25965479
tags question: http://stackoverflow.com/q/26015240
tag name: spring-mvc
tags question: http://stackoverflow.com/q/25951070
tags question: http://stackoverflow.com/q/25874510
tags question: http://stackoverflow.com/q/25994125
tags question: http://stackoverflow.com/q/25905686
tags question: http://stackoverflow.com/q/25936749
tags question: http://stackoverflow.com/q/25929777
tags question: http://stackoverflow.com/q/25884711
tags question: http://stackoverflow.com/q/25904298
tags question: http://stackoverflow.com/q/26020284
type: Tag
tags question: http://stackoverflow.com/q/26017291
tags question: http://stackoverflow.com/q/26032594
tags question: http://stackoverflow.com/q/25980464
tags question: http://stackoverflow.com/q/25950475
tags question: http://stackoverflow.com/q/25938462
tags question: http://stackoverflow.com/q/25966027
tags question: http://stackoverflow.com/q/25931861
tags question: http://stackoverflow.com/q/25887792
tags question: http://stackoverflow.com/q/25922868
tags question: http://stackoverflow.com/q/25969335
tags question: http://stackoverflow.com/q/25990452
tags question: http://stackoverflow.com/q/25990343
tags question: http://stackoverflow.com/q/25898988
tags question: http://stackoverflow.com/q/25972864
tags question: http://stackoverflow.com/q/26000195
tags question: http://stackoverflow.com/q/25937563
tags question: http://stackoverflow.com/q/25967935
tags question: http://stackoverflow.com/q/26008986
tags question: http://stackoverflow.com/q/25915723
tags question: http://stackoverflow.com/q/25950065
tags question: http://stackoverflow.com/q/25874250
tags question: http://stackoverflow.com/q/25921961
tags question: http://stackoverflow.com/q/25998192
tags question: http://stackoverflow.com/q/26001202
tags question: http://stackoverflow.com/q/25963110
tags question: http://stackoverflow.com/q/25957879
tags question: http://stackoverflow.com/q/25878973
tags question: http://stackoverflow.com/q/25900245
tags question: http://stackoverflow.com/q/25945203
tags question: http://stackoverflow.com/q/26011829
tags question: http://stackoverflow.com/q/25927817

size
type: Tag
tags question: http://stackoverflow.com/q/25947826
tags question: http://stackoverflow.com/q/25965506
tags question: http://stackoverflow.com/q/25961216
tag name: size
tags question: http://stackoverflow.com/q/25879362

http://stackoverflow.com/comment/40706371
comment on: http://stackoverflow.com/q/25990494
score: 0
has text: See my answer below.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26029333
has answer: http://stackoverflow.com/a/26036205
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26044931
has comment: http://stackoverflow.com/comment/40771639
upvote count: 0
tagged with: flyway
has title: Import CSV File to H2 before Migration
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/40771646
favorite count: 0
type: UnansweredQuestion
downvote count: 1
has body: I'm trying to use Flyway to migrate an in-memory h2 database. Creating the table works fine the traditional way, but I would also like to use h2's import csv as described here. I can't find anything in the Flyway documentation that says this won't work. Is this supported? UPDATE: This is the V02__createTables.sql that I'm trying to migrate. This script is in db.migration.test and Flyway knows about the directory. The csv file an_products.csv is also in this folder, hence being referenced by h2's CSVREAD method below. CREATE TABLE an_products ( id int(10) PRIMARY KEY NOT NULL, name varchar(100) NOT NULL DEFAULT '', price double NOT NULL DEFAULT '0.00', taxable tinyint(4) NOT NULL DEFAULT '0', notes varchar(255) DEFAULT NULL, isPercent tinyint(3) NOT NULL DEFAULT '0', min double DEFAULT NULL, period char(1) NOT NULL DEFAULT '', qty int(10) NOT NULL DEFAULT '0', cost double NOT NULL DEFAULT '0.00' ) AS SELECT * FROM CSVREAD('an_products.csv');
tagged with: java
tagged with: h2
score: -1

http://stackoverflow.com/q/25935430
has comment: http://stackoverflow.com/comment/40602433
score: 0
has title: Hibernate has troubles accessing value of annotated property
answer count: 1
has comment: http://stackoverflow.com/comment/40602195
has answer: http://stackoverflow.com/a/25935780
accepted answer: http://stackoverflow.com/a/25935780
has comment: http://stackoverflow.com/comment/40601797
has body: Hibernate throws exception: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of test.model.Part.part Part entity class: @Table(name = "part") @Entity public class Part implements Serializable { @Id @GeneratedValue @Column(name = "part") private int part; public int getPart() { return part; } public void setPart(int part) { this.part = part; } @OneToMany(mappedBy = "part") private Collection&lt;ProductPart&gt; productPartsByPart; public Collection&lt;ProductPart&gt; getProductPartsByPart() { return productPartsByPart; } ..... } It seems like entity class has correct annotations but Hibernate cannot access property which is id and primary key in Part table. How to solve it? It gets called: ProductPart productPart = (ProductPart) sessionFactory .getCurrentSession() .createCriteria(ProductPart.class) .add(Restrictions.eq("part", cPartId)) .add(Restrictions.eq("product", productId)).uniqueResult(); Update: Caused by: java.lang.IllegalArgumentException: Can not set int field Part.part to java.lang.Integer Update 2: I have product_part table which has fk and references part in part table. Do I have to use @OneToMany(mappedBy = "part") ? @Entity @Table (name = "part") public class Part implements Serializable { @Id @GeneratedValue @Column(name = "part") @OneToMany(mappedBy = "part") private int part; UPDATE3 I don't understand why Hibernate tries to access Part table when I state that I need to perform search only on product_part table. It's also not necessary to access other table since I need only field from product_part which has given values for part and product (which is both foreign keys).... UPDATE4: @Entity @Table(name = "product_part") public class ProductPart implements Serializable { @Id @GeneratedValue @Column(name = "id") private int id; public int getId() { return id; } public void setId(int id) { this.id = id; } @ManyToOne @JoinColumn(name = "product", referencedColumnName = "product", nullable = false) private Product p…
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40601874
has comment: http://stackoverflow.com/comment/40602287
type: Question
has comment: http://stackoverflow.com/comment/40602718

http://stackoverflow.com/comment/40650680
type: QuestionComment
score: 2
has text: I believe the answer to your question is "implementation defined". I could be wrong though.
comment on: http://stackoverflow.com/q/25963222
type: Comment

http://stackoverflow.com/comment/40577462
type: Comment
has text: Does [java.lang.OutOfMemoryError: GC overhead limit exceeded](http://stackoverflow.com/q/5839359/1281433) help at all?
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25916825

http://stackoverflow.com/comment/40697761
comment on: http://stackoverflow.com/q/25988962
has text: possible duplicate of [Making a JButton clickable inside a JTable](http://stackoverflow.com/questions/10347983/making-a-jbutton-clickable-inside-a-jtable)
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/25936352
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25936535
tagged with: java
has comment: http://stackoverflow.com/comment/40603423
type: Question
tagged with: configuration
accepted answer: http://stackoverflow.com/a/25936535
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40603424
has title: How to get resources from WEB-INF from Spring java configuration @Configuration class?
tagged with: spring
has body: I am trying to load specific resource under WEB-INF directory during @Bean creation in one of the Spring @Configuration classes. As I know @ImportResource is used only for Spring xml configurations and not for other files. Approaches with ClassLoader don't work and always return null. For example: @Bean public aBean someBean() { final URL someFolderDirUrl = WebConfig.class.getClassLoader().getResource("WEB-INF/someFolder"); final URL someFolderDirUrl2 = WebConfig.class.getClassLoader().getResource("/someFolder"); final URL someFolderDirUrl3 = WebConfig.class.getClassLoader().getResource("/WEB-INF/someFolder"); final URL someFolderDirUrl4 = WebConfig.class.getClassLoader().getResource("someFolder"); // final URI someFolderDirUri = new URI("file:/WEB-INF/someFolder"); if(modulesDirUrl != null) { File someFolderDirFile; try { someFolderDirFile = new File(someFolderDirUrl.toURI()); } catch(final URISyntaxException e) { someFolderDirFile = new File(someFolderDirUrl.getPath()); } return new aBean(someFolderDirFile); } return new aBean(); } At the end all someFolderDirUrlX variables are null, the same for someFolderDirUri. Is it possible to get a File object inside Spring's @Configuration class which points to file or directory inside WEB-INF?
tagged with: spring-mvc

http://stackoverflow.com/a/25883892
has body: You can also try using Jframe's repaint(long tm) method.
answers question: http://stackoverflow.com/q/25883555
type: Answer
score: 0

http://stackoverflow.com/comment/40612772
type: Comment
type: QuestionComment
has text: ArrayList<Object> instead of using that, and casting it later, use proper type
comment on: http://stackoverflow.com/q/25940999
score: 0

http://stackoverflow.com/a/26042906
type: Answer
has body: I switched from using a microsoft jdbc driver to jtds jdbc driver and it works wonderfully again.
answers question: http://stackoverflow.com/q/25940090
score: 0

http://stackoverflow.com/comment/40647838
has text: Copy paste the it :-)
type: QuestionComment
comment on: http://stackoverflow.com/q/25961735
score: 0
type: Comment

http://stackoverflow.com/comment/40714618
comment on: http://stackoverflow.com/q/25997950
type: QuestionComment
has text: Ok if I use catch(StackOverflowError e) behavior still same.
score: 0
type: Comment

http://stackoverflow.com/a/73372544
upvote count: 1
has body: The current version of Docker supports mounting a "cache" and it's local to the Docker environment (so it's not shared with your OS which is both good and bad; good in that there's nothing about your system in the build process, bad in that you have to download again) This code is from my Spring Docker Swarm integration rework FROM gradle:7.4-jdk17 AS builder WORKDIR /w COPY ./ /w RUN --mount=type=cache,target=/home/gradle/.gradle/caches gradle build --no-daemon -x test FROM openjdk:17-jdk as extractor WORKDIR /w COPY bin/extract.sh /w/extract.sh COPY --from=builder /w/*/build/libs/*.jar /w/ RUN sh ./extract.sh FROM openjdk:17-jdk as sample-service WORKDIR /w COPY --from=extractor /w/sample-service/* /w/ ENTRYPOINT ["java", "-XX:MaxRAMPercentage=80", "org.springframework.boot.loader.JarLauncher"] HEALTHCHECK --interval=5s --start-period=60s \ CMD curl -sfo /dev/null http://localhost:8080/actuator/health USER 5000 EXPOSE 8080 What this does is from my current folder which is a multi-module gradle build I run the build. extractor stage unbundles the JAR file using extract.sh script below. Then assembles the relevant component The relevant contents of extract.sh #!/bin/sh set -e set -x # Remove support projects that won't be a Spring Boot # rm buildSrc.jar # rm gateway-common-*.jar for jar in *.jar do DIR=$(basename $jar -0.0.1-SNAPSHOT.jar) mkdir $DIR java -Djarmode=layertools -jar $jar extract --destination $DIR done
downvote count: 0
answers question: http://stackoverflow.com/q/25873971
type: Answer
score: 1

http://stackoverflow.com/comment/40549033
type: Comment
type: QuestionComment
has text: @EJP While most mainstream platforms use or support `/` as a file separator, it's a stretch to say that it holds for "all platforms." The `File.separator` constant (or system property) is the only _truly portable_ solution guaranteed by the language and runtime.
comment on: http://stackoverflow.com/q/25905864
score: 0

http://stackoverflow.com/a/25945792
has body: If you want to rotate a part of your character you can use the Polygon class http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Polygon.html And use the rotate function. Spritesheets are not that bad anyways, I would rather use them.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25941488

http://stackoverflow.com/comment/40507389
type: QuestionComment
has text: @AvinashRaj - I think the OP wants `10` , `1234` to be matched but `1` , `123` to fail the match.
score: 0
comment on: http://stackoverflow.com/q/25883306
type: Comment

http://stackoverflow.com/comment/73718170
has text: There is no Locale.ISO, but there is `WeekFields.ISO`
score: 5
type: AnswerComment
comment on: http://stackoverflow.com/a/26014690
type: Comment

http://stackoverflow.com/comment/40625588
has text: Thank you! It works. I have just misunderstood how static works.
comment on: http://stackoverflow.com/a/25948972
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/47159102
score: 2
answers question: http://stackoverflow.com/q/25998180
upvote count: 2
has body: For future readers, if you want to achieve the same behaviour with insert methods you should use: insertInto(BOX) .set(BOX.COLUMN1, UInteger.valueOf(1)) .set(BOX.COLUMN2, "test") .returning() .fetchOne() .into(&lt;POJO_class&gt;.class);
downvote count: 0
type: Answer

http://stackoverflow.com/q/25956198
has answer: http://stackoverflow.com/a/67031042
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40638119
has comment: http://stackoverflow.com/comment/40637708
type: Question
has comment: http://stackoverflow.com/comment/40637911
has body: I am implementing the bisection method for solving equations in java. I had initially coded the solution for a pre-defined polynomial equation x^3 + 4x^2 - 10. Now I am generalizing the solution for any polynomial which the user inputs. I read the coefficients of corresponding degrees. Now I only need to tweak the f() method so that I can evaluate the f(a) , f(b) and f(c) . // BISECTION METHOD IMPLEMENTATION IN JAVA // This program uses bisection method to solve for x^3 + 4x^2 -10 = 0 package nisarg; import java.util.Scanner; public class BetterBisection { public static void main(String[] args) { double a, b, c; // a, b and c have the usual meaning double f_of_a, f_of_b; // f_of_a, f_of_b store values of f(a) and f(b) // respectively int highest_degree; System.out.println("What is the highest degree of your polynomial? "); Scanner input = new Scanner(System.in); highest_degree = input.nextInt(); for (int i = highest_degree; i &gt;= 0; i--) { int coeff_deg_i; coeff_deg_i = poly_input(i); // System.out.println(coeff_deg_i); } // The following do-while loop keeps asking the user for a and b until // f(a)f(b) does not become negative do { a = input(); b = input(); if (f(a) * f(b) &gt;= 0) { System.out .println("Sorry the two numbers are not bracketing the root. Please try again "); } } while (f(a) * f(b) &gt;= 0); f_of_a = f(a); f_of_b = f(b); double root = bisectionMethod(f_of_a, f_of_b, a, b); System.out.println("Root is : " + root); } public static double input() { // Reads in the bracketing number i.e a and b Scanner input = new Scanner(System.in); System.out.println("Enter a bracketing number"); return (input.nextDouble()); } public static double f(double num) { // Calculates f(x) given x and returns // f(x) final int COEFF_DEG_3 = 1; // Coefficient of x^3 final int COEFF_DEG_2 = 4; // Coefficient of x^2 final int COEFF_DEG_0 = -10; // Coefficient of x^0 return (COEFF_DEG_3 * Math.pow(num, 3) + COEFF_DEG_2 * Math.pow(num, 2) + COEFF_DEG_0 * Math.pow(num, 0)); } pub…
has comment: http://stackoverflow.com/comment/40637740
score: 3
has comment: http://stackoverflow.com/comment/40638173
has comment: http://stackoverflow.com/comment/40637690
tagged with: java
has comment: http://stackoverflow.com/comment/40637695
has title: Bisection method implementation in java
has answer: http://stackoverflow.com/a/42745985
has comment: http://stackoverflow.com/comment/40637985
has comment: http://stackoverflow.com/comment/40638028
has comment: http://stackoverflow.com/comment/40637738
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40637675
has comment: http://stackoverflow.com/comment/40637718
has comment: http://stackoverflow.com/comment/40638018
has comment: http://stackoverflow.com/comment/40637758
favorite count: 0
has comment: http://stackoverflow.com/comment/40638081
has answer: http://stackoverflow.com/a/25956213

http://stackoverflow.com/comment/40714606
score: 0
type: Comment
type: QuestionComment
has text: @JonSkeet length of what, length of sending frame? this is the actual length 295416440622254
comment on: http://stackoverflow.com/q/25998296

http://stackoverflow.com/comment/40724939
has text: You might find [this post](http://stackoverflow.com/questions/10326460/upload-a-large-file-using-jersey-client) relevant.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25922920

http://stackoverflow.com/q/25959486
answer count: 1
type: UnansweredQuestion
has title: I need new version of build-tools for sdk manager
tagged with: android
has body: i started working by sdk manager and android programming but my sdk manager doesn't have build-tools .I couldn't find it by searching.i use eclipse IDE too. can anyone suggest me a website or download link of build-tools package?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40643420
has answer: http://stackoverflow.com/a/25959577
has comment: http://stackoverflow.com/comment/40643496
score: 0

http://stackoverflow.com/a/25960656
answers question: http://stackoverflow.com/q/25959691
score: 0
type: Answer
has body: I don't think this is possible with Chronometer. It only supports fine-grained time resolution down to seconds. Also, after looking at the code, I see they are doing this: private Handler mHandler = new Handler() { public void More ...handleMessage(Message m) { if (mRunning) { updateText(SystemClock.elapsedRealtime()); dispatchChronometerTick(); sendMessageDelayed(Message.obtain(this, TICK_WHAT), 1000); } } }; Looks like it is intentional that it currently updates only once per second. This is understandable as this component is a TextView and will typically cause a re-layout of its parent when the text changes (if layout_width is wrap_parent.) You'll have to look for an alternate solution to get the level of detail and update performance you desire.

http://stackoverflow.com/comment/40517051
score: 2
comment on: http://stackoverflow.com/q/25889047
type: QuestionComment
has text: Have a look at https://help.ubuntu.com/community/EnvironmentVariables section System-wide environment variables.
type: Comment

http://stackoverflow.com/q/25988189
has answer: http://stackoverflow.com/a/25989514
score: 0
answer count: 1
has body: I am deploying a grails(v 2.3.4) application in an Apache tomcat server (v 7.0.47) in a virtual machine. WARNING: Failed to execute: select min(date_hour) as a, max(date_hour) as b from Tablev1 because: No operations allowed after connection closed. This happens after 12+ hours, I was checking online and it said this happens as the app is idle etc etc Also, is it okay if I use some click automation process of closing and restarting server after every 12 hours? Is that a good solution for now? Kindly let me know how to resolve this. Also, if the users increase, will the tomcat server be able to hold it? Till how many users will this be there?
type: UnansweredQuestion
has title: Tomcat sever deployment connection closed
tagged with: java
tagged with: grails
type: Question
tagged with: tomcat

http://stackoverflow.com/q/25889259
score: 1
tagged with: java
has title: Multidimensional array outputs zero between odd number array
upvote count: 1
accepted answer: http://stackoverflow.com/a/25889376
type: Question
has body: I have this program: class PrintOdd { public static void main(String[] args) { int num = 1; int product = 1; int oddArray[][] = new int[10][7]; for (int i = 0; i &lt; 10; i++) { for (int j = 0; j &lt; 7; j++) { if ((num &lt; 100) &amp;&amp; (num % 2 != 0)) { oddArray[i][j] = num; num++; } else { num++; } } } for (int i = 0; i &lt; 10; i++) { for (int j = 0; j &lt; 7; j++) { System.out.print(oddArray[i][j] + "\t "); } System.out.print("\n "); } } } and result: 1 0 3 0 5 0 7 0 9 0 11 0 13 0 15 0 17 0 19 0 21 0 23 0 25 0 27 0 29 0 31 0 33 0 35 0 37 0 39 0 41 0 43 0 45 0 47 0 49 0 51 0 53 0 55 0 57 0 59 0 61 0 63 0 65 0 67 0 69 0 This code prints odd numbers between 0 and 99 but as from the above output it prints zero between the odd numbers. Can anyone tell me where the zero's come from because i do not understand. This code prints odd numbers between 0 and 99 but as from the above output it prints zero between the odd numbers.
has answer: http://stackoverflow.com/a/25889416
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/25889349
has answer: http://stackoverflow.com/a/25889349
favorite count: 0
has answer: http://stackoverflow.com/a/25889376
type: AnsweredQuestion

http://stackoverflow.com/a/25973778
answers question: http://stackoverflow.com/q/25953819
has comment: http://stackoverflow.com/comment/53216079
has comment: http://stackoverflow.com/comment/56225192
has comment: http://stackoverflow.com/comment/98805334
has comment: http://stackoverflow.com/comment/65730508
has comment: http://stackoverflow.com/comment/42867985
has comment: http://stackoverflow.com/comment/45246832
upvote count: 417
has comment: http://stackoverflow.com/comment/52299003
downvote count: 2
type: AcceptedAnswer
score: 415
has body: As of OkHttp3 you can do this through the Builder like so client = new OkHttpClient.Builder() .connectTimeout(10, TimeUnit.SECONDS) .writeTimeout(10, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) .build(); You can also view the recipe here. For older versions, you simply have to do this OkHttpClient client = new OkHttpClient(); client.setConnectTimeout(15, TimeUnit.SECONDS); // connect timeout client.setReadTimeout(15, TimeUnit.SECONDS); // socket timeout Request request = new Request.Builder().url(url).build(); Response response = client.newCall(request).execute(); Be aware that value set in setReadTimeout is the one used in setSoTimeout on the Socket internally in the OkHttp Connection class. Not setting any timeout on the OkHttpClient is the equivalent of setting a value of 0 on setConnectTimeout or setReadTimeout and will result in no timeout at all. Description can be found here. As mentioned by @marceloquinta in the comments setWriteTimeout can also be set. As of version 2.5.0 read / write / connect timeout values are set to 10 seconds by default as mentioned by @ChristerNordvik. This can be seen here.
has comment: http://stackoverflow.com/comment/84098011
type: Answer
accepted answer of: http://stackoverflow.com/q/25953819
has comment: http://stackoverflow.com/comment/52284017

http://stackoverflow.com/a/25975057
score: -1
has body: you should call the add function of JFrame object and add the JPanel to it. In your main function, do this after initialization of Other object: obj.add(obj.panel());
has comment: http://stackoverflow.com/comment/40672299
has comment: http://stackoverflow.com/comment/40671991
downvote count: 1
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25974980

http://stackoverflow.com/q/25931309
type: Question
has body: I want to extract 2 numbers from a string. My sample code is: import java.util.regex.Matcher; import java.util.regex.Pattern; public class Test { public static int returnInt(String pattern, String inputString) { Pattern intPattern = Pattern.compile(pattern); Matcher matcher = intPattern.matcher(inputString); matcher.find(); String input = matcher.group(0); return Integer.parseInt(input); } public static void main(String[] args) { System.out .println(returnInt( "\\d+", "The following DTE jobs have been submitted to ServerFarm for execution. (farm showjobs -d -j 12774076) can be used to monitor job status. The output format is JobID : TopoName : TopoAlias : JobStatus. ( The initial job status is listed in brackets. If job status is FAILED, then the job can not be run at all! Otherwise please check job status periodically. ) :21554030 : IDM_INSTALLER_1H1N_REL11 : IDM_INSTALLER_1H1N_REL11 : WAITING (Being queueed on server farm)")); } } I want the output to come as: 12774076 and 21554030 but the output is only 12774076 Kindly help!!
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25931407
tagged with: regex
has comment: http://stackoverflow.com/comment/40594457
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25931407
tagged with: java
has title: Pattern matching in java: extracting digits from a string literal

http://stackoverflow.com/q/25881008
accepted answer: http://stackoverflow.com/a/25881038
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/40519427
has body: So i've spent a good three hours trying to solve the problem below. My logic seems right, my syntax seems right, but for some reason the code just won't listen to me. How typical. float counter = 0; float pColor = counter / ((float)Math.abs((x_end - x_start))); System.out.println("FIRST EVER PCOUNTER:" + pColor); System.out.println("FIRST EVER X START IS: " + x_start); System.out.println("FIRST EVER X END IS: " + x_end); System.out.println(x_end + " " + x_start); // part of another program while(x != x_end){ x+= step_x; counter++; System.out.println("Count is:" + counter); if(p&lt;0){ p+= twoDy; } else{ y += step_y; p += twoDyMinusDx; } System.out.println("pColor is: "+pColor); System.out.println("p1.c.r: "+ p1.c.r); System.out.println("x_end is: " + x_end); System.out.println("x_start is:" + x_start); System.out.println(""); So all the print statements above is to check whether pColor is changing or not. For some reason,all the print statements says that pColor is 0.0 FIRST EVER PCOUNTER:0.0 FIRST EVER X START IS: 341 FIRST EVER X END IS: 350 350 341 Count is:1.0 pColor is: 0.0 p1.c.r: 1.0 x_end is: 350 x_start is:341 Count is:2.0 pColor is: 0.0 p1.c.r: 1.0 x_end is: 350 x_start is:341 Count is:3.0 pColor is: 0.0 p1.c.r: 1.0 x_end is: 350 x_start is:341 Count is:4.0 pColor is: 0.0 p1.c.r: 1.0 x_end is: 350 x_start is:341 Count is:5.0 pColor is: 0.0 p1.c.r: 1.0 x_end is: 350 x_start is:341 Count is:6.0 pColor is: 0.0 p1.c.r: 1.0 x_end is: 350 x_start is:341 Count is:7.0 pColor is: 0.0 p1.c.r: 1.0 x_end is: 350 x_start is:341 Count is:8.0 pColor is: 0.0 p1.c.r: 1.0 x_end is: 350 x_start is:341 Count is:9.0 pColor is: 0.0 p1.c.r: 1.0 x_end is: 350 x_start is:341 As you can see, counter is constantly increasing, but every single pColor remains at 0.0. What is wrong with it?
has comment: http://stackoverflow.com/comment/40503475
has answer: http://stackoverflow.com/a/25881038
type: AnsweredQuestion
has title: simple math/casting bug in Java that I just keep on missing?
score: 0
tagged with: math
tagged with: java
tagged with: floating-point
tagged with: loops

http://stackoverflow.com/q/25878415
downvote count: 0
score: 3
tagged with: windows
answer count: 1
favorite count: 0
has title: Java ProcessBuilder process waiting for input
type: UnansweredQuestion
tagged with: process
upvote count: 3
has answer: http://stackoverflow.com/a/25878436
tagged with: java
has body: When running a command line command via ProcessBuilder (specifically "GetMac /s") if it throws an error or returns normally and I can read the error or the MAC address that it returns but if it prompts the user input (some pc's on the network require a password when using getmac) the process will just hang waiting for the password. Here is what the command does when run from command line: Here is the code I'm using for the process: package testing; import java.io.IOException; class test1 { public static void main(String[] args){ String hostName = "testpc"; ProcessBuilder builder = new ProcessBuilder("getmac", "/s", hostName, "/nh"); builder.inheritIO(); try { Process proc = builder.start(); } catch (IOException e) { e.printStackTrace(); } } } The reason I need the mac is for making a wake on lan program and want to automatically get any new pc's mac addresses when they're detected so the user doesn't have to enter it manually. so if you know a better way of getting the MAC of a remote pc by all means let me know and I'll use that instead. I realize java probably isn't the best language to be using for this but it's the only one I know at the moment and this is just fun little project for my downtime at work. **Edit: if it requries a password I just want to ignore that PC and kill the process and move on to the next PC
type: Question

http://stackoverflow.com/comment/116792000
comment on: http://stackoverflow.com/a/59885408
type: Comment
has text: Awesome and spot on. The other answers really doesn't answer the question. This really solved my problem !
score: 2
type: AnswerComment

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/25908988

http://stackoverflow.com/q/25928018
answer count: 1
downvote count: 1
favorite count: 0
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/25928472
tagged with: provider
accepted answer: http://stackoverflow.com/a/25928472
tagged with: java
type: Question
tagged with: guice
has title: Provider for custom annotation
score: -1
has body: How with Google Guice create provider for custom annotations. @SuperAnno Object test - my custom annotation If this annotation find, system automatically call provider for convert

http://stackoverflow.com/a/25961147
type: Answer
has comment: http://stackoverflow.com/comment/40646785
score: 3
has comment: http://stackoverflow.com/comment/40646740
accepted answer of: http://stackoverflow.com/q/25961122
downvote count: 0
has comment: http://stackoverflow.com/comment/40646722
answers question: http://stackoverflow.com/q/25961122
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40646753
has body: I think you are looking for the Method Graphics.translate(). You can specify an x and y value that all points are translated to. Of course, you should invert it after painting so that the superclass is not affected by the changes. To circumvent problems made by the superclass, you could also use the create() method of the Graphics object, paint on the new object, and the call dispose (Thanks to HovercraftFullOfEels to point this out).
has comment: http://stackoverflow.com/comment/40646807

http://stackoverflow.com/q/25902204
has comment: http://stackoverflow.com/comment/40541512
has comment: http://stackoverflow.com/comment/40541572
has body: I should know how to do this but maybe I'm just tired. Anyways I need to write a simple while loop that asks the user how many of each item they want (with a Scanner). There are four items. The code currently looks as follows: int item1Amount; int item2Amount; int item3Amount; int item4Amount; int c = 1; while (x != -1) { System.out.print("Enter the number of Item " + c + " you would like to purchase: "); item1Amount = input.nextInt(); c++; } The problem I am having in logic is that when it goes back through the loop it will be asking for Item 2, 3, and 4 but still entering the user input as item1Amount. How can this been done correctly?
accepted answer: http://stackoverflow.com/a/25902316
has comment: http://stackoverflow.com/comment/40541825
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25902347
has title: Use a while loop in java to add to a different variable in each iteration
tagged with: java
has comment: http://stackoverflow.com/comment/40541513
type: Question
has answer: http://stackoverflow.com/a/25902316
has comment: http://stackoverflow.com/comment/40541527
has answer: http://stackoverflow.com/a/25902380
score: 0
possible better answer: http://stackoverflow.com/a/25902268
tagged with: while-loop
has answer: http://stackoverflow.com/a/25902268

http://stackoverflow.com/a/26182351
has comment: http://stackoverflow.com/comment/76561656
type: Answer
score: 2
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/41068879
has body: Take a look at Copper Engine http://copper-engine.org/ Unlike Activiti and such, it does not require to write a ton of XML just to get a simple workflow going
answers question: http://stackoverflow.com/q/26015524

http://stackoverflow.com/comment/40707033
type: AnswerComment
has text: You will just create one more function in interface, which will return you state and then other function with natvie code also from interface. The main idea is: to have as less as possible platform specific code.
type: Comment
comment on: http://stackoverflow.com/a/25968826
score: 1

http://stackoverflow.com/a/25889568
has body: Long.parseLong() throws a NumberFormatException if the passed string is not a parsable long value. In your case, you are passing an empty string (probably because the user did not enter anything in the input field). You can verify this easily: ... Long.parseLong(""); ... java.lang.NumberFormatException: For input string: "" You should always be prepared to catch this exception (besides empty strings, the exception is thrown if the user enters anything which is not a Long), and show an appropriate error message to the user, something like try { qq = Long.parseLong(q); } catch(NumberFormatException nfe) { // show error message like "The string ... you entered is not a number." ... } If you want to treat an empty string as 0 (if that is reasonable for your use case), you can do something like (still requires the try/catch block to catch any other invalid inputs): try { long qq = 0; if (q != null &amp;&amp; !q.isEmpty()) { qq = Long.parseLong(q); } ... } catch(NumberFormatException nfe) { // show error message like "The string ... you entered is not a number." ... } In addition to that, instead of duplicating code dozens of times, you should check which are the variable parts of your code and replace them with variables, so that you can reuse the code instead of duplicating it.
accepted answer of: http://stackoverflow.com/q/25889403
has comment: http://stackoverflow.com/comment/40519747
answers question: http://stackoverflow.com/q/25889403
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/26006646
score: 55
type: Answer
has comment: http://stackoverflow.com/comment/124971058
has body: Are you aware that log4j2 includes a bridge for log4j-1.2? You can use it by removing the old log4j-1.2.17.jar, and include these three jars: log4j-api-2.x.jar log4j-core-2.x.jar log4j-1.2-api-2.x.jar This will result in all calls that your application makes to the log4-1.2 API to be routed to the log4j2 implementation. The FAQ has a diagram that may clarify things. (Don't forget to remove the old log4j-1.2 jar from the classpath!)
has comment: http://stackoverflow.com/comment/92384485
has comment: http://stackoverflow.com/comment/76740379
accepted answer of: http://stackoverflow.com/q/26005149
answers question: http://stackoverflow.com/q/26005149
has comment: http://stackoverflow.com/comment/92381138
has comment: http://stackoverflow.com/comment/139253059
type: AcceptedAnswer
downvote count: 0
upvote count: 55
has comment: http://stackoverflow.com/comment/40752344

http://stackoverflow.com/comment/40534122
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25897926
has text: Make sure you check all your xml files for any mistakes, including strings and styles. Also check the manifest.

http://stackoverflow.com/comment/40594899
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25930029
has text: All the answers below are very good, but answer from Sorin is more optimiziable
type: Comment

http://stackoverflow.com/a/25901236
has comment: http://stackoverflow.com/comment/40540178
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25901198
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/25901198
has body: You are performing integer division, which in Java results in another int. You need to force floating-point division with your math; assigning to a double doesn't force it. Use a floating-point literal, with .0 on the end. double quizaverage = (quiz1 + quiz2 + quiz3)/3.0; double testaverage = (test1 + test2)/2.0; (Casting either operand to a double would work also.)

http://stackoverflow.com/comment/40550485
type: Comment
comment on: http://stackoverflow.com/a/25907170
score: 0
type: AnswerComment
has text: Also, this code does not compile. Access modifiers (like `private`) cannot be used inside methods like this.

http://stackoverflow.com/comment/40724895
has text: What output are you seeing vs what you're expecting?
score: 0
comment on: http://stackoverflow.com/q/26003752
type: Comment
type: QuestionComment

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/25917828

http://stackoverflow.com/a/26026738
has comment: http://stackoverflow.com/comment/40772773
score: 0
has body: Whether two keys will hash to the same bucket depends on a combination of the hashCode() for each and the number of buckets (plus the algorithm used to map hash codes to buckets, obviously). It's entirely possible for two keys to hash to the same bucket for just about any table size. Collisions are natural in hash tables &mdash; the goal is just to ensure a low average number of entries in each bucket relative to the total number of entries. A larger hash table reduces the chance of collisions at the cost of more space. Is newHashMapWithExpectedSize(n) to be avoided when using small values for n? No, not really. Is the fact that you have a collision actually a problem? After inserting "records" into the map, if I had called map.hasKey("pageSize") would I get true? If and only if you've added an entry with the key "pageSize". Hashing to the same bucket has no effect on the behavior of the map. Multiple entries can be stored in each bucket, and only if a key that equals the "pageSize" parameter is found will hasKey return true. since I knew how many key-value entries it would contain Can you use ImmutableMap instead? Often when you know ahead of time how many entries the map will contain, it's meant to be immutable. Since ImmutableMap knows that the number of entries it contains will never change, it tends to be possible for it to optimize its size better than a mutable HashMap. Not to mention all the other benefits of immutability.
has comment: http://stackoverflow.com/comment/40772837
has comment: http://stackoverflow.com/comment/40768188
type: Answer
answers question: http://stackoverflow.com/q/26026363

http://stackoverflow.com/comment/40716333
comment on: http://stackoverflow.com/q/25999185
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis Um... what's this about 'getting parent class fields'?
score: 0

http://stackoverflow.com/q/26012244
possible better answer: http://stackoverflow.com/a/30730918
has answer: http://stackoverflow.com/a/30730918
favorite count: 0
tagged with: eclipse-luna
has title: Eclipse - change order for Open Declaration / Implementation / Return Type
accepted answer: http://stackoverflow.com/a/30621169
score: 14
type: AnsweredQuestion
upvote count: 14
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/2105979
downvote count: 0
tagged with: hyperlink
tagged with: ide
has answer: http://stackoverflow.com/a/30621169
has body: If I press Ctrl and the mouse is over a method call, a menu is opened: Open Declaration Open Implementation Open Return Type If I hit Ctrl + click on the method call, the first option will be considered (Open Declaration). I want to change the order of these options to: Open Implementation Open Declaration Open Return Type Is it possible to achieve the second order? ( or to let them in the same order but change "the default" for Ctrl + click to be Open Implementation ) I know that I can uncheck the "Open Declaration" from Window > Preferences > General > Editors > Text Editors > Hyperlinking , but I'd like to have all options there with Open Implementation as default. Details O.S.: Windows 7 IDE: Eclipse Luna (4.4) Picture (default):

http://stackoverflow.com/q/26028081
tagged with: java
tagged with: percentage
upvote count: 1
has answer: http://stackoverflow.com/a/26028151
answer count: 1
has title: Java percentage calculation not processing and I can't figure out why
tagged with: math
has body: A snippet of code is below: System.out.println("Calc: " + totalMs[0] + " divided by " + totalTestMs + " times 100"); System.out.println("Calc 2: " + totalBits[0] + " divided by " + totalCount[0] + " divided by 1000000"); DecimalFormat df = new DecimalFormat("0.00"); String b1 = "0", b2 = "0", b3 = "0", b4 = "0", b5 = "0", b6 = "0", b7 = "0", b8 = "0", b9 = "0", b10 = "0"; String b1Pct = "0"; if (totalCount[0] &gt; 0) { b1Pct = df.format((totalMs[0]/totalTestMs)*100); b1 = df.format((totalBits[0]/totalCount[0])/1000000); } Calc fails and Calc 2 passes. The Output shown by the above System prints is: As you can see the figures appear to be passing correctly. However, when I System output the b1Pct result it states "0.0". When in this case it should be 22.73. I'm sure it's something simple but I can't figure it out. Even more confusing as the second one is correct!
type: AnsweredQuestion
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26028151
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android

linux
tags question: http://stackoverflow.com/q/25997631
tags question: http://stackoverflow.com/q/25959948
tags question: http://stackoverflow.com/q/25992918
tags question: http://stackoverflow.com/q/25877258
tags question: http://stackoverflow.com/q/25931170
tags question: http://stackoverflow.com/q/25888101
tags question: http://stackoverflow.com/q/25952578
tags question: http://stackoverflow.com/q/25884352
tags question: http://stackoverflow.com/q/25978763
type: Tag
tags question: http://stackoverflow.com/q/25936803
tags question: http://stackoverflow.com/q/26010209
tags question: http://stackoverflow.com/q/25901117
tags question: http://stackoverflow.com/q/25954348
tag name: linux
tags question: http://stackoverflow.com/q/25890486
tags question: http://stackoverflow.com/q/25932980
tags question: http://stackoverflow.com/q/25886706
tags question: http://stackoverflow.com/q/25894558
tags question: http://stackoverflow.com/q/25877337
tags question: http://stackoverflow.com/q/25961089
tags question: http://stackoverflow.com/q/25957768
tags question: http://stackoverflow.com/q/26034029
tags question: http://stackoverflow.com/q/25888459
tags question: http://stackoverflow.com/q/26033269
tags question: http://stackoverflow.com/q/25935032
tags question: http://stackoverflow.com/q/26022614
tags question: http://stackoverflow.com/q/25975988

http://stackoverflow.com/q/26028626
type: AnsweredQuestion
has title: On maven how do I ignore an expression (EL) inside a resource file? ${user.home}
has body: I have this pom.xml: ... ... src/main/resources true Inside "src/main/resources/", I have this file log4j.xml. ... <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/> ... My issue is when I do $ mvn clean install, the ${user.home} gets translated to So how can I ignore this case ${user.home} to stay on target directory with the same ${user.home}, because log4j needs to know user directory of any machine that runs my app. Note: I also want to clarify, that I have more resource files that has to be filtered. Thanks for your help in advance.
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26033844
tagged with: maven
accepted answer: http://stackoverflow.com/a/26263163
has answer: http://stackoverflow.com/a/26033844
tagged with: java
has answer: http://stackoverflow.com/a/26263163

http://stackoverflow.com/comment/40777207
type: Comment
type: QuestionComment
score: 0
has text: Have you tried creating and storing a default image in the database for "new users" ?
comment on: http://stackoverflow.com/q/26032634

http://stackoverflow.com/q/25994321
type: Question
tagged with: jakarta-ee
score: 5
answer count: 1
downvote count: 0
tagged with: glassfish
has body: I have no idea why this started happening and because of this I am not sure what to check. Whenever I want to debug some java code now, I get: Attaching to localhost:9009 Connection Refused. It is glassfish and Netbeans. Now this Chrome connector thing has started appearing. Unfortunately, now it won't stop on any of my breakpoints. Fantastic. The last thing I was trying to do was move some hibernate config from .hbm.xml to annotations and that ended up being more pain than it was worth. Does anyone have any ideas on how I can debug this? I have another project in Netbeans and that is also suffering from the same problem. I have tried rebooting and all of the firewalls are off.
has answer: http://stackoverflow.com/a/26001695
favorite count: 0
tagged with: netbeans
type: AnsweredQuestion
has title: Glassfish Netbeans Attaching to localhost "Connection refused"
accepted answer: http://stackoverflow.com/a/26001695
upvote count: 5
tagged with: java

http://stackoverflow.com/comment/40603930
score: 4
type: Comment
type: QuestionComment
has text: 1 - Check string length. 2 - Then parse and do equality.
comment on: http://stackoverflow.com/q/25936617

jaxb
tags question: http://stackoverflow.com/q/25932578
tags question: http://stackoverflow.com/q/25991128
tags question: http://stackoverflow.com/q/25933481
tags question: http://stackoverflow.com/q/26013922
tags question: http://stackoverflow.com/q/26012467
tags question: http://stackoverflow.com/q/26014350
tags question: http://stackoverflow.com/q/25998287
tags question: http://stackoverflow.com/q/25976391
tags question: http://stackoverflow.com/q/25924474
tags question: http://stackoverflow.com/q/25897274
tags question: http://stackoverflow.com/q/26019144
tags question: http://stackoverflow.com/q/26009456
tags question: http://stackoverflow.com/q/25898723
tags question: http://stackoverflow.com/q/25984191
tags question: http://stackoverflow.com/q/25978650
tags question: http://stackoverflow.com/q/25963403
tags question: http://stackoverflow.com/q/25969655
tags question: http://stackoverflow.com/q/26016070
tags question: http://stackoverflow.com/q/26002636
tags question: http://stackoverflow.com/q/25896516
tags question: http://stackoverflow.com/q/25893798
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/26026043
tags question: http://stackoverflow.com/q/26014656
tags question: http://stackoverflow.com/q/25995706
tags question: http://stackoverflow.com/q/25936600
tags question: http://stackoverflow.com/q/25908820
tags question: http://stackoverflow.com/q/25897712
tags question: http://stackoverflow.com/q/25977352
tags question: http://stackoverflow.com/q/25990005
tags question: http://stackoverflow.com/q/25942081
tags question: http://stackoverflow.com/q/25932803
tags question: http://stackoverflow.com/q/25910630
tags question: http://stackoverflow.com/q/25894994
tags question: http://stackoverflow.com/q/26009077
tags question: http://stackoverflow.com/q/25948980
tags question: http://stackoverflow.com/q/25987635
tags question: http://stackoverflow.com/q/25973188
tags question: http://stackoverflow.com/q/25980582
tags question: http://stackoverflow.com/q/25996422
tags question: http://stackoverflow.com/q/26014358
tags question: http://stackoverflow.com/q/26011446
tags question: http://stackoverflow.com/q/25962753
tags question: http://stackoverflow.com/q/25932656

http://stackoverflow.com/a/26022876
accepted answer of: http://stackoverflow.com/q/26021114
answers question: http://stackoverflow.com/q/26021114
score: 2
has comment: http://stackoverflow.com/comment/40760967
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: Struts (1 or 2) is only a web layer, while Spring includes (more or less) everything. Some people simply prefer the Struts model of the web layer (I prefer S2 over Spring MVC, but barely), some systems grew organically, Struts 1 existed before Spring MVC, etc. It was very common to use Spring as glue but use Struts as the web layer.
downvote count: 0

http://stackoverflow.com/a/25880564
type: Answer
downvote count: 0
has body: Since it's a grayscale map, the RGB parts will all be the same value (with range 0 - 255), so just take one out of the packed integer and find out what percent of 255 it is: int clr = (int) ((image.getRGB(x, y) &amp; 0xFF) / 255.0 * 100); System.out.println(clr);
score: 1
accepted answer of: http://stackoverflow.com/q/25880348
upvote count: 1
answers question: http://stackoverflow.com/q/25880348
type: AcceptedAnswer

http://stackoverflow.com/comment/40609248
has text: Yes so does my comment. When you use something like Collection generic = new ArrayList (); Then you are forced to use the iterator for the collection. Which would not guarantee the ordering. For that you would have to explicitly use a list. List generic = new ArrayList ();
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25939338
type: Comment

http://stackoverflow.com/comment/40540828
type: QuestionComment
comment on: http://stackoverflow.com/q/25901714
type: Comment
has text: @wolfcastle Well, they're practically immutable. (If the synchronization is fixed.)
score: 0

http://stackoverflow.com/comment/40655885
type: QuestionComment
has text: I recommend reading the array section of your textbook. It is much easier than you think, IF you try :).
comment on: http://stackoverflow.com/q/25965030
score: 0
type: Comment

http://stackoverflow.com/a/25893334
has body: Obsolete: Use java.util.Date for the field. java.sql.Timestamp is a direct subclass of it. As is java.sql.Date - that strips the time part. Why the java database driver takes DATE to be Timestamp is a bit weird. What is the database vendor? Did you specify a length or so? Are indeed only dates stored? Researched: I looked into CachedRowSetImpl.java, and Oracle's docs and Oracle does everything fine (java.sql.Date, java.sql.Time, java.sql.Timestamp convertible). The CachedRowSetImpl does simply cast the DATE's Object (and getObject is likely to return the high resolution Timestamp - with time) to java.sql.Date, and that's wrong. So override or substitute this sun's class. /* * The object coming back from the db could be * a date, a timestamp, or a char field variety. * If it's a date type return it, a timestamp * we turn into a long and then into a date, * char strings we try to parse. Yuck. */ switch (RowSetMD.getColumnType(columnIndex)) { case java.sql.Types.DATE: { long sec = ((java.sql.Date)value).getTime(); return new java.sql.Date(sec); }
has comment: http://stackoverflow.com/comment/40526955
answers question: http://stackoverflow.com/q/25892417
downvote count: 0
has comment: http://stackoverflow.com/comment/40525264
score: 6
has comment: http://stackoverflow.com/comment/40565168
has comment: http://stackoverflow.com/comment/40527044
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/40526841
has comment: http://stackoverflow.com/comment/40526708

http://stackoverflow.com/q/25898619
type: AnsweredQuestion
has title: Adapt standalone application to use Spring
has body: I've read about how to use Spring in standalone applications but I'm not sure what should be the approach for refactoring a large code base of 120,000 lines for making the change as gradual as possible. As far as I understand Spring won't inject anything in an object unless that object is managed by the application context. If this is true, I think I have two choices: 1- Start refactoring from the main class down, but this means complicated scenarios will appear soon. 2- Share the application context statically so that I can start refactoring the simplest things, scalating in difficulty when I'm ready. I'm not a fan of static access so I would try to avoid that choice, but I don't know if it's a good idea to start with the huge classes that are loaded at startup. Any ideas of the best approach? By the way, is it OK to inject Swing components until I can fix the dependencies?
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25898840
score: 0
has answer: http://stackoverflow.com/a/25898731
has comment: http://stackoverflow.com/comment/40552089
has comment: http://stackoverflow.com/comment/40579987
has comment: http://stackoverflow.com/comment/40541891
has answer: http://stackoverflow.com/a/25898840
tagged with: swing
possible better answer: http://stackoverflow.com/a/25898731
tagged with: spring

http://stackoverflow.com/comment/40527351
score: 0
has text: So, to put it simply, an element type is the type of anything that you put in an array that is not an array itself. The type of an innermost element in a possible hierarchy of nested arrays.
comment on: http://stackoverflow.com/q/25894499
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25983585
score: 1
has body: CXF will generate the value as name + "Service". To override this value, you can set the serviceName attribute on the @WebService annotation, e.g. @WebService(name = "MyService", serviceName = "MyService")
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25969783
answers question: http://stackoverflow.com/q/25969783
upvote count: 1

http://stackoverflow.com/comment/40530854
score: 0
type: Comment
has text: Reinstalling Eclipse probably won't help as that won't touch the workspace metadata. It is probably best to create a new workspace and import the projects from the old one.
type: QuestionComment
comment on: http://stackoverflow.com/q/25896044

http://stackoverflow.com/q/25946506
has answer: http://stackoverflow.com/a/26191282
linked to: http://stackoverflow.com/q/661068
has body: I am new in java Android... I am trying to create two threads (named: Clean and Progress) that will run two different methods each method get the same object mix.while Clean will run a time consuming method that is part of mix's class (mix.TimeConsumingMethod();) I want Progress thread to monitor the progress of TimeConsumingMethod() by checking class variables such as mix.length and mix.framesClean in progress I check to see mix.length &gt; 0 if not I want Progress to wait over here my app crashes and in log CAT i get an error of: 09-20 10:37:32.773: E/AndroidRuntime(12030): java.lang.IllegalMonitorStateException: object not locked by thread before wait() snippet of code invoking both threads:. mix = new MixMaxMain(); progressThread = new Thread(new Runnable() { @Override public void run() { Progress (mix); } },"Progress Thread"); CleanThread = new Thread(new Runnable() { @Override public void run() { Clean (mix); } },"Cleaner Thread"); Log.d("STOP", "SEnding cleanThread AND progress Thread"); CleanThread.start(); progressThread.run(); snippet of Clean running time consuming method: long time_start = SystemClock.elapsedRealtime(); mix.Run(Daudio,mu,sigSqr,c); long time_end = SystemClock.elapsedRealtime(); snippet of Progress: while(mix.length==0) {try { Log.d("Progress", "Length is Zero"); Thread.sleep(1);//fails here!! } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Log.d("Progress", "Clean Has Started"); int totalProgressLen = (int)(mix.length+0.7*mix.length); while(mix.done==false) { try { progressThread.wait(50); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } progress.setProgress(mix.framsClean*256/totalProgressLen ); }
tagged with: java
tagged with: multithreading
type: Question
has title: sharing an Object between two thread running two different methods Android Java
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41068695

http://stackoverflow.com/a/25920489
answers question: http://stackoverflow.com/q/25919554
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25919554
score: 1
has body: You can try using ulimit -v unlimited in the bash profile of user.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40576989

http://stackoverflow.com/a/26002346
type: Answer
accepted answer of: http://stackoverflow.com/q/26000836
downvote count: 0
score: 1
has body: About Json : [ {in these brackets} ,{ there is an array}, {of objects} ] {in these brackets is an just an object} You said " hey, get me that JSONArray"(omg it rhymes!) and Eclipse is telling you: "You crazy? I dont see an array" (hidden message is there's just an object, not an array) More about json here. // CONVERT RESPONSE TO STRING String result = EntityUtils.toString(response.getEntity()); // CONVERT RESPONSE STRING TO JSON OBJECT JSONObject c = new JSONObject (result); // Storing each json item in variable companyName = c.getString("name"); companyEmail = c.getString("email"); companyAddress = c.getString("address"); companyCity = c.getString("city"); companyZip = c.getString("zip"); companyDescription = c.getString("description");}
answers question: http://stackoverflow.com/q/26000836
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25968331
answers question: http://stackoverflow.com/q/25968198
accepted answer of: http://stackoverflow.com/q/25968198
type: Answer
has comment: http://stackoverflow.com/comment/40660456
upvote count: 1
has comment: http://stackoverflow.com/comment/40660395
score: 1
has comment: http://stackoverflow.com/comment/40660568
has body: Change tv.setOnClickListener((OnClickListener) activity); to tv.setOnClickListener(this); and in onClick method change Toast.makeText(activity, "on click", Toast.LENGTH_SHORT).show(); to Toast.makeText(getActivity(), "on click", Toast.LENGTH_SHORT).show(); and remove Activity activity=getActivity(); because you did initiate it before fragment attached to activity.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25909039
type: Question
linked to: http://stackoverflow.com/q/5282588
tagged with: awtrobot
downvote count: 0
has body: I'm trying to simulate a keystroke with the code below. When I open notepad it works fine but when I open the game in which I want to use it, it doesn't do anything. So keystrokes don’t seem to work. I tried to simulate mouse movement and clicks, those action do work. Does anyone know how to fix this problem? I found this question, How can I use java.awt.Robot inside games? but I can't add a comment or anything. package MyProject; import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; public class KeyStroke { public static void main(String[] args) throws AWTException { Robot robot = new Robot(); robot.delay(3000); robot.keyPress(KeyEvent.VK_Q); robot.keyPress(KeyEvent.VK_W); robot.keyPress(KeyEvent.VK_E); robot.keyPress(KeyEvent.VK_R); robot.keyPress(KeyEvent.VK_T); robot.keyPress(KeyEvent.VK_Y); } }
accepted answer: http://stackoverflow.com/a/25909490
upvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/40553908
tagged with: windows
possible better answer: http://stackoverflow.com/a/52046676
favorite count: 0
has answer: http://stackoverflow.com/a/25909490
linked to: http://stackoverflow.com/q/7463667
has title: java.awt.Robot inside games?
has comment: http://stackoverflow.com/comment/40555209
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25910034
tagged with: java
has answer: http://stackoverflow.com/a/52046676
has comment: http://stackoverflow.com/comment/52827680
has comment: http://stackoverflow.com/comment/40554496

http://stackoverflow.com/q/25887378
linked to: http://stackoverflow.com/q/13581997
possible better answer: http://stackoverflow.com/a/25888006
has answer: http://stackoverflow.com/a/25888006
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3478061
type: Question
tagged with: java
has body: I have a LinkedHashMap&lt;String, String&gt;, which contains some pre-populated data. Now I have a String value, which will match to a key in the above LinkedHashMap. What can I do to retrieve the very next key of the above match? Example: LinkedHashMap hm = new LinkedHashMap(); hm.put("a",1); hm.put("b",2); hm.put("c",3); hm.put("d",4); hm.put("e",5); Now I have a String, say "d" . What is the optimal way if I have to retrieve the value of "e" from the above Map? One way I have found is to convert the map key into LinkedHashSet. Now iterate the Set. Compare the value and get the next value. But isn't there any API available, which can get me all this?
has comment: http://stackoverflow.com/comment/40514342
has answer: http://stackoverflow.com/a/25888496
has comment: http://stackoverflow.com/comment/40514383
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25888496
has title: fetching from LinkedHashMap HashMap based on index

http://stackoverflow.com/comment/97886246
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/39255620
has text: Please add more information. How did you get to this conclusion? where can we verify that your solution is correct apart from copy pasting your code? why does it work?

http://stackoverflow.com/a/26010675
downvote count: 0
answers question: http://stackoverflow.com/q/26006391
has body: Setting the refresh_interval at -1 actually disabled automatic refresh. You can achieve the desired effect by setting the refresh parameter to true like this : client.prepareUpdate(...).setRefresh(true).execute().actionGet(); This way, a refresh operation will be performed immediately after your update and the updated document will be searchable as you wish. Beware: the refresh operation is costly and should not be performed while indexing lots of documents.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/25969044
type: UnansweredQuestion
has body: I have an error when I compile my Java code with this annotation: @Id @Column(name="\"idClass\"", unique=true, nullable=false, columnDefinition = "serial") @GeneratedValue(strategy=GenerationType.AUTO) private Integer idClass; with true in debug it returns: Hibernate: select nextval ('hibernate_sequence') The id column is serial. Any ideas? I've tried to compile with @Generated(GenerationTime.INSERT) but doesn't run. Thanks. [SOLVED] My solution is: @Id @SequenceGenerator(name="IDCLASS_GENERATOR", sequenceName="\"table_idClass_seq\"", allocationSize = 1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="IDCLASS_GENERATOR") @Column(name="\"idClass\"")
has comment: http://stackoverflow.com/comment/40661587
tagged with: postgresql-9.1
has comment: http://stackoverflow.com/comment/40661816
has comment: http://stackoverflow.com/comment/40662323
has answer: http://stackoverflow.com/a/25971418
tagged with: java
tagged with: hibernate
has title: Hibernate annotations for Serial id in Postgres 9.1
type: Question
has comment: http://stackoverflow.com/comment/40663350
has answer: http://stackoverflow.com/a/25969330
has comment: http://stackoverflow.com/comment/40661658
has comment: http://stackoverflow.com/comment/40663849
score: 0
answer count: 2
tagged with: hibernate-annotations
has comment: http://stackoverflow.com/comment/40661619

http://stackoverflow.com/q/25884646
score: 3
tagged with: grails
tagged with: xml-parsing
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43859937
has title: Getting Fatal error when grails app comes up
tagged with: http://stackoverflow.com/tag/xml
has body: As soon as my grails as comes up, I start getting message below [Fatal Error] :28844:3: XML document structures must start and end within the same entity. [Fatal Error] :43878:27: XML document structures must start and end within the same entity. I am using following plugins for now:- compile(":shiro:1.2.1") compile ":restapidoc:0.1.1" runtime ":hibernate:3.6.10.9" // or ":hibernate4:4.3.5.1" compile ":multi-tenant-single-db:0.8.3" build(":release:3.0.1", ":rest-client-builder:1.0.3") { export = false } compile ":quartz:1.0.2" But issue doesn't seems to be with these plugins. Neither I am manipulating any xml nor it seems grails is doing so. Though everything is running well, I am curious why such message is coming. Any help would be much appreciated. Thanks!
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27723987
type: Question

geotools
type: Tag
tags question: http://stackoverflow.com/q/25891831
tags question: http://stackoverflow.com/q/25927181
tag name: geotools

http://stackoverflow.com/comment/40545495
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25904426
has text: but then i am inserting value -- test.put(1, "sd"); Then y an exception

http://stackoverflow.com/q/25880588
tagged with: java
has comment: http://stackoverflow.com/comment/40502621
has comment: http://stackoverflow.com/comment/40503882
score: 0
has comment: http://stackoverflow.com/comment/40504071
answer count: 2
possible better answer: http://stackoverflow.com/a/25881360
has answer: http://stackoverflow.com/a/25881339
has answer: http://stackoverflow.com/a/25881360
has comment: http://stackoverflow.com/comment/40503455
tagged with: iterable
has body: I have a java object that implements the Iterable interface. This linked list has a group of objects that each hold a parameterized object (so it could be a String OR an ArrayList or whatever). In the iterator() method, i create an Iterator object that takes an array of these parameterized items and return it. However, when i use the following code: //create an Iterable object named 'iterate' for(String current : iterate){ //try to do some stuff with it... print it out? } //more code //here is how i implemented the iterator function of my Iterable class: public Iterator&lt;Item&gt; iterator(){ // return an iterator over items in order from front to end Item[] items = (Item[]) new Object[numberOfItems]; QueueItem&lt;Item&gt; item = first; for(int i=0;i&lt;numberOfItems;i++){ items[i] = item.getInfo(); item = item.next; } return new myIterator(items); } //here is the code for the myIterator class. it is a private internal class private class myIterator implements Iterator&lt;Item&gt;{ Item items[]; int index; public myIterator(Item current[]){ items = current; index = 0; } @Override public boolean hasNext() { if(items==null){ return false; } return (index&gt;=items.length); } @Override public Item next() { if(index+1&gt;=items.length){ throw new NoSuchElementException("There are no more elements!"); } return items[index++]; } @Override public void remove() { throw new UnsupportedOperationException("this operation is not supported"); } } the code goes to the for loop, then creates the Iterator object correctly (I used breakpoints to confirm), and returns it, but then the code jumps out of the for loop without going through it even once and continues.... Am i missing something? did i do something wrong here? how do i need to change the implementation of my Iterable object? is there some GOTCHA with implementing this that i'm not taking into account? thanks!
accepted answer: http://stackoverflow.com/a/25881339
has comment: http://stackoverflow.com/comment/40503634
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40502722
type: Question
has title: Java Iterable object won't Iterate correctly

http://stackoverflow.com/q/26021283
linked to: http://stackoverflow.com/q/2099695
tagged with: java
tagged with: stack-memory
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/26021320
tagged with: arrays
has body: Suppose we have the following code: void method() { int[] test = new int[3]; test[0] = 0; test[1] = 1; test[2] = 2; } From what I read from Jon Skeet's post on SO, the new int[3] part is equivalent to: public class ArrayInt3 { public readonly int length = 3; public int value0; public int value1; public int value2; } So does that mean test (a reference to ArrayInt3) is on the stack? And does that mean ArrayInt3 is on the heap? And I suppose value0, value1, and value2 are on the heap as well (i.e. 0, 1, 2 in this example)? So in total, there is 4 objects on the heap, correct?
score: 0
tagged with: heap-memory
has answer: http://stackoverflow.com/a/26021320
has title: What part of an array local variable is stored on the stack? And which part is on the heap?
type: AnsweredQuestion

http://stackoverflow.com/a/26022889
accepted answer of: http://stackoverflow.com/q/26022543
has comment: http://stackoverflow.com/comment/40767738
has body: Inside your BSTNode class, outside of the Insert method, declare int counter = 1; Then, within your else, you would do counter++; So on creating a node, you'd have 1 of the element (since you created it, you know it exists). As additional keys that match are found, you would increment the counter. I do feel like there is an implementation issue with your Insert method (which should be lower-case insert to follow conventions). You're passing a Node t which I assume is the child of the Node. That should probably be declared as a field just like counter is. Sample Pseudocoded Integer-based Node with Duplicates public class Node() { int value; //node's value int counter = 1; //how many items of same type at node Node leftChild = null; Node rightChild = null; public Node(int value) { this.value = value; } public void insert(int newValue) { if(newValue &gt; value) { if(rightChild != null) rightChild.insert(newValue); //we tell the child to deal with it else rightChild = new Node(newValue); //we make it a child } else if(newValue &lt; value) { if(leftChild != null) leftChild.insert(newValue); else leftChild = new Node(newValue); } else if(newValue == value) { counter++; // we found a duplicate, increase count } } }
answers question: http://stackoverflow.com/q/26022543
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40765408
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40764928
has comment: http://stackoverflow.com/comment/40767662
has comment: http://stackoverflow.com/comment/40768280
has comment: http://stackoverflow.com/comment/40765598
has comment: http://stackoverflow.com/comment/40768803

http://stackoverflow.com/comment/41296922
type: QuestionComment
comment on: http://stackoverflow.com/q/25985228
score: 0
has text: Can you post the contents of res.cookies()?
type: Comment

http://stackoverflow.com/comment/40717467
has text: i am using the spring tools suites ide, i dont know what is a layout?
comment on: http://stackoverflow.com/q/25983336
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/79768282
comment on: http://stackoverflow.com/q/26017364
type: Comment
type: QuestionComment
has text: Possible duplicate of [How do I check that a Java String is not all whitespaces?](https://stackoverflow.com/questions/3247067/how-do-i-check-that-a-java-string-is-not-all-whitespaces)
score: 0

http://stackoverflow.com/comment/40748502
type: QuestionComment
has text: @BalvinderSingh, It prints url, which connected with a picture on web-page.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26016699

http://stackoverflow.com/comment/40560561
type: Comment
type: QuestionComment
has text: create a DSN first and then use this line private static final String url = "jdbc:odbc:abc"; Where ABC is the DSN name pointing to CDCollection.accdb
score: 0
comment on: http://stackoverflow.com/q/25912854

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/25896044
tags question: http://stackoverflow.com/q/25915548
type: Tag

http://stackoverflow.com/comment/40585453
type: AnswerComment
has text: yeah you were correct i delete q=Math.sqrt(g); and add on the formula part also y change: if (a!=0||g>0) for (a!=0&&g>0) now the proyect run
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25925863

http://stackoverflow.com/a/25966579
has body: Please could someone tell me why this is happening? You initialize st locally in case 4. It is not visible in case 5. Solution: initialize it outside the switch block. Alternatively, as spotted by Thilo, you can initialize it in case 5, as it doesn't seem to be used anywhere else. case 5: StringTokenizer st = new StringTokenizer(stringInput); System.out.println("Number of tokens:" + st.countTokens()); break; You should be careful not to initialize so many variables locally though, as you can have the very same problem happen again.
type: Answer
answers question: http://stackoverflow.com/q/25966564
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/40656953
downvote count: 0

http://stackoverflow.com/q/25901714
favorite count: 0
has answer: http://stackoverflow.com/a/25903597
has body: I would like to have a limited fixed catalogue of instances of a certain complex interface. The standard multiton pattern has some nice features such as lazy instantiation. However it relies on a key such as a String which seems quite error prone and fragile. I'd like a pattern that uses enum. They have lots of great features and are robust. I've tried to find a standard design pattern for this but have drawn a blank. So I've come up with my own but I'm not terribly happy with it. The pattern I'm using is as follows (the interface is highly simplified here to make it readable): interface Complex { void method(); } enum ComplexItem implements Complex { ITEM1 { protected Complex makeInstance() { return new Complex() { ... } }, ITEM2 { protected Complex makeInstance() { return new Complex() { ... } }; private Complex instance = null; private Complex getInstance() { if (instance == null) { instance = makeInstance(); } return instance; } protected void makeInstance() { } void method { getInstance().method(); } } This pattern has some very nice features to it: the enum implements the interface which makes its usage pretty natural: ComplexItem.ITEM1.method(); Lazy instantiation: if the construction is costly (my use case involves reading files), it only occurs if it's required. Having said that it seems horribly complex and 'hacky' for such a simple requirement and overrides enum methods in a way which I'm not sure the language designers intended. It also has another significant disadvantage. In my use case I'd like the interface to extend Comparable. Unfortunately this then clashes with the enum implementation of Comparable and makes the code uncompilable. One alternative I considered was having a standard enum and then a separate class that maps the enum to an implementation of the interface (using the standard multiton pattern). That works but the enum no longer implements the interface which seems to me to not be a natural reflection of the intention. It also separates…
has comment: http://stackoverflow.com/comment/40540828
has comment: http://stackoverflow.com/comment/40542214
has comment: http://stackoverflow.com/comment/40543979
upvote count: 10
has comment: http://stackoverflow.com/comment/40540781
has comment: http://stackoverflow.com/comment/40540705
has answer: http://stackoverflow.com/a/76040470
answer count: 4
has comment: http://stackoverflow.com/comment/40542311
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40542250
downvote count: 0
has comment: http://stackoverflow.com/comment/40543049
has comment: http://stackoverflow.com/comment/40540836
accepted answer: http://stackoverflow.com/a/25908117
has comment: http://stackoverflow.com/comment/40540862
has answer: http://stackoverflow.com/a/25901760
type: Question
possible better answer: http://stackoverflow.com/a/25903597
tagged with: enums
has comment: http://stackoverflow.com/comment/40540935
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/25908117
has title: Using enum to implement multitons in Java
has comment: http://stackoverflow.com/comment/40542225
has comment: http://stackoverflow.com/comment/40542749
has comment: http://stackoverflow.com/comment/40540812

http://stackoverflow.com/comment/40681323
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25979914
has text: What exactly are you trying to accomplish with that line? You are trying to cast `Application Context` to `Controller` which obviously won't work. If you need a `Context` in `Controller` then you create a constructor there which takes `Context` as a param and pass it your (probably) `Activity Context`

http://stackoverflow.com/q/25882094
tagged with: java
tagged with: equality
has comment: http://stackoverflow.com/comment/40505270
type: Question
has comment: http://stackoverflow.com/comment/40505283
has comment: http://stackoverflow.com/comment/40505235
possible better answer: http://stackoverflow.com/a/25882264
has body: I can't seem to figure out how to test a number to see if it's zero. Couldn't someone please tell me what I'm missing. getMin = Number.class getMax = Number.class Test Number value = mvFacet.getMin() &gt; 0 ? mvFacet.getMin() : mvFacet.getMax(); System.out.println(value.toString());
has answer: http://stackoverflow.com/a/25882264
has answer: http://stackoverflow.com/a/25882179
has title: How to test Number for zero java
upvote count: 4
has comment: http://stackoverflow.com/comment/40505258
answer count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/25882179
downvote count: 2
has comment: http://stackoverflow.com/comment/40505311
has comment: http://stackoverflow.com/comment/40505238
type: AnsweredQuestion
score: 2
tagged with: numbers

http://stackoverflow.com/comment/40675429
comment on: http://stackoverflow.com/a/25976625
type: Comment
has text: Well I'm curious whether we have an option in shiro to keep a cookie to identify a user session until it time out at the server side. In that case changing the sessionid on authenticating is needed as to avoid any session fixation attacks. As a side note the remember me function in shiro is not giving what I'm expecting.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40512051
type: AnswerComment
type: Comment
score: 0
has text: i did it all from terminal, the message send only after pressing 'cntrl-z', ie we using '26'
comment on: http://stackoverflow.com/a/25884311

http://stackoverflow.com/comment/40503413
type: QuestionComment
comment on: http://stackoverflow.com/q/25880963
has text: @DaneAshman it is not clear where your issue is ?
score: 0
type: Comment

http://stackoverflow.com/q/25879983
has answer: http://stackoverflow.com/a/25880153
type: AnsweredQuestion
tagged with: java
has title: Java Leftmost Binary Search
tagged with: search
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25880153
tagged with: arrays
has body: I am trying to modify a Recursive Binary Search function so that it will find the leftmost index of the element given the array contains multiples of that element. import java.util.*; import java.util.Arrays; import java.io.File; import java.io.IOException; public class LeftmostBinarySearch { private static int myBinarySearch(int key, int[] a, int lo, int hi) { if (lo &gt; hi) { return -1; } int mid = lo + (hi - lo) / 2; if (key &lt; a[mid]) { return myBinarySearch(key, a, lo, mid - 1); } else if (key &gt; a[mid]) { return myBinarySearch(key, a, mid + 1, hi); } else { return mid; } } public static int myBinarySearch(int key, int[] a) { return myBinarySearch(key, a, 0, a.length - 1); } public static void main(String[] args) throws IOException { String fileName = args[0] + ".txt"; System.out.println(fileName); Scanner scanner = new Scanner(new File(fileName)); int[] data = new int[7]; int i = 0; int j = 0; while (scanner.hasNextInt()) { data[i] = scanner.nextInt(); i++; } Arrays.sort(data); System.out.format("%2s%2s%2s%2s%2s%2s%2s%2s%2s%2s%2s%2s%2s", " 0", " ", " 1", " ", " 2", " ", " 3", " ", " 4", " ", " 5", " ", " 6\n"); System.out.format("%2s%2s%2s%2s%2s%2s%2s%2s%2s%2s%2s%2s%2s", data[j], " ", data[j + 1], " ", data[j + 2], " ", data[j + 3], " ", data[j + 4], " ", data[j + 5], " ", data[j + 6] + "\n"); int input = new Scanner(System.in).nextInt(); while ((Integer) input != null) { int key = input; System.out.println(data[0]); if (myBinarySearch(key, data) != -1) { System.out.println(input + " found: " + myBinarySearch(key, data)); } input = new Scanner(System.in).nextInt(); } } } The output I have gotten from this is: C:\Users\Shirley\algs4&gt;java LeftmostBinarySearch mydata 0 1 2 3 4 5 6 10 20 20 30 40 40 40 10 10 found: 0 20 20 found: 1 30 30 found: 3 40 40 found: 5 I have tried changing how I calculate mid to (hi + lo - 1)/2 and it works for 40, gives index 3, but for 20 it gives index 2.
has answer: http://stackoverflow.com/a/25880080
tagged with: binary-search
score: 0
possible better answer: http://stackoverflow.com/a/25880080
tagged with: integer

http://stackoverflow.com/comment/40831444
type: AnswerComment
has text: @Noremac, ahh sigh...those forked executions...totally forgot about `-Darguments`. Thanks.
type: Comment
comment on: http://stackoverflow.com/a/25997646
score: 0

http://stackoverflow.com/comment/40534344
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25898135
has text: tell me how to remove this hold and start a search for a new client?
type: AnswerComment

http://stackoverflow.com/comment/40691042
comment on: http://stackoverflow.com/a/25962996
type: AnswerComment
score: 0
type: Comment
has text: @Tony Well, I disagree.

http://stackoverflow.com/q/25972204
has title: Having a class itself as its constructor's only parameter
type: Question
possible better answer: http://stackoverflow.com/a/25972296
score: 3
has comment: http://stackoverflow.com/comment/40668024
has comment: http://stackoverflow.com/comment/40666990
accepted answer: http://stackoverflow.com/a/25972300
has answer: http://stackoverflow.com/a/25972296
answer count: 3
has comment: http://stackoverflow.com/comment/40666899
downvote count: 0
has comment: http://stackoverflow.com/comment/40666855
has comment: http://stackoverflow.com/comment/40667765
favorite count: 0
linked to: http://stackoverflow.com/q/2427883
has answer: http://stackoverflow.com/a/25972300
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40666837
upvote count: 3
tagged with: java
has body: public class Foo{ private String a; private int b; public Foo(Foo foo){ this.a = foo.a; this.b = foo.b; } } Hi everyone. I had this code in a small part I did at work.. My colleague saw this and gave me the "you-don't-deserve-to-breathe" look and went out for about 30 minutes to calm down. (I'm a fresh grad) I've been trying to find out what is the shameful mistake I've made.. It was not successful. Will somebody please explain exactly why is it a bad practice (or idiotic) to have this? The reason I did this was that the class had many params, and I didn't want to have like 3 lines of parameters being passed (using primitive parameters) every time I needed to initialize this object. And, FYI this object is (as we call it in work) a transaction object which is initialized whenever we need to pass around an entity class (it used instead of an entity class). I do have a default constructor as well. Thanks!
has answer: http://stackoverflow.com/a/25972396

http://stackoverflow.com/q/25893705
tagged with: sequence
favorite count: 0
has answer: http://stackoverflow.com/a/25893854
has body: I want to declare integers, while the program is running. I run the program, and then I give it via System.in.println an integer and repeat this as long as I want. I want the program to give those integers a name of a certain type for, for example a(i) or a[i], dunno, (it should be handy) and then a(i) represents the the i'th integer I gave the program. My idea is then that I can use those elements by their name just like, if I had declared them in the first place. For example add two integers together. For example I defined a method add+, which waits for 2 integer and then adds them. For example I write: add a(2) a(47) (then I would get here the result.) I don't think implementing the add function is difficult. However I don't know, how to let the program count the number of inputs or how to let it declare and use variables.
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40525854
type: Question
has answer: http://stackoverflow.com/a/25894449
answer count: 2
linked to: http://stackoverflow.com/q/6729605
has comment: http://stackoverflow.com/comment/40525814
downvote count: 0
has title: How do you create a mathematical sequence in Java?

http://stackoverflow.com/q/25948659
has answer: http://stackoverflow.com/a/25948694
answer count: 1
downvote count: 0
has body: How is it possible, to use components as cell content too, not just string, boolean, and integer. String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" }; String[] columnNames = {"name", "elem"}; Object[][] data = { {"button", new JButton("test")}, {"select", new JComboBox(petStrings)} }; JTable table = new JTable(data, columnNames); Now I can't see the button, and the combobox in the table, only javax.swing.JComboBox... Maybe I should extend JTable somehow, but I have no idea how.
favorite count: 0
tagged with: jtable
tagged with: tablecelleditor
has title: Use components in table cell, not just strings
accepted answer: http://stackoverflow.com/a/25948694
has comment: http://stackoverflow.com/comment/40624510
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/25916099
has comment: http://stackoverflow.com/comment/40568271
answer count: 1
has body: I want to write a simple app , that show a toast when phone is ringing . the text of the that toast is the Incoming call number's last sms . my toast is working well when phone is ringing but when i want to set toast text to last sms of that number , its don't show any toast ?! there is my code : public class callReciver extends BroadcastReceiver { private Toast toast; @Override public void onReceive(Context context, Intent intent) { String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); toast = new Toast(context); if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) { String incomingNumber = intent .getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); toast.setText(getsmsContent(incomingNumber, context)); toast.setDuration(600000); toast.show(); } else { toast.cancel(); } } public String getsmsContent(String number, Context con) { int i = 0; String num = null; boolean Break = false; String smsContent = null; Cursor cursor = con.getApplicationContext().getContentResolver() .query(Uri.parse("content://sms/"), null, null, null, null); cursor.moveToFirst(); do { num = cursor.getString(2); if (num.equals(number)) { smsContent = cursor.getString(5); Break = true; } } while (cursor.moveToNext() && Break); return smsContent; } } manifest.xml : <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_SMS"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.PHONE_STATE" />
has comment: http://stackoverflow.com/comment/40568219
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40568630
tagged with: android
favorite count: 0
has title: cant read last sms in BroadcastReceiver
has comment: http://stackoverflow.com/comment/40567003
tagged with: android-broadcast
has comment: http://stackoverflow.com/comment/40568799
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25917862
accepted answer: http://stackoverflow.com/a/25917862
tagged with: java
has comment: http://stackoverflow.com/comment/40567970
type: Question
tagged with: broadcastreceiver
has comment: http://stackoverflow.com/comment/40568037

http://stackoverflow.com/comment/40734793
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61818/discussion-between-vaishali-and-jabari-johnson).
type: Comment
comment on: http://stackoverflow.com/a/26008952
score: 0

http://stackoverflow.com/q/25992041
has answer: http://stackoverflow.com/a/25992183
tagged with: java
has title: String date to java sql date conversion
tagged with: date
accepted answer: http://stackoverflow.com/a/25992108
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40703196
tagged with: sqldatetime
has comment: http://stackoverflow.com/comment/40703394
answer count: 4
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/40703580
has answer: http://stackoverflow.com/a/25992108
upvote count: 2
has answer: http://stackoverflow.com/a/25992320
linked to: http://stackoverflow.com/q/13982870
has body: i need to format this String date Tue Sep 23 14:36:59 PKT 2014 to java sql date but i need both date and time, i tried this String st = "Tue Sep 23 14:36:59 PKT 2014"; new java.sql.Date(new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy").parse(st).getTime()) but it returns only date part and time part is 00:00 can any one help me to sort this issue out. Regards and thanks in advance.
type: Question
has answer: http://stackoverflow.com/a/25992442
possible better answer: http://stackoverflow.com/a/25992183

http://stackoverflow.com/comment/40687403
type: QuestionComment
has text: @DavidConrad updated question, please check at Performance trace Update:
score: 0
comment on: http://stackoverflow.com/q/25982650
type: Comment

http://stackoverflow.com/comment/40665106
type: AnswerComment
has text: I'm not an expert in Java workings, however the first step you list (which is probably what takes the bunch of time, since all the others may happend with `new A()` as well as noted by Holger) *could* be optimized away since `Class.forName("A")` is a constant expression, and the compiler *could* produce code very similar to the one produced by `new A()`. Obviously this optimization cannot work with `Class.forName(aGenericExpressionReturningAString)`. Not surprised that the string literal case isn't optimized since, AFAIK, there's really no reason for that idiom.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25967516

http://stackoverflow.com/comment/40675040
type: QuestionComment
comment on: http://stackoverflow.com/q/25975679
score: 0
has text: @AndreaLigios but i am not using spring, our application is purely struts2
type: Comment

http://stackoverflow.com/q/25922221
has title: "Your security settings have blocked a self-signed application from running" with a real pfx signed jar
type: AnsweredQuestion
tagged with: jarsigner
tagged with: java
has answer: http://stackoverflow.com/a/25923692
type: Question
tagged with: security
score: 0
answer count: 1
tagged with: applet
accepted answer: http://stackoverflow.com/a/25923692
has body: I actually jarsign a java applet with this command : jarsigner -storetype pkcs12 -keystore my_real_certificate.pfx my_applet.jar my_alias_certificate -storepass my_password When I launch my applet, I get the following error : Your security settings have blocked a self-signed application from running When I want to verify the jar, the result appears as following : jar verified. Warning: This jar contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing. This jar contains entries whose certificate chain is not validated. This jar contains signatures that does not include a timestamp. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2017-05-22) or after any future revocation date. For this warning : This jar contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing I guess my certificate is not proper for jarsigning code. Could you tell me if this kind of warning would get me that kind of error on the client ? Or could I still use this certificate ? For this warning : This jar contains entries whose certificate chain is not validated. I don't understand because my certificate was really validated by a CA (Thawte). Should I indicate to Java or into my Windows certificate manager the complete certificate chain (with CA Root and intermediate) ? If so, what happens for the users of this applet ? Should they also do this ? Thanks in advance for your answers.

http://stackoverflow.com/q/25961377
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/39271078
tagged with: facebook
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: facebook-login
has comment: http://stackoverflow.com/comment/45011775
answer count: 1
downvote count: 0
favorite count: 0
has body: I followed facebook documentation to create a simple app with a login button. Now, I wish to hide the login button after the user has already logged in. I read here on stackoverflow that I should save the access token string and it's expiry date, and check if it's 'expired' (ignoring the case it can be expired at any time by facebook - just theoreticaly) or if it wasn't inserted yet (points that user hasn't logged in), and then show/hide the button respectively. I tried adjusting the following method: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_main, container, false); LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton); authButton.setFragment(this); authButton.setReadPermissions(Arrays.asList("public_profile", "user_friends")); if(!hasToShowLogin()){ authButton.setVisibility(View.GONE); } return view; } the code in the method 'hasToShowButton' is not relevant because it works, it's just for the demo. The code above should hide button when the view is first created, and this one should hide the button after the login accomplished, and located in OnActivityResult: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data); View view = getView(); LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton); authButton.setVisibility(View.GONE); } What happens is that the button keep showing no matter what, and is working as usual. So to conclude, what I'm trying to do is: Hide login button after successful login Hide login button in the following times the user enters the app (In other words: never show login button when user is logged in) Been breaking my head over this for HOURS. thanks for the helpers! P.S Just noticed that although setVisibility doesn't hide the button, the button d…
has title: Android - hide Facebook login button

http://stackoverflow.com/comment/40587248
type: AnswerComment
score: 0
type: Comment
has text: how can I do that, do you mind showing me how? much appreciated
comment on: http://stackoverflow.com/a/25926455

http://stackoverflow.com/comment/40673739
score: 0
type: AnswerComment
type: Comment
has text: @IvnBubrov also try to understand what the code is doing :-)
comment on: http://stackoverflow.com/a/25975799

http://stackoverflow.com/comment/40661510
score: 0
has text: Possibly duplicate of http://stackoverflow.com/questions/19160921/how-do-i-check-if-a-char-is-a-vowel
comment on: http://stackoverflow.com/q/25968933
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26022904
score: 3
accepted answer of: http://stackoverflow.com/q/26022699
answers question: http://stackoverflow.com/q/26022699
downvote count: 0
upvote count: 3
has body: Execute the updateData() method on the FX Application Thread using Platform.runLater(). (Additionally, I think the Thread.sleep(...) is redundant, since you are using a scheduled executor.) ses.scheduleWithFixedDelay(new Runnable() { @Override public void run() { runtime += 1000; Platform.runLater(() -&gt; updateData()); } }, 0, 500, TimeUnit.MILLISECONDS);
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40739175
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26003649
type: Comment
has text: Did some more testing and looks like a side-effect of this is that, despite the user changing the destination field, the value of the variable assigned to that field remains the same as one set via the Input Validation Expression on the user name field. Is there any workaround so that I can have a default set using the input validation but still allow the user to manually modify the destination field with whatever path he wants?

http://stackoverflow.com/q/25899566
tagged with: static
has answer: http://stackoverflow.com/a/25899641
type: UnansweredQuestion
tagged with: war
has answer: http://stackoverflow.com/a/25899647
type: Question
tagged with: java
tagged with: jboss
score: 0
answer count: 2
has body: Here is what I did: Compiled the file that contains the changed final static value. Updated the corresponded .class file in the sever with the file that compiled in step 1 Changed "xxx.war.deployed" to "xxx.war.dodeploy" to re-deploy the war. After this, I guess the final static value should be updated, but it didn't. Only that I deleted the entire war file, upload and deploy it again. The value updated finally. So, what caused this? Do final static values have the same life time as JVM?
has title: final static value didn't update after JBoss AS war re-deployed
tagged with: jvm

http://stackoverflow.com/comment/40726574
comment on: http://stackoverflow.com/a/26003843
has text: As usual when optimising, know how fast you need the code to go and measure and adjust frequently.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40702284
score: 1
has text: this is the second ....i post the first too ...moment
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25991514

http://stackoverflow.com/a/25881275
answers question: http://stackoverflow.com/q/25881201
has body: Use the multi-value API: for(String v : entry.getAttributeValues("description")) { System.out.println(String.format("description value: %s", v)); }
accepted answer of: http://stackoverflow.com/q/25881201
type: Answer
upvote count: 4
downvote count: 0
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/40504031

http://stackoverflow.com/q/26020607
favorite count: 0
tagged with: spring
score: 2
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/26021215
has body: I have a compile problem which is strange. I am not able to fix this. The same peice of code works fine in another project org.mockito.Mockito.when(jdbcTemplate.query(org.mockito.Matchers.anyString(), org.mockito.Matchers.any(BeanPropertyRowMapper.class))).thenReturn(SOMELIST); I am getting error as The method query(String, ResultSetExtractor&lt;T&gt;) in the type JdbcTemplate is not applicable for the arguments (String, BeanPropertyRowMapper) But When I do this, I do not get any error. But I am not expecting this. BeanPropertyRowMapper&lt;MyClass&gt; mapper = new BeanPropertyRowMapper&lt;MyClass&gt;(MyClass.class); org.mockito.Mockito.when(jdbcTemplate.query(org.mockito.Matchers.anyString(), mapper)).thenReturn(SOMELIST); I am not sure if this is an Eclipse problem. Appreciate your help on this.
tagged with: java
has title: The method query(String, ResultSetExtractor<T>) in the type JdbcTemplate is not applicable for the arguments (String, BeanPropertyRowMapper)
type: Question
tagged with: junit4
tagged with: mockito
has answer: http://stackoverflow.com/a/26033509
accepted answer: http://stackoverflow.com/a/26033509
has comment: http://stackoverflow.com/comment/40755318
upvote count: 2
answer count: 2
tagged with: mocking
has answer: http://stackoverflow.com/a/26021215
has comment: http://stackoverflow.com/comment/40778399

http://stackoverflow.com/comment/40620762
score: 0
type: Comment
has text: Thanks for the solution, but what if I wan't to traverse to the inside objects and put the classname for them. Can you please suggest how to do that?
comment on: http://stackoverflow.com/a/25944577
type: AnswerComment

zipkin
type: Tag
tag name: zipkin
tags question: http://stackoverflow.com/q/26016714

http://stackoverflow.com/a/25898533
has body: Maybe just delete an existing alias and add new one? $ keytool -delete -alias mydomain -keystore keystore.jks Few helper functions $ keytool -list -v -keystore keystore.jks $ keytool -list -v -keystore keystore.jks -alias mydomain If you ever need to export private keys use this answer for reference. Normal keytool commands don't export private key part. How do I list / export private keys from a keystore?
score: 1
answers question: http://stackoverflow.com/q/25898028
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/25928116
tagged with: jax-rs
favorite count: 0
has body: I am currently working on Grails Application where I have REST API using jaxr PlugIn. The scenario is that there is a Third Party who says that give us a URL and we will send you the notifications on that URL.So I created a REST API with post method. So I can send data using this post method. So,I gave this URL to that third party which now sends me notifications over that URL. And in the body of that POST method in my REST API gets the notification and do what I want to. So, I used Spring Security Core to authenticate my other features of application. And I wasn't intended to secure this REST API that I implemented using Jaxr PlugIn. But after using that Spring Security Core plugin my Rest API stopped working as it has restricted this REST API too. I tested it on my machine too and send post requests but this plugin is not allowing me to make request due to authentication issue. Please guide me that what I should do in this scenario? I don't want to secure my REST, can I proceed with this? Thanks for your precious time :)
tagged with: rest
type: UnansweredQuestion
tagged with: grails-plugin
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25928238
has title: Working with REST API Calls while Using Spring Security Core PlugIn
tagged with: grails
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/40735532
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26007910
has text: Something like http://stackoverflow.com/questions/2458305/adding-folder-to-eclipse-classpath and http://stackoverflow.com/questions/12266761/eclipse-adding-all-the-jars-from-a-folder-in-java-classpath and http://stackoverflow.com/questions/18768861/how-to-place-source-directory-in-build-path-in-eclipse might help

http://stackoverflow.com/a/26203410
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25975520
score: 8
accepted answer of: http://stackoverflow.com/q/25975520
type: Answer
downvote count: 0
upvote count: 8
has body: Be sure the exception is being thrown catch (SQLException e) { String message = e.getMessage(); String[] errorsArray = AuthErrorsConst.ERROR; for (int i = 0; i &lt; errorsArray.length; i++) { if (message.contains(errorsArray[i])) { System.out.println("throwing LoginException")// NEW throw new LoginException(); // LOOK AT THIS } } throw e; } About @Aspect public class LogoutAdvice { @AfterThrowing(throwing = "e") public void myAfterThrowing(JoinPoint joinPoint, LoginException e) { System.out.println("IDS HABBENING"); } } Be sure Spring has enable to work with @Aspect and furthermore it be able to scan your LogoutAdvice aspect, normally I declare them how @Aspect @Component// to be scanned by Spring public class LogoutAdvice { Change your @AfterThrowing to @AfterThrowing(pointcut = "execution(* *.*(..))",throwing = "e")

http://stackoverflow.com/a/25900702
type: Answer
score: 1
upvote count: 1
has body: The simplest way to achieve what you want is to use Thread.join(timeout). Also, do not use synchronized, wait, or notify on Thread objects. This will interfere with the Thread.join implementation. See the documentation for details. Here's what your main program would look like: public static void main(String[] args) { MyProcess t = new MyProcess(); t.start(); try { t.join(10000L); } catch (InterruptedException ie) { System.out.println("interrupted"); } System.out.println("Main thread resumes"); } Note that when the main thread resumes after the join() call, it can't tell whether the child thread completed or whether the call timed out. To test this, call t.isAlive(). Your child thread of course could do anything, but it's important for it not to use synchronized, wait, or notify on itself. For example, here's a rewrite that avoids using these calls: class MyProcess extends Thread { public void run() { System.out.println("MyProcess starts"); for (int i = 0; i &lt; 5; i++) { try { System.out.println("MyProcess sleeps"); sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println("MyProcess finishes"); } }
accepted answer of: http://stackoverflow.com/q/25896989
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25896989

http://stackoverflow.com/comment/40595967
type: AnswerComment
score: 0
type: Comment
has text: Very much appreciate that explanation. Thanks for the link @Alexander_Winter
comment on: http://stackoverflow.com/a/25931850

http://stackoverflow.com/q/25880071
has comment: http://stackoverflow.com/comment/40501895
has comment: http://stackoverflow.com/comment/40502291
has comment: http://stackoverflow.com/comment/40501818
type: Question
tagged with: setvalue
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40501869
has body: I'm trying to work with % (modulus operator), where I have a number which is for example 1215 and I want to change it with "x" number so it shows x15.. I was thinking on doing the following x= 10;//(for example) time = 1215; settime = (time/100)%100;//(it's gonna get rid of the 15 and grab the 12) settime= x; //Now I'm stock in this part on how to set that to the time without changing the minutes("15") //so it desplays 1015?
answer count: 0
tagged with: java
has title: using % (modulus) to set variables in Java

http://stackoverflow.com/q/26026033
has comment: http://stackoverflow.com/comment/40766037
has title: Distinguish between read and connection timeouts in HttpURLConnection
has comment: http://stackoverflow.com/comment/40766255
has comment: http://stackoverflow.com/comment/40765891
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40765722
tagged with: android
has body: I want to distinguish between a connection timeout and a read timeout when using HttpURLConnection. It throws SocketTimeoutException when any of the two happen. In case a connection timeout happens, a message is included as the exception message. Example: failed to connect to /192.168.X.X (port X) after Xms In case a read timeout happens, no message is included. Relevant: setConnectTimeout setReadTimeout Of course I could distinguish them by the fact that one seems to include a message and the other does not, but doesn't seem sensible. If the implementation changes the code breaks. I would have expected two different exceptions. Perhaps there's something I'm missing.
tagged with: httpurlconnection
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40765927
upvote count: 1
has answer: http://stackoverflow.com/a/26026543
type: Question
accepted answer: http://stackoverflow.com/a/26026543

http://stackoverflow.com/comment/40657460
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25966734
has text: I'd say you need some kind of logic to figure out whether to print `#` or `*`. How would you express this condition in terms of `l` and `w` (which, by the way, are terrible variable names)?

http://stackoverflow.com/q/26012701
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40740970
tagged with: java
accepted answer: http://stackoverflow.com/a/26013226
type: Question
tagged with: stretched
has body: I have created a dropdown spinner with a background custom image. I have placed the spinner in a linear layout and I have aligned items using weight. Here is my code - XML - &lt;LinearLayout android:id="@+id/csbar" android:windowSoftInputMode="adjustPan" android:paddingTop="8dp" android:paddingBottom="8dp" android:layout_alignParentBottom="true" android:layout_width="match_parent" android:background="#101010" android:layout_height="wrap_content"&gt; &lt;ImageButton android:id="@+id/run" android:layout_width="0dp" android:layout_height="@dimen/height" android:layout_weight="1" android:background="@null" android:contentDescription="@string/nul" android:src="@drawable/ic_action_play" /&gt; &lt;ImageButton android:id="@+id/save" android:layout_width="0dp" android:layout_height="@dimen/height" android:layout_weight="1" android:background="@null" android:contentDescription="@string/nul" android:src="@drawable/ic_action_save" /&gt; &lt;Spinner android:id="@+id/more" android:layout_width="0dp" android:layout_weight="1" android:background="@drawable/ic_action_sort_by_size" android:layout_height="@dimen/height"/&gt; &lt;/LinearLayout&gt; Java - int firstC = 0; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { /////I have removed rest of the code to make it more legible///// Spinner more = (Spinner) rootView.findViewById(R.id.more); ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(getActivity(), R.array.more, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); more.setAdapter(adapter); more.setOnItemSelectedListener(this); } @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { ((TextView)view).setText(null); } Here is the output - As you can see the sort by size icon (icon on right) appears stretched. How I want it to look like - What is wrong with my code? Please help.
answer count: 1
downvote count: 0
tagged with: android-spinner
tagged with: android
has answer: http://stackoverflow.com/a/26013226
has title: Spinner's background image appears stretched
favorite count: 0
has comment: http://stackoverflow.com/comment/40741027
upvote count: 1

http://stackoverflow.com/comment/40752419
has text: Can you not order them by cost then state?
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26019123
type: Comment

http://stackoverflow.com/q/25931170
score: 0
answer count: 1
tagged with: linux
has title: Context path is not setting in tomcat 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25968854
has body: One of our project we deployed in tomcat 5.5. our code is not an war file. deployed as a jar. and we did not deploy directly under webapps . we created new folder and placed everything over there. and we configured that path in server.xml under context tag &lt;code&gt; &lt; Context path="/ABC" docBase="/app/apache-tomcat-5.5.26/webapps/ABC/" debug="1" reloadable="true" crossContext="true"&gt; &lt; /Context&gt; &lt;/code&gt; The problem is. we were able to land on home page but the images are not load and none of the links are not working Home page link ; //ip:port/ABC/home.jsp when we click any of the links then the context path is getting removed like the below one of the link : //ip:port/firstlink.jsp please help me where we have to config the context path Thanks in advance
has comment: http://stackoverflow.com/comment/40595653
tagged with: java
tagged with: tomcat5.5
type: Question
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40658869

http://stackoverflow.com/q/25980461
tagged with: eclipse
type: Question
answer count: 1
has body: I am using Google Search API in eclipe follwing this example. The above mentioned example says that it would return results as follows:- total: 4 Title: ProgramCreek.com URL: http://www.programcreek.com/ Title: Top 8 Diagrams for Understanding Java - ProgramCreek.com URL: http://www.programcreek.com/2013/09/top-8-diagrams-for-understanding-java/ Title: Top 10 Methods for Java Arrays - ProgramCreek.com URL: http://www.programcreek.com/2013/09/top-10-methods-for-java-arrays/ I used the code and Search for "Car".Code is as follows:- public class TestGoogleSea { public static void main(String[] args) throws IOException, { // more than 4 results google start here ...................... for (int i = 0; i < 20; i = i + 4) { String address = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&start="+i+"&q="; String query = "Car"; String charset = "UTF-8"; URL url = new URL(address + URLEncoder.encode(query, charset)); Reader reader = new InputStreamReader(url.openStream(), charset); GoogleResults results = new Gson().fromJson(reader, GoogleResults.class); // Show title and URL of each results StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); for (int m = 0; m <= 3; m++) { writer.println("----------------------------------------------------------------"); try { System.out.println("Title: " + results.getResponseData().getResults().get(m).getTitle()); System.out.println("URL: " + results.getResponseData().getResults().get(m).getUrl() + "\n"); } catch (Exception e){ e.printStackTrace(); } } writer.println("----------------------------------------------------------------"); String string = stringWriter.toString(); } //..............google code ends here............................................ } } class GoogleResults{ private ResponseData responseData; public ResponseData getResponseData() { return responseData; } public void setResponseData(ResponseData responseData) { this.responseData = responseData; } public String…
score: 0
has comment: http://stackoverflow.com/comment/40682140
type: UnansweredQuestion
has title: Format Specifier markup in results returned by Google API
has comment: http://stackoverflow.com/comment/40682839
has answer: http://stackoverflow.com/a/26189560
tagged with: java
has comment: http://stackoverflow.com/comment/40719559
tagged with: google-search-api

http://stackoverflow.com/a/25979222
type: Answer
has comment: http://stackoverflow.com/comment/40741604
score: 3
upvote count: 3
has body: Your method: @SessionScoped @Produces protected NonSerializableObject produceNonSerializableObject() {} produces @SessionScoped object, which is not serializable. All @RequestScoped, @SessionScoped, and @ApplicationScoped beans must be Serializable. So it would work, if you would removed @SessionScoped from the producer method.
accepted answer of: http://stackoverflow.com/q/25977706
answers question: http://stackoverflow.com/q/25977706
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40699231

http://stackoverflow.com/comment/40744245
type: QuestionComment
comment on: http://stackoverflow.com/q/26014094
score: 0
has text: That's exactly what I meant.
type: Comment

http://stackoverflow.com/q/25904927
has title: Parsing CDATA String as response from webservice
type: Question
has comment: http://stackoverflow.com/comment/40546344
answer count: 1
favorite count: 0
tagged with: cdata
tagged with: parsing
linked to: http://stackoverflow.com/q/8489151
type: UnansweredQuestion
score: 0
upvote count: 1
downvote count: 1
has body: I have below string CDATA format from the response of a webservice call. String outputString = " XYZ ABCD " When i tried with DOM parser. This string is giving exception. DocumentBuilder builder; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); builder = factory.newDocumentBuilder(); Document outputXMLDocument = builder.parse(new InputSource(new StringReader(outputString))); NodeList nodes = outputXMLDocument.getElementsByTagName("MYTAG"); I want to parse this respone and retrieve the value of NAME and ADDRESS TAG. Please advice for best way to handle this.
has comment: http://stackoverflow.com/comment/40546607
has comment: http://stackoverflow.com/comment/40546321
has answer: http://stackoverflow.com/a/25905273
tagged with: java

http://stackoverflow.com/a/25912523
score: 0
type: Answer
has body: Now you may not be able to use SXSSFWorkbook (as it's write-only), but you may be able to convert your program to streaming-style using the SAX-based API. Edit: Another thing you may want to try is to create the XSSFWorkbook from File instead of InputStream (I remember reading somewhere that the File-based code needs less memory). (First try was: Since you are reading data sequentially the SXSSFWorkbook class should be just the thing you need.)
answers question: http://stackoverflow.com/q/25912394
has comment: http://stackoverflow.com/comment/40559889

http://stackoverflow.com/q/25943500
type: UnansweredQuestion
has title: How to take a screenshot with java from directX
score: 3
tagged with: screenshot
upvote count: 3
tagged with: java
has body: I'm looking for a way to take a screenshot with a Java application of any running directX game. I use the following code Robot robot = new Robot(); GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); BufferedImage screenshot = robot.createScreenCapture(config.getBounds()); ImageIO.write(screenshot,"png", file); This one works perfectly anywhere but in directX games. I'm not that familiar with Java and even less with DirectX, I'm just trying to adjust this code. I googled very much, but everything just leads to the same code I already have. Do you know of another way to take a screenshot of DirectX games? Thanks.
type: Question
has answer: http://stackoverflow.com/a/25943817
tagged with: directx
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/1962142
favorite count: 0

http://stackoverflow.com/comment/40684304
has text: Makes sense. Thanks.. Yup, I ended up using the checkBox followed by a List of Labels.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25977972
type: Comment

http://stackoverflow.com/comment/41234086
comment on: http://stackoverflow.com/a/26092071
type: AnswerComment
score: 0
type: Comment
has text: In such case how much heap space do we need to provide to process a file of size more than 2GB. Please suggest. As i am using windows 7 OS and 64 bit JVM, there is no limitation to set the more heap space. but the business requirement is limiting it to 1GB. For information **http://publib.boulder.ibm.com/infocenter/javasdk/tools/index.jsp?topic=%2Fcom.ibm.java.doc.igaa%2F_1vg000139b8b453-11951f1e7ff-8000_1001.html**

http://stackoverflow.com/q/25880267
has body: Please help me, i have some problem in here. this is my BandaraMap.java : public class BandaraMap extends FragmentActivity implements OnInfoWindowClickListener, ActionBar.OnNavigationListener { private GoogleMap map; private JSONHelper json; private ProgressDialog pDialog; private LatLng myLocation; private List&lt;Map_POI&gt; listPOI_Bandara; private final String URL_API = "http://laraswedding.com/56410097/data_bandara.php"; private final String URL_API_Selected1 = "http://laraswedding.com/56410097/data_bandara.php?key=Bandara_Halim_Perdana_Kusuma"; private final String URL_API_Selected2 = "http://laraswedding.com/56410097/data_bandara.php?key=Bandara_Soekarno-Hatta"; public static final String KEY_NAMA = "nama"; public static final String KEY_ALAMAT = "alamat"; public static final String KEY_LAT_TUJUAN = "lat_tujuan"; public static final String KEY_LNG_TUJUAN = "lng_tujuan"; public static final String KEY_LAT_ASAL = "lat_asal"; public static final String KEY_LNG_ASAL = "lng_asal"; //private LatLng user_location; // Members for layout private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle mDrawerToggle; private ListView mDrawerList; private CharSequence mTitle; private CharSequence mDrawerTitle; private String[] mTitles; ActionBar actionBar; @Override protected void onCreate(Bundle savedInstanceState) { /*requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);*/ super.onCreate(savedInstanceState); setContentView(R.layout.test_map); InitSpinnerLayout(); InitNavigationDrawableLayout(); json = new JSONHelper(); /*myLocation = new LatLng(map.getMyLocation().getLatitude(), map.getMyLocation().getLongitude()); map.animateCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(myLocation.latitude, myLocation.longitude), 13));*/ new AsynTaskMain().execute(); setupMapIfNeeded(); //bounds = boundsBuilder.build(); //map.animateCamera(CameraUpdateFactory.newLatLngBounds…
score: -1
tagged with: google-maps
answer count: 1
has comment: http://stackoverflow.com/comment/40502118
has comment: http://stackoverflow.com/comment/40502663
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40502178
has answer: http://stackoverflow.com/a/25880486
tagged with: java
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/40502446
type: Question

http://stackoverflow.com/a/25975918
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25975263
type: Answer
score: 1
has body: A more generic solution for Excel like CSV This looks like to have been originally tab-separated text, tabs replaced by multiple spaces. The double quotes suggests CSV like from Excel. As text between double quotes may contain a line break (multiline text), I start of with the entire text. String encoding = "Windows-1252"; // English, best would be "UTF-8". byte[] textAsBytes = Files.readAllBytes(file.toPath()); String text = new String(textAsBytes, encoding); Excel uses for (Windows) line endings "\r\n". And in multi-line text "\n". String[] lines = text.split("\r\n"); Splitting on multiple spaces .split(" +") might break inside a quoted field. So I use a pattern. This pattern uses either something quoted, where any internal quote is self-escaped as two quotes. Or a sequence of non-whitespace. Pattern pattern = Pattern.compile("\"^([^\"]|\"\")*\"|\\S+"); for (String line: lines) { List&lt;String&gt; fields = new ArrayList&lt;&gt;(); Matcher m = pattern.matcher(line); while (m.find()) { String field = m.group(); if (fields.startsWith("\"") &amp;&amp; field.endsWith("\"") &amp;&amp; field.length() &gt;= 2) { field = field.substring(1, field.length() - 1); // Strip quotes. field = field.replace("\"\"", "\""); // Unescape inner quotes. } fields.add(field)); } ... }

prolog
tags question: http://stackoverflow.com/q/25891788
type: Tag
tag name: prolog

http://stackoverflow.com/comment/40536084
type: QuestionComment
comment on: http://stackoverflow.com/q/25899269
has text: Did you override the equals() and hashCode() in the domain class?
score: 0
type: Comment

http://stackoverflow.com/a/26026394
has comment: http://stackoverflow.com/comment/87745273
has comment: http://stackoverflow.com/comment/40814751
has comment: http://stackoverflow.com/comment/87726647
upvote count: 37
answers question: http://stackoverflow.com/q/25893476
has comment: http://stackoverflow.com/comment/87717440
has comment: http://stackoverflow.com/comment/87711622
score: 37
has body: The session-per-request pattern uses one JDBC connection per session if you run local transactions. For JTA, the connections are aggressively released after each statement only to be reacquired for the next statement. The Hibernate transaction API delegates the begin/commit/rollback to the JDBC Connection for local transactions and to the associated UserTransaction for JTA. Therefore, you can run multiple transactions on the same Hibernate Session, but there's a catch. Once an exception is thrown you can no longer reuse that Session. My advice is to divide-and-conquer. Just split all items, construct a Command object for each of those and send them to an ExecutorService#invokeAll. Use the returned List to iterate and call Future#get() to make sure the original thread waits after all batch jobs to complete. The ExecutorService will make sure you run all Commands concurrently and each Command should use a Service that uses its own @Transaction. Because transactions are thread-bound you will have all batch jobs run in isolation.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25893476
has comment: http://stackoverflow.com/comment/87727424
has comment: http://stackoverflow.com/comment/87746285

http://stackoverflow.com/a/52046676
has body: Any time people experience problems with the java.awt.Robot methods not registering on a program, most likely it is because the methods are not releasing the key/mouse stroke or do not have a delay between press/release. This goes for mouse clicks and keystrokes alike. There are two things to check- If you are using robot.keyPress(key) make sure to have a robot.keyRelease(key) following at some point. Make sure to have a big enough delay delay between the Press and Release. Rule of thumb 100 ms Examples Incorrect robot.keyPress(key); // without a keyRelease robot.keyPress(key); robot.keyRelease(key); // no delay Correct robot.keyPress(key); Thread.sleep(100) // or robot.delay(100); robot.keyRelease(key);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25909039

http://stackoverflow.com/q/26033789
accepted answer: http://stackoverflow.com/a/26063065
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40784098
has comment: http://stackoverflow.com/comment/40784116
has comment: http://stackoverflow.com/comment/40784453
type: Question
tagged with: layout
possible better answer: http://stackoverflow.com/a/26040345
has title: Adding JPanels to JFrame one after another vertically, each touches the border horizontally
has answer: http://stackoverflow.com/a/26040345
has comment: http://stackoverflow.com/comment/40793449
upvote count: 3
downvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/26040632
favorite count: 0
has comment: http://stackoverflow.com/comment/40791117
has comment: http://stackoverflow.com/comment/40779383
tagged with: jframe
has comment: http://stackoverflow.com/comment/40789676
tagged with: swing
has comment: http://stackoverflow.com/comment/40785361
has comment: http://stackoverflow.com/comment/40784808
has body: I want to add JPanels to JFrame one after another vertically. Each panel should cover the whole width of jframe. These panels should cover the width even if the frame is re sized. I want to have this using any layout. Threads shouldn't be used. Grab the point from the included images what I want to have. Thanks in advance. Any try of help will be greatly appreciated... Here is the code you requested and down voted me for... public class AttachToWalls extends JFrame implements ActionListener { JLabel m1; JLabel m2; JPanel pane; JPanel bottom = new JPanel(); JScrollPane jsp; JButton sender = new JButton("Sender"); JButton receiver = new JButton("Receiver"); AttachToWalls() { setLayout(new FlowLayout()); jsp = new JScrollPane(pane); add(jsp, BorderLayout.CENTER); sender.addActionListener(this); receiver.addActionListener(this); bottom.add(sender); bottom.add(receiver); add(bottom); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == sender) { m1 = new JLabel("Message from Sender..."); remove(sender); remove(receiver); Component comp = Box.createHorizontalStrut(this.getWidth() - m1.getWidth()); comp.setBackground(Color.red); JPanel pane1 = new JPanel(); pane1.setBackground(Color.gray); pane1.add(m1); pane1.add(comp); add(pane1); this.validate(); } else if (e.getSource() == receiver) { m2 = new JLabel("Messsage from Receiver..."); Component comp = Box.createHorizontalStrut((int) this.getWidth() - m2.getWidth()); comp.setBackground(Color.red); JPanel pane2 = new JPanel(); pane2.setBackground(Color.gray); pane2.add(m2); pane2.add(comp); add(pane2); this.validate(); } } public static void main(String[] args) { new AttachToWalls(); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40833280
has answer: http://stackoverflow.com/a/26063065

http://stackoverflow.com/comment/40544725
type: QuestionComment
comment on: http://stackoverflow.com/q/25903856
score: 1
has text: Have a look at [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) and [How to Use CardLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) for some better ideas
type: Comment

http://stackoverflow.com/comment/102431704
score: 0
type: Comment
comment on: http://stackoverflow.com/a/51056992
type: AnswerComment
has text: Great thanks a lot. I was stuck in this situation for 2 days. :)

http://stackoverflow.com/a/25936577
downvote count: 0
has body: This is not the answer to your question but I suggest you consider using a template engine to compose your emails, such as Velocity or Jelly http://velocity.apache.org/ http://commons.apache.org/proper/commons-jelly/ This way you can compose your templates as HTML or XML and inject there any relevant data your logic may have retrieved (and even some logic integrated in their own template languages, such as if-then-else or while-loop structures). In the very worst case that is completely necessary to render the full JSP, you could hack something on RequestDispatcher::include You could execute this method from your MyEmailAction, but passing it a hacked ServletResponse. This would be some class written by you implementing ServletResponse... but writing the result in some ByteArrayOutputStream. After the page is rendered (on your fake ServletResponse) you could just retrieve it from there (actually using the servlet container as your own template engine)
answers question: http://stackoverflow.com/q/25936387
has comment: http://stackoverflow.com/comment/40603835
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/25980288
has comment: http://stackoverflow.com/comment/40684204
has comment: http://stackoverflow.com/comment/40683599
has comment: http://stackoverflow.com/comment/40681994
has body: I have seen many related questions but I can not spot where I am doing it wrong. I appreciate if anyone can help me. When I add only one MapView to the LinearLayout, map is working fine. But when I try to add one button or textView or anything in the layout it crashes in run time! I have three separate fragments. First one is called FragmentA.java and Fragment_a.xml Here is Fragment_a.xml file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;com.google.android.maps.MapView android:id="@+id/mapView" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;Button android:id="@+id/googlemaps_select_location" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="Select"/&gt; &lt;/RelativeLayout&gt; And here is FragmentA.java I am not sure if View v = inflater.inflate(R.layout.fragment_a, container, false); is correct. fragment_a, as I said is the name of the fragment which contain complete view: public class FragmentA extends Fragment { MapView mapView; GoogleMap map; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_a, container, false); // Gets the MapView from the XML layout and creates it mapView = (MapView) v.findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); // Gets to GoogleMap from the MapView and does initialization stuff map = mapView.getMap(); map.getUiSettings().setMyLocationButtonEnabled(false); map.setMyLocationEnabled(true); MapsInitializer.initialize(this.getActivity()); // Updates the location and zoom of the MapView CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(43.1, -87.9), 10); map.animateCamera(cameraUpdate); return v; …
has comment: http://stackoverflow.com/comment/40683759
has title: How to add MapView and other component in a LinearLayout?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25981641
linked to: http://stackoverflow.com/q/4512981
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/40683099
has comment: http://stackoverflow.com/comment/40683492
has comment: http://stackoverflow.com/comment/40682045
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/40683584
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40682851
accepted answer: http://stackoverflow.com/a/25981641
tagged with: android

http://stackoverflow.com/comment/40569094
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25912460
has text: @AndreaLigios: I have figured out that in the struts.xml `allowStaticMethodAccess` value was already set to true, if I set it to false other web pages data becomes inconsistent. Nevetheless, I tried making it false and setting the windowState as you mentioned above , but the url which is formed is still "normal" i.e. `p_p_state=normal`. So the issue is still unresolved.

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/26023829
tags question: http://stackoverflow.com/q/25932677
type: Tag
tags question: http://stackoverflow.com/q/25916099

http://stackoverflow.com/a/25950787
has body: After the use of groupId like this ?groupId, groupId becomes a parameter and the later part of the URL becomes its value. so if you dont want to change the existing URL patterns your request handling method should be like below: @RequestMapping(value = "/schedule") public String deleteLesson(@RequestParam("groupId") String restOfTheUrl) { log.info(restOfTheUrl); // your code } After logging it you should see, for example: 1/delete/2 Now you have to parse it for having groupId and lesson id for deletion. But if you want to handle it in your way, your code should be like: @RequestMapping(value = "/schedule/groupId/{groupId}/delete/{lessonId}") // convert you request param to path varriable public String deleteLesson(@PathVariable("lessonId") Integer lessonId, @PathVariable("groupId") Integer groupId) { lessonRepository.delete(lessonId); return "redirect:/schedule?groupId=" + groupId; } To learn more: difference between a @PathVariable and a @RequestParam
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25950686
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/25950686

http://stackoverflow.com/comment/40602703
type: AnswerComment
comment on: http://stackoverflow.com/a/25935932
type: Comment
score: 1
has text: newQueue = newQueue.dequeue();

http://stackoverflow.com/comment/40570761
comment on: http://stackoverflow.com/q/25918103
score: 0
has text: I am new in this programming language. Is there anything to do about the Punct array named points beside " points = new Punct[num];"?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/39873409
downvote count: 0
answers question: http://stackoverflow.com/q/26016947
has body: try { String rawJSON = "{\"aps\":{\"alert\":\""+"your message"+"\"},\"alerts\":{\"others\":\""+others+"\"}}"; PushNotificationPayload payload=PushNotificationPayload.fromJSON(rawJSON); Push.payload(payload, "path of certificate.p12", password,false, appleDeviceToken); } catch (Exception e) { }
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/comment/40505270
type: QuestionComment
comment on: http://stackoverflow.com/q/25882094
has text: doesn't `if(value == 0)` check if it is zero or not?
score: 4
type: Comment

http://stackoverflow.com/q/26014157
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: My app has a widget with two buttons that goes back and forth and displays information stored in a JSONArray. It works very well but the problem is when i close the app the widget stops working because the JSONArray becomes null. How can i keep it working even when the app is closed ? its too long to post it here but this is the part when i click next button if(intent.getAction().equals(NEXT_LISTING)){ try{ if (listingNumber !=15) { listingNumber++; } JSONObject latestListing = jsonListings.getJSONObject(listingNumber); String titleString = latestListing.getString("title"); String descriptionString = latestListing.getString("description"); String categoryString = latestListing.getString("category"); Date postDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse(latestListing.getString("created")); Date newDate = new Date(postDate.getTime() + Utils.getCurrentTimezoneOffset() * (3600 * 100)); String createdDate = Utils.getFormattedDate(newDate); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.njoftime_widget); views.setTextViewText(R.id.title, titleString); views.setTextViewText(R.id.description, descriptionString); views.setTextViewText(R.id.textView_category, categoryString); views.setTextViewText(R.id.textView_date, createdDate); for(int i=0; i &lt; categoriesList.size();i++) { if(categoriesList.get(i).get(0).equals(latestListing.getString("category"))) { views.setImageViewResource(R.id.category_icon_widget, iconList.get(i)); } } if(listingThumbnails.get(listingNumber) != null) { views.setViewVisibility(R.id.listing_photo, View.VISIBLE); views.setImageViewUri(R.id.listing_photo, Uri.parse("")); Bitmap roundedBitmap = getRoundedLeftCornerBitmap(listingThumbnails.get(listingNumber), 10); views.setImageViewBitmap(R.id.listing_photo,roundedBitmap); } else { views.setViewVisibility(R.id.listing_photo, View.GONE); } // Instruct the widget manager to update the widget ComponentName componentName = new ComponentName(context, NjoftimeWidget.class…
has comment: http://stackoverflow.com/comment/40743632
answer count: 0
downvote count: 0
tagged with: widget
has title: How to keep alive a JSONArray for widgets?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40743079
has comment: http://stackoverflow.com/comment/40743740
type: Question
has comment: http://stackoverflow.com/comment/40743218
upvote count: 1
has comment: http://stackoverflow.com/comment/40743295

http://stackoverflow.com/a/25965087
has body: The problem is because your class LabOne resides in a package called labone. You are most probably inside the folder labone and you ran javac LabOne.java and it succeeded. But when you will try to run it using java LabOne it is going to fail. The solution is cd up one level and execute: javac labone/LabOne.java java labone/LabOne and it will work. This answer deals with a similar problem. You can also try adding the package to the classpath but it doen't look like your class is dependent on other classes for now, so doing that might be an overkill.
answers question: http://stackoverflow.com/q/25964965
type: Answer
has comment: http://stackoverflow.com/comment/40654337
has comment: http://stackoverflow.com/comment/40654338
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25964965

http://stackoverflow.com/a/26003061
answers question: http://stackoverflow.com/q/26002932
accepted answer of: http://stackoverflow.com/q/26002932
upvote count: 1
type: AcceptedAnswer
has body: You can get the OS info using System.getProperty like String property = System.getProperty("os.name"); Moreover you can use Files.copy() to simplify your code(and if you want more control then use StandardCopyOption). e.g. Files.copy(src, Paths.get("/opt/myprogram/App_Data/Session.db")); so your updated code can look something like this public static void copyFileUsingFileStreams(File source, File dest) throws IOException { String property = System.getProperty("os.name"); if (property.equals("Linux")) { dest = Paths.get("/opt/myprogram/App_Data/Session.db").toFile(); } //add code to adjust dest for other os. Files.copy(source.toPath(), dest.toPath()); }
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/26013852
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26013386
has body: You don't call printMatrix. Call printMatrix(n) after n = input.nextInt();. You may want to print the result in the method itself (Because that's what it's name implies), and change it's type to void, or print the returned String in main.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/40637222
type: Comment
has text: @Hovercraft Full Of Eels well i was reading through a swing sample source code i wanted to use in my app and came across the first two concepts i wanted to know why not thread?? how different are they and can i interchange them and have no risk of crashing my app
comment on: http://stackoverflow.com/q/25955951
score: 0
type: QuestionComment

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/25942081
tags question: http://stackoverflow.com/q/25991128
tags question: http://stackoverflow.com/q/26019144
tag name: maven-jaxb2-plugin
tags question: http://stackoverflow.com/q/26011446

http://stackoverflow.com/comment/40615578
comment on: http://stackoverflow.com/q/25942556
type: Comment
has text: @JoshuaTaylor True, with reflection it's possible to identify a field that's named like the passed String argument. I have a very hard time imagining a valid reason to do so, so it would be nice to learn more about the actual problem.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40593341
has text: @greg-449: hello there.. u got my problem?
score: 0
comment on: http://stackoverflow.com/q/25930306
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40536929
comment on: http://stackoverflow.com/q/25899226
has text: Post the configurations you've done and other relevant info to replicate this problem.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25893009
downvote count: 0
has body: Can use scriptlet &lt;%= %&gt; in table data, &lt;%=ADuser.getFirstName()%&gt; Or can use jsp expression ${} like this post &lt;% request.setAttribute("firstName", ADuser.getFirstName()); %&gt; //then in table data &lt;td..&gt;${firstName}&lt;/td&gt;
has comment: http://stackoverflow.com/comment/40524644
score: 1
answers question: http://stackoverflow.com/q/25892822
upvote count: 1
has comment: http://stackoverflow.com/comment/40524545
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25892822
type: Answer

http://stackoverflow.com/a/25976541
answers question: http://stackoverflow.com/q/25976370
has body: If you want to get a value from JOptionPane you should use this: String result = JOptionPane.showInputDialog(null, "Jivin' Java Coffee Shop" + "\nCoffee" + "\n(1)American 1.99" + "\n(2)Expresso 2.50" + "\n(3)Latte 2.15" + "\nMake selection. Press 0 to quit"); if(result != null){ menuNum = Integer.parseInt(result); }
score: 0
type: Answer

http://stackoverflow.com/a/25905861
answers question: http://stackoverflow.com/q/25905699
score: 0
type: Answer
has body: Is there any way to enumerate private fields so that I can avoid this behaviour, for example one by one and catching the exception and carry on with rest of the fields? I don't think this is the right approach. You should not catch errors. NoClassDefFoundError is an Error. An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.

http://stackoverflow.com/q/25882136
has comment: http://stackoverflow.com/comment/40505383
has comment: http://stackoverflow.com/comment/40505369
has answer: http://stackoverflow.com/a/25882198
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40505572
has answer: http://stackoverflow.com/a/25882156
score: 0
has answer: http://stackoverflow.com/a/25882177
answer count: 3
linked to: http://stackoverflow.com/q/8779659
has body: public double calculateMPG() { double a = (this.myEndMiles - this.myStartMiles); return ((a) / (this.gallons)); } How would I make this function spit out 12.50 instead of 12.5 Thanks
has title: How to add 0 to decimal instead of 12.5 it will be 12.50

http://stackoverflow.com/comment/40716139
type: Comment
has text: Please read the javadoc. If `Object` is the field and `field` is the field, what's the point? (`Object` is the object whose field's value you want to get.)
type: QuestionComment
comment on: http://stackoverflow.com/q/25999185
score: 0

http://stackoverflow.com/q/25947698
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/40626873
has comment: http://stackoverflow.com/comment/40623389
has comment: http://stackoverflow.com/comment/40655375
has comment: http://stackoverflow.com/comment/40624364
score: 0
has comment: http://stackoverflow.com/comment/40624173
has body: I have an auto jni header file created with javah. Now i want to edit this header file and add/edit some functions. What is the best way to manually edit the jni header file? Things that i really need to know is: how to correctly map the variables and pointers between c/c++ and java. For example if i have a function in my c/c++ project like this: int test(unsigned int * id,unsigned char name[8],const unsigned char input[13]) now what are the mapping between int,char,const...,string,pointers, etc... /* * Class: First * Method: test * Signature: ()I */ JNIEXPORT jint JNICALL Java_First_test (JNIEnv *, jobject, /*what should i add here?*/);
tagged with: c++
answer count: 0
has comment: http://stackoverflow.com/comment/40625167
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40625195
type: Question
tagged with: java-native-interface
tagged with: java
has title: how to edit JNI generated header file

http://stackoverflow.com/comment/40559556
has text: I simply did it by increasing the connection time attribute in tomcat server.Any way thanks
score: 1
comment on: http://stackoverflow.com/q/25889586
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26013733
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26558027
type: Question
has title: Jung: Add legends to the frame
tagged with: user-interface
downvote count: 0
answer count: 1
has body: I need to add legends to my frame to show the meaning of different colored links and nodes. Does Jung have some in built legend functionality? Or do I need make my own by adding an extra panel to the right.
favorite count: 0
has answer: http://stackoverflow.com/a/26558027
tagged with: jung2
upvote count: 1

http://stackoverflow.com/a/32807637
has body: I faced the same problem. What fixed it for me was to set the base path for your FopUserAgent object so it knows the path to your image. Then you can specify your image relative to this path. // images are located in or in subfolders of baseDir String baseDir = /some/path/to/includes/ FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.setBaseURL(baseDir); Furthermore, in order to make it work with a jar I had to add the following imports: import org.apache.xmlgraphics.image.loader.ImageManager; import org.apache.xmlgraphics.image.loader.impl.DefaultImageContext; /* Added this line to my code to get these imports. Not using it at all */ ImageManager imageManager = new ImageManager(new DefaultImageContext()); The reason was that apparently the fop.jar uses the same names for its settings as does the xmlgraphics-commons jar (which handles the images). So in order to not have fop.jar override the settings xmlgraphics I had to use said imports. Unfortunately, this only seems to work on my machine. Testing the jar on other PCs causes the same error again. Maybe you have more luck. If so let me know. (Running Debian 8, OpenJDK7, FOP 1.1)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25946952

towers-of-hanoi
tag name: towers-of-hanoi
tags question: http://stackoverflow.com/q/25983129
tags question: http://stackoverflow.com/q/26029299
type: Tag

http://stackoverflow.com/a/25923533
has comment: http://stackoverflow.com/comment/40582179
has comment: http://stackoverflow.com/comment/40581074
downvote count: 0
has comment: http://stackoverflow.com/comment/40582290
type: Answer
answers question: http://stackoverflow.com/q/25923429
has comment: http://stackoverflow.com/comment/40581212
upvote count: 1
score: 1
has body: Do Math.abs like T.J. Crowder suggested, but also do catch NumberFormatException when parsing the input Change your SQL statement to use bound variables, like this String sql = "UPDATE reading SET Cubic_meter=? WHERE Reading_Number= ?"; ps = conn.prepareStatement(sql); ps.setInt(1, cm); // assuming always positive ps.setInt(2, v1); http://en.wikipedia.org/wiki/Prepared_statement Using bound variable is a good practice to guard against SQL injection.

http://stackoverflow.com/comment/49297083
type: Comment
has text: OK, thanks. I was surprised there was no standard example for how to do this famous problem from Hadoop's examples
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/30431131

http://stackoverflow.com/comment/40723364
comment on: http://stackoverflow.com/a/26002223
score: 0
type: AnswerComment
has text: i forgot to explain how i get the url, it s during a selenium test where i click on a link to download the file. So here the missing code: driver.findElement(By.linkText(DownloadPDFlink)).click(); then i try to get the url with System.out.println("HREF ="+driver.findElement(By.linkText(DownloadPDF)).getAttribute("href")); and after i use thr url object to download the file.
type: Comment

jax-rs
tags question: http://stackoverflow.com/q/25888387
tags question: http://stackoverflow.com/q/25875947
tags question: http://stackoverflow.com/q/25993922
tags question: http://stackoverflow.com/q/26002462
tags question: http://stackoverflow.com/q/25962753
tags question: http://stackoverflow.com/q/25996562
tags question: http://stackoverflow.com/q/25973944
tags question: http://stackoverflow.com/q/25928116
tags question: http://stackoverflow.com/q/25875367
tags question: http://stackoverflow.com/q/25988851
tags question: http://stackoverflow.com/q/26009801
tags question: http://stackoverflow.com/q/25987868
tags question: http://stackoverflow.com/q/26024742
type: Tag
tags question: http://stackoverflow.com/q/26014656
tags question: http://stackoverflow.com/q/25916796
tags question: http://stackoverflow.com/q/25989815
tags question: http://stackoverflow.com/q/25915049
tags question: http://stackoverflow.com/q/25877575
tags question: http://stackoverflow.com/q/25922920
tag name: jax-rs

http://stackoverflow.com/comment/40723986
type: QuestionComment
has text: I'm assuming you've seen this: http://stackoverflow.com/questions/7337457/accessing-hbase-running-in-vm-with-a-client-on-host-system
comment on: http://stackoverflow.com/q/26002871
score: 0
type: Comment

http://stackoverflow.com/comment/98805334
has text: @MiguelLavigne, there are default timeouts. 10 seconds for connecting and 10 seconds for reading. See the docs: https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html#callTimeoutMillis--
type: AnswerComment
comment on: http://stackoverflow.com/a/25973778
score: 0
type: Comment

http://stackoverflow.com/comment/40754024
score: 2
has text: but the simple fact is you cannot do that then how comes the question of someone can do it
type: AnswerComment
comment on: http://stackoverflow.com/a/26019771
type: Comment

http://stackoverflow.com/q/25950676
has title: Resize single ImageView inside ListView
tagged with: listview
has comment: http://stackoverflow.com/comment/47288713
has answer: http://stackoverflow.com/a/25951163
has comment: http://stackoverflow.com/comment/40628207
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
has answer: http://stackoverflow.com/a/25950705
tagged with: java
has body: I need to change an ImageView based on a condition, the problem is that ImageView sizes can be change only via ImageView.getLayoutParameters().width/height, doing so will change the width of each and every item inside the ListView. Is there a way of changing the size of a single ImageVIew? As for now I can't find a way of doing it.
type: Question
tagged with: android-layout
answer count: 2
has comment: http://stackoverflow.com/comment/40627570

http://stackoverflow.com/q/25984389
has answer: http://stackoverflow.com/a/25984468
has answer: http://stackoverflow.com/a/25984534
score: 2
has answer: http://stackoverflow.com/a/66895654
downvote count: 0
has comment: http://stackoverflow.com/comment/40689845
tagged with: string
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40689810
has comment: http://stackoverflow.com/comment/40689802
has comment: http://stackoverflow.com/comment/40689784
answer count: 5
possible better answer: http://stackoverflow.com/a/25984436
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25984436
tagged with: java
has answer: http://stackoverflow.com/a/25985520
has body: How would you take a string that you have input from the keyboard and rearrange it? For example, in my case I am asking the user to import a person's name in "last name, first name" format. I then have to change that to "first name last name". Here is what I have so far: private void setName() { Scanner in = new Scanner(System.in); System.out.println("Please enter the last name followed by the first name of" + "a student: "); name = in.nextLine(); }
type: Question
has title: How can I separate a string in Java from full name to last name, first name?
accepted answer: http://stackoverflow.com/a/25985520

http://stackoverflow.com/a/25979388
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/25979298
answers question: http://stackoverflow.com/q/25979298
type: AcceptedAnswer
downvote count: 0
has body: You can use instanceof operator and casting inside your for loop e.g. for (LoanBook book : books) { if (book instanceof STLoanBook) { ((STLoanBook)book).reserve(); } }
type: Answer

tcp
type: Tag
tags question: http://stackoverflow.com/q/26028606
tags question: http://stackoverflow.com/q/25986290
tags question: http://stackoverflow.com/q/25931649
tags question: http://stackoverflow.com/q/25970420
tags question: http://stackoverflow.com/q/25925132
tags question: http://stackoverflow.com/q/25950362
tags question: http://stackoverflow.com/q/25977868
tag name: tcp
tags question: http://stackoverflow.com/q/25903240

http://stackoverflow.com/q/25920664
has body: Please, help: I am using cucumber-jvm+WebDriver+jUnit+maven with Page Object pattern for Automation Testing. I want to have a method which can return multiple types of objects. (different expected pages). In my past i used Generics to implement it with clear java+Webdriver. In This Post there is a good explanation of this. But now i want to inplement it with cucumber. My Project Structure looks next way: Driver base class: public class DriverBase { public static WebDriver driver; @Before public void setUp() { driver = new FirefoxDriver(); @After public void tearDown() throws Exception { driver.quit(); } } Navigator Class for interacting between page objects: public class Navigator { DriverBase base; WebDriver driver; public NavigationActions(DriverBase base) { this.base = base; this.driver = base.driver; } public FirstPage openFirstPage(){ driver.get("someUrl"); return new FirstPage(base); } } Page objects classes: public class FirstPage { WebDriver driver; DriverBase base; //... //Elements locators... //Some methods... //... public FirstPage(DriverBase base) { this.base = base; this.driver = base.driver; PageFactory.initElements(driver, this); } public &lt;T&gt; T openSecondOrThirdPage(String secondPgUrl, Class&lt;T&gt; expectedPage) { driver.get("secondPgUrl"); return PageFactory.initElements(driver, expectedPage); } and public class SecondPage { WebDriver driver; DriverBase base; //... //Elements locators... //Some methods... //... public SecondPage(DriverBase base) { this.base = base; this.driver = base.driver; PageFactory.initElements(driver, this); } } My StepsDefinition class: public class MyTestStepsDefs { DriverBase base; Navigator navigator; @Given("^bla-bla$"){ public void go_from_first_to_second_page() { navigator.openFirstPage().openSecondOrThirdPage("http://urlOfMyPage.com", SecondPage.class); } @When("^blu-blu$") public void login_with_selected_role() { System.out.println("Some log"); } @Then("^blo-blo$") public void check_links_available(List&lt;Stri…
accepted answer: http://stackoverflow.com/a/26151992
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40589056
tagged with: generics
favorite count: 0
linked to: http://stackoverflow.com/q/13371699
has comment: http://stackoverflow.com/comment/40586533
upvote count: 1
has answer: http://stackoverflow.com/a/26151992
type: AnsweredQuestion
tagged with: pageobjects
score: 1
tagged with: java
has title: Generics with Cucumber-jvm and Page Objects don't work
tagged with: webdriver
type: Question
tagged with: cucumber

http://stackoverflow.com/q/25953902
tagged with: java
has comment: http://stackoverflow.com/comment/40633567
type: Question
has comment: http://stackoverflow.com/comment/40633550
has comment: http://stackoverflow.com/comment/40633548
has comment: http://stackoverflow.com/comment/40633580
has answer: http://stackoverflow.com/a/25954044
accepted answer: http://stackoverflow.com/a/25954044
has body: In main I do this: First I create a new customer with its first name, lastname and number. Then I create two savingsAccounts, with its amount, id and interest rate. I then add the two savingsAccounts to the new customer. Finally I add the new customer to the bank. Customer newCustomer = new Customer(firstName, lastName, pnumber); SavingsAccount savingsAccount1 = new SavingsAccount(400, "1", 4); //400$ into account no.1, with interest 4% SavingsAccount savingsAccount2 = new SavingsAccount(300, "2", 3); newCustomer.addAccount(savingsAccount1); newCustomer.addAccount(savingsAccount2); bank.addCustomer(newCustomer); Here is class Bank: public class Bank { String bankName; private ArrayList&lt;Customer&gt; customers = new ArrayList&lt;Customer&gt;(); Bank(String bankName) { this.bankName = bankName; } public void addCustomer(Customer newCustomer) { customers.add(newCustomer); } } Here is class Customer: public class Customer { private String firstName; private String lastName; private String number; private ArrayList&lt;Account&gt; accounts; Customer(String firstName, String lastName, String number) { this.firstName = firstName; this.lastName = lastName; this.number = number; this.accounts = new ArrayList&lt;Account&gt;(); } public void addAccount(SavingsAccount account) { accounts.add(account); } public void addAccount(CreditAccount account) { accounts.add(account); } public ArrayList&lt;Account&gt; getAccounts() { return accounts; } } Here is class SavingsAccount (that inherits class Account): public class SavingsAccount extends Account { public SavingsAccount() { super(); } public SavingsAccount(double bal, String id, double inte) { super(bal, id, inte); } @Override public void deposit(String number, String id, double amount) { } @Override public void withdraw(String number, String id, double amount) { } @Override public void transfer(String number, String id, double amount) { } @Override public double getBalance() { } @Override public String getAccountId() { return a…
score: 0
has comment: http://stackoverflow.com/comment/40633535
answer count: 1
has comment: http://stackoverflow.com/comment/40637651
has comment: http://stackoverflow.com/comment/40633644
has comment: http://stackoverflow.com/comment/40633545
has comment: http://stackoverflow.com/comment/40633468
has title: Get specific element from ArrayList
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40634123

http://stackoverflow.com/comment/40695629
has text: 25 and 50 is included... so you also think the question is hard to understand. Thank you, i thought am the only one that dont understand english. I feel like an idiot when i keep asking question on how to approach the problem and yet i dont understand how to do it because i just dont see the solution for this problem.
comment on: http://stackoverflow.com/a/25987222
type: Comment
score: 0
type: AnswerComment

jboss7.x
tags question: http://stackoverflow.com/q/25932370
type: Tag
tags question: http://stackoverflow.com/q/25980547
tags question: http://stackoverflow.com/q/25929395
tags question: http://stackoverflow.com/q/25885297
tags question: http://stackoverflow.com/q/25913946
tag name: jboss7.x
tags question: http://stackoverflow.com/q/25905686
tags question: http://stackoverflow.com/q/25874551
tags question: http://stackoverflow.com/q/25977082
tags question: http://stackoverflow.com/q/25947403
tags question: http://stackoverflow.com/q/25989802

http://stackoverflow.com/comment/40615704
comment on: http://stackoverflow.com/a/25942434
has text: Yes, this is the desired layout! The problem is that I cant get it to work using only one gridbaglayout. I cant find a way to add all the elements in only one frame with only one gridbaglayout and reproduce this result.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25882180
tagged with: access-specifier
duplicate of: http://stackoverflow.com/q/902922
answer count: 1
tagged with: inheritance
tagged with: protected
has title: Why is a protected variable visible at class level?
favorite count: 0
score: 0
tagged with: visibility
has body: A protected variable is access to any class within a package and only to a subclass that extends the base class outside the package. Why did Java implemented this in this was i.e default within package instead of private within package? This is defeating the whole purpose of having blocking access to your variables. The definition of protected access modifier in java is that if you define classA has a protected variable x -- then x is visible to every class in the same package and it is also visible to any class outside the package but extends classA. I feel that within the package level it should be private instead of default access. I am sure Java might have a good reason behind it, and I want to know what this might be.
has answer: http://stackoverflow.com/a/25882227
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/25882227
has comment: http://stackoverflow.com/comment/40505347
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40505544
linked to: http://stackoverflow.com/q/902922
type: Question
has comment: http://stackoverflow.com/comment/40505447

http://stackoverflow.com/q/26014621
has answer: http://stackoverflow.com/a/26014903
upvote count: 0
tagged with: sorting
possible better answer: http://stackoverflow.com/a/26014903
has body: Hi I'm trying to sort an object based on a value of that object. Originally I used TreeMap which did the sorting but there were some non-unique keys which were removed so that didn't work. I googled around and came across Guava MultiMap. But how do I actually use this to sort the values? Basically I'm trying to sort budget information based on the diffYTD_percentage value. Thanks! Multimap&lt;Double, BudgetInformation&gt; multiMap = ArrayListMultimap.create(); for (Budget budget : budgets) { BudgetInformation budgetInfo = getBudget(budget.getId()); double actualToDate = budgetInfo.getActualToDate(); double budgetToDate = budgetInfo.getTotalBudgetToDate(); double diffYTD_value = budgetToDate - actualToDate; double diffYTD_percentage_value = 0.0; if (budgetToDate != 0.0) { double fraction = actualToDate / budgetToDate; fraction = fraction - 1; diffYTD_percentage_value = fraction * 100; } multiMap.put(diffYTD_percentage_value, budgetInfo); } Iterator&lt;BudgetInformation&gt; budgetIterator = multiMap.values().iterator();
answer count: 2
has answer: http://stackoverflow.com/a/26016573
favorite count: 0
tagged with: multimap
tagged with: dictionary
score: -1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26016573
tagged with: guava
tagged with: java
downvote count: 1
has title: How to sort object using a multi map?
type: Question

http://stackoverflow.com/comment/40698573
has text: I found the bug Alex. As you said I go through the codes. And finally found that the issue is with the reader. The tips you mentioned were right. Well, I am going to post my next question, with the new issue. Thanks Alex
type: Comment
comment on: http://stackoverflow.com/a/25913527
score: 0
type: AnswerComment

http://stackoverflow.com/q/25943522
has comment: http://stackoverflow.com/comment/40616966
has comment: http://stackoverflow.com/comment/40617967
has answer: http://stackoverflow.com/a/25944029
has comment: http://stackoverflow.com/comment/40616877
has comment: http://stackoverflow.com/comment/40616920
favorite count: 0
has comment: http://stackoverflow.com/comment/40617201
has comment: http://stackoverflow.com/comment/40616835
has title: How do I improve the below algorithm to recursively remove adjacent duplicate characters from right to left in a string?
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40616870
has comment: http://stackoverflow.com/comment/40616898
score: 2
has body: The problem statement is to remove duplicates in a string recursively. For eg: abcddaacg -> abccg-> abg Now the algorithm I implemented is thus: Keep 2 pointers (i and j). i is always &lt; j. str[j] is always the element str[i] compares to remove duplicates. Hence when j = 6 and i = 5, I replace both of them with '\0' and then I update j to 7 (c). Then when j = 4 and i = 3 (both are d, j got updated cause str[4] != str[6] and hence j = i, became j = 4) we update both of them to '\0'. My problem is with the next step when I update j to 7. For this I have to search for the next character which is not '\0'. This, is what is making it a O(n^2) implementation. How can I make this better ? O(n) Below is the code: static void remDups (String input) { char [] str = input.toCharArray(); int j = input.length()-1; int i = input.length()-2; while (i &gt;= 0){ if (str[i] == str[j]) { str[i] = '\0'; str[j] = '\0'; j++; while (str[j] == '\0' &amp;&amp; j &lt; str.length) { j++; } } else { j = i; } i--; } i = 0; while (i &lt; input.length()) { if (str[i] != '\0') System.out.print(str[i]); i++; } }
has comment: http://stackoverflow.com/comment/40616936
has comment: http://stackoverflow.com/comment/40616819
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/25943614
type: Question
answer count: 2
downvote count: 0
tagged with: string

http://stackoverflow.com/comment/40661650
type: AnswerComment
has text: I've seen this link: http://www.java2s.com/Code/Java/JPA/ManyToOneCascadeRemove.htm they do remove a many-to-one relation but this doesn't seem to work. Thanks
type: Comment
comment on: http://stackoverflow.com/a/25968501
score: 0

http://stackoverflow.com/comment/40561133
type: QuestionComment
has text: ...I didn't see that.
comment on: http://stackoverflow.com/q/25912963
score: 0
type: Comment

http://stackoverflow.com/comment/40641297
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25956775
score: 0
has text: @Jongware can you write a answer?

http://stackoverflow.com/comment/87179127
has text: I was suffering today from this problem and in addition to all the things mentioned a possible caused might be memory. In my case elasticsearch was starting fine but as soon as I tried to connect with the transport client it couldn't find the node and the server froze. Modifying the jvm.options file in /etc/elasticsearch and adjust the memory might help others
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25912572
type: Comment

http://stackoverflow.com/q/25906175
linked to: http://stackoverflow.com/q/20767708
has answer: http://stackoverflow.com/a/26013967
linked to: http://stackoverflow.com/q/12431148
tagged with: codenameone
answer count: 1
has comment: http://stackoverflow.com/comment/40548524
downvote count: 0
has comment: http://stackoverflow.com/comment/40548611
tagged with: macos
favorite count: 0
linked to: http://stackoverflow.com/q/12017193
score: 5
tagged with: swing
tagged with: retina-display
has comment: http://stackoverflow.com/comment/49336840
accepted answer: http://stackoverflow.com/a/26013967
type: AnsweredQuestion
has title: Is There A Way To Disable Mac OS Retina Scaling For A Swing App?
linked to: http://stackoverflow.com/q/14716743
tagged with: java
has body: We have a rather complex application that needs as much screen real-estate as it can get, naturally the retina display Mac Books are excellent for this purpose. However, it seems that in Swing those devices use points rather than pixels. They allow me to change the icons to higher resolution versions as discussed here. But since we do a lot of complex graphics and components overlays I want to just use "real pixels". To be clear I am not interested in fixing blurry images or icons (not practical in my case) just to disable the pixel doubling. There is this interesting (albeit hacky) option I found thru this question.
has comment: http://stackoverflow.com/comment/40548482
type: Question
upvote count: 5

http://stackoverflow.com/q/25953056
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
upvote count: 2
answer count: 2
has body: My Spring @Controller needs to access fields of a passed object in JSON format. I would like to avoid building many classes to map every request response to. For example, I need to connect store two foreign keys. They are passed as {"key1": 1,"key2": 2} to the controller. How to access those fields if I don't have an object which has 2 fields to map those properties? How to set up the Spring controller method? My code: @RequestMapping(value = "/addProductPart", method = RequestMethod.POST, consumes = "application/json") @ResponseBody public String addProductPart(Model model, @RequestBody Object json, BindingResult result){ // access somehow key1 and of json Object UPDATE: I know I can get it working using RequestMethod.GET and @RequestParam, but since I modify data I need RequestMethod.POST or RequestMethod.PUT. SOLVED: @RequestMapping(value = "/addProductPart", method = RequestMethod.PUT, consumes = "application/json") @ResponseBody public String addProductPart(Model model, @RequestBody Object obj){ ... int p = (Integer)((Map)obj).get("part"); ... }
possible better answer: http://stackoverflow.com/a/25956306
has title: How to access fields of converted JSON object sent in POST body?
has answer: http://stackoverflow.com/a/25956306
tagged with: rest
favorite count: 0
has answer: http://stackoverflow.com/a/25954297
accepted answer: http://stackoverflow.com/a/25954297
tagged with: spring

http://stackoverflow.com/q/25961278
upvote count: 0
tagged with: arrays
answer count: 1
favorite count: 0
tagged with: while-loop
has title: using Math.pow combinations on an array for 1% relative error
has answer: http://stackoverflow.com/a/25961568
accepted answer: http://stackoverflow.com/a/25961568
downvote count: 1
type: AnsweredQuestion
has body: I was wondering about how you access and calculate values from a single array that must be accessed by multiple variables. The situation is your given an array of type double with these elements... -5.0, -4.0, -3.0, -2.0, -1, -1 / 2, -1 / 3, -1 / 4, 0, 1 / 4, 1 / 3, 1 / 2, 1, 2, 3, 4, 5 and the goal is to use this with the Math.pow() function to do a sequence of calculations on w,x,y, and z until a combination of these calculations are within 1% relative error to the original number entered. An example is user enters 3.14 for starting value then they enter 4 positive numbers that are not equal to 1 for values w,x,y, and z. The goal is raise w,x,y, and z to powers using the Math.pow() function with the exponent being elements of the powerArray. These powers must change inside a while loop and later a for loop until the product of w,x,y, and z raised to a certain combination of the elements of the powerArray are within 1% relative error to the original 3.14. My issue is figuring out how in a while loop how to access this powerArray and be able to have the indexes change while accessing the array on variables w,x,y, and z until there product of these powers are within the 1% relative error of the original number. Please help :) import java.util.Scanner; public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); double epilson, valueW, valueX, valueY, valueZ; int i = 0, j = 0, k = 0, l = 0; double approx = 0; boolean checkValue = true; double[] powerArray = { -5.0, -4.0, -3.0, -2.0, -1, -1 / 2, -1 / 3, -1 / 4, 0, 1 / 4, 1 / 3, 1 / 2, 1, 2, 3, 4, 5 }; System.out.print("Enter a value for epilson u: "); epilson = keyboard.nextDouble(); while (checkValue) { System.out.print("Enter value for w: "); valueW = keyboard.nextDouble(); System.out.print("Enter value for x: "); valueX = keyboard.nextDouble(); System.out.print("Enter value for y: "); valueY = keyboard.nextDouble(); System.out.print("Enter value for z: "); valueZ = keyboard.nextDouble(); if ((…
tagged with: java
score: -1
type: Question
tagged with: for-loop

http://stackoverflow.com/comment/40677034
type: Comment
type: AnswerComment
has text: Please see the update. I guess you're compiling a WSDL so probably wsdl2java needs some special mumbo-jumbo with bindings. Please see the last link: http://stackoverflow.com/questions/22425306/resolving-conflicts-when-generating-code-with-cxf-and-wsdl2java
score: 0
comment on: http://stackoverflow.com/a/25977013

http://stackoverflow.com/q/25905901
has comment: http://stackoverflow.com/comment/40548347
possible better answer: http://stackoverflow.com/a/25905951
answer count: 3
linked to: http://stackoverflow.com/q/1848283
tagged with: android
has body: duplicate - How to destroy java objects? My question is very simple. I am new to app development with Java and am not sure whether I need to null objects after i am finished with them. for example i am using libGDX to create a game and I have several objects (Actors) being created. when I am finished with them do I simply call obj.remove(); or should i - obj.remove(); obj = null; do I save memory by nulling objects or is there no advantage to be had?
has answer: http://stackoverflow.com/a/25906029
accepted answer: http://stackoverflow.com/a/25905959
downvote count: 1
type: AnsweredQuestion
tagged with: libgdx
has title: do you need to null objects?
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40547985
type: Question
has answer: http://stackoverflow.com/a/25905959
linked to: http://stackoverflow.com/q/11404964
has comment: http://stackoverflow.com/comment/40548031
upvote count: 0
has answer: http://stackoverflow.com/a/25905951
has comment: http://stackoverflow.com/comment/40548417
favorite count: 0
has comment: http://stackoverflow.com/comment/40547993

http://stackoverflow.com/q/25960287
has title: SDN: what is replacement of __types__ in Spring data neo4j 3.1.4
tagged with: spring-data-neo4j
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/40665724
tagged with: java
type: Question
has body: Why the NamedIndexRepository in Spring Data Neo4j 3.1.x is depricated ? Is there any way to create __types__ index to create cypher query like this: Start root=node:__types__(className="a.b.c.XYZ") return root Seems its no longer supported in new SDN. Any otherway around to achieve this ? Update This link show that we can choose to use legacy index strategy. Thanks stefan and tstorm. Now again question arises, is there any performance issue if not using typical __types__(className="") what if I use like this: Start root=node(*).... ?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25960525
score: 1
has comment: http://stackoverflow.com/comment/40662935
favorite count: 0
tagged with: neo4j

http://stackoverflow.com/a/26009939
has comment: http://stackoverflow.com/comment/40780911
upvote count: 7
type: Answer
downvote count: 0
score: 7
has body: From the v1.6 API documentation: 'Z' outputs offset without a colon, 'ZZ' outputs the offset with a colon, 'ZZZ' or more outputs the zone id. When you specify Z (without single quotes) in your pattern, the value in your timestamp must be in the format +HHMM or -HHMM as a numeric offset from UTC. The literal character Z is not valid input for the specified format. Examples: 2014-09-23T23:03:11+0000 2014-09-23T23:03:11-0500 2014-09-23T23:03:11+0430 As Levit mentioned in the other answer, if the goal is to accept a literal 'Z' in the input timestamp without treating it as a time zone (bad idea) then the Z character can be quoted using single quotes in the pattern (...'Z'). That is similar to what was done for the literal 'T' that separates the date components from the time components. Treating Z in the input as a literal is not recommended because it has meaning and, if provided, the time zone is an important component of the timestamp.
answers question: http://stackoverflow.com/q/26009841

http://stackoverflow.com/comment/40516049
has text: @Omarshaaban no problem, please mark the check mark next to the answer if it helped you satisfactorily.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25888295

http://stackoverflow.com/q/25879335
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25879798
type: Question
tagged with: findviewbyid
answer count: 2
has body: I'm trying to change a Textview's text inside a fragment, but it gaves me a NullPointerException at the setName method. I have already tried 2 ways to do this: public class MemberFragment extends Fragment { private TextView tvName; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view; view = inflater.inflate(R.layout.fragment_member,container, false); tvName = (TextView) getView().findViewById(R.id.tvProfileName); return view; } public void setName(String name) { tvName.setText(name); } or: public class MemberFragment extends Fragment { private static TextView tvName; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view; view = inflater.inflate(R.layout.fragment_member,container, false); return view; } public void setName(String name) { tvName = (TextView) getView().findViewById(R.id.tvProfileName); tvName.setText(name); } but none gave me success. Here is where I instantiate the fragment: MemberFragment fragment = new MemberFragment(); FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.content_frame, fragment); ft.commit(); fragment.setName(map.get(Tags.NAME)); and the fragment_member.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" style="@style/ActionBar.Transparent.MyStyle" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="top" &gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="446dp" &gt; &lt;TextView android:id="@+id/tvProfileName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;/RelativeLayout&gt; &lt;/ScrollView&gt; Can someo…
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/25879416
tagged with: android
accepted answer: http://stackoverflow.com/a/25879416
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25879798
tagged with: android-fragments
has title: Change TextView inside Fragment gives me NullPointerException

http://stackoverflow.com/comment/40581392
type: QuestionComment
type: Comment
has text: @hd1 haha sorry, I wanted to say that I can't use external libraries in this particular project (My english is quite bad). I'm not doing it for a job, I'm actually studying Java, and for these first exercises the professor does not allow us to use external APIs as Joda.
comment on: http://stackoverflow.com/q/25923648
score: 0

http://stackoverflow.com/comment/40610457
comment on: http://stackoverflow.com/a/25940081
score: 0
type: AnswerComment
has text: Don't over ride equals to check contains ... rather add a new method to check if it contains. override equals when it needs to do equality check in a different way. What wait where did you get map from ?
type: Comment

http://stackoverflow.com/a/26012484
type: Answer
has body: I can see 2 errors (maybe not the whole story). You are using web.xml but there is no Spring Security filter defined there. It's boiler plate code but you have to do it (unless you switch to a more modern way of writing your app with Spring Boot for instance). Example (from docs): springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* You have implemented AuthorizationServerConfigurer but not implemented any of its methods. At a minimum you need to provide client details, e.g. (from [integration tests(https://github.com/spring-projects/spring-security-oauth/blob/master/tests/annotation/vanilla/src/main/java/demo/Application.java)): @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("my-trusted-client") .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit") .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") .scopes("read", "write", "trust") .resourceIds("oauth2-resource") .accessTokenValiditySeconds(60); } Your static convenience class OAuthServices is also kind of an anti pattern, but it won't break anything (I don't see it being used anywhere either, but maybe missed that).
answers question: http://stackoverflow.com/q/26004443
score: 0

http://stackoverflow.com/a/25932662
has body: it means that jsonParser.makeHttpRequest retuns a JSONObject and not a String. Change String json=jsonParser.makeHttpRequest(URL_ORDERS,"GET",param); to JSONObject json=jsonParser.makeHttpRequest(URL_ORDERS,"GET",param);
type: Answer
has comment: http://stackoverflow.com/comment/40596835
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25932594
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25932594

http://stackoverflow.com/a/26020838
type: Answer
answers question: http://stackoverflow.com/q/26020685
accepted answer of: http://stackoverflow.com/q/26020685
score: 1
has body: There is no way to get only the (sub)domain and port by only using the ArrayList implementation. You can only get the entries as you put them into the ArrayList. Use the build in URL class to parse the URLs of the ArrayList: URL aURL = new URL("http://xxxx.websitename.com:1234/aaa/bbb/ccc"); System.out.println("protocol = " + aURL.getProtocol()); System.out.println("authority = " + aURL.getAuthority()); System.out.println("host = " + aURL.getHost()); System.out.println("port = " + aURL.getPort()); System.out.println("path = " + aURL.getPath()); System.out.println("query = " + aURL.getQuery()); System.out.println("filename = " + aURL.getFile()); System.out.println("ref = " + aURL.getRef()); See http://docs.oracle.com/javase/tutorial/networking/urls/urlInfo.html As you only want to have to subdomain you have to further split the aURL.getHost() string at the first dot (e.g., aURL.getHost().substring(0, aURL.getHost().indexOf(".")), be aware to first check that the string contains a dot before using this...).
has comment: http://stackoverflow.com/comment/40758214
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40622529
comment on: http://stackoverflow.com/q/25947353
score: 0
type: Comment
type: QuestionComment
has text: i got nothing now..i'm very confused ,what should i do ?

http://stackoverflow.com/comment/40689951
type: Comment
comment on: http://stackoverflow.com/a/25984289
has text: Just wondering, why do you use this.memory.brother1ID when you could just do memory.brother1ID?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40590321
score: 3
has text: Either change the visibility of the relevant fields from `private` to `public` or create *getters*.
comment on: http://stackoverflow.com/q/25928950
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/71533234
type: Comment
comment on: http://stackoverflow.com/a/25885056
has text: what about inverse gamma? Can this Apache commons math lib do that?
score: 0
type: AnswerComment

http://stackoverflow.com/a/25968802
has comment: http://stackoverflow.com/comment/46487645
accepted answer of: http://stackoverflow.com/q/25968592
has body: Update 2: The original answer, as well as the first update, erroneously reference the Mongo shell documentation instead of the Java API. In Java, DBCollection.ensureIndex() was deprecated in version 2.12 and removed in version 3.0. DBCollection.createIndex() is the one that should be used. Update: db.collection.ensureIndex() is deprecated since version 3.0.0. Is now an alias for db.collection.createIndex(). Original: createIndex() is deprecated since 1.8 It was used to create indexes on collections whereas ensureIndex() creates an index on the specified field if the index does not already exist. Moreover when we execute createIndex() twice the second execution will just fail whereas with ensureIndex() you can invoke it multiple times and it will not fail And one more thing that they changed regarding behavior of ensureIndex(), in previous versions of mongodb(versions less then 2.6) if the index entry for an existing document exceeds the max index key length an index would be created but Mongodb would not index such documents whereas in recent version no index would be created.
upvote count: 41
type: Answer
downvote count: 1
score: 40
has comment: http://stackoverflow.com/comment/73302465
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25968592

http://stackoverflow.com/a/26087051
has comment: http://stackoverflow.com/comment/41059395
score: 1
has body: Thanks for your question. Allure java adaptor has undocumented feature - Lifecycle listener Lifecycle listener uses Java SPI To solve your problem just add the following class to your classpath public class EachStepScreenshoter extends LifecycleListener { @Override public void fire(StepStartedEvent event) { takeScreenshot(); } @Override public void fire(StepFinishedEvent event) { takeScreenshot(); } @Attachment(value="A screenshot") private byte[] takeScreenshot() { //Return screenshot content } }
has comment: http://stackoverflow.com/comment/41045388
answers question: http://stackoverflow.com/q/26030426
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41047913
accepted answer of: http://stackoverflow.com/q/26030426
type: Answer
has comment: http://stackoverflow.com/comment/41026983
has comment: http://stackoverflow.com/comment/41045358
has comment: http://stackoverflow.com/comment/41094536
upvote count: 1

http://stackoverflow.com/a/52752231
type: Answer
upvote count: 2
has body: I don't agree with the answer. Validation should happen in Service class. Rest layer is one such client of your service layer. You can have Service layer interface exposed as Java API, another client using messaging layer like Rabbit Mq etc. Validation result should apply to all. The Other important reason, JDBC Transaction code will be more Atomic. Imagine, you have a validation to check if an entity exists and then act. If it involves the database, they need to be done in single transaction. If there are changes to your validation rules, it will be one place to make the change. Your rest code needs to have the mapping of error/exception to HTTP codes. Your service layer should be completely unaware HTTP protocol
answers question: http://stackoverflow.com/q/26000342
score: 2
downvote count: 0

http://stackoverflow.com/a/25933382
has comment: http://stackoverflow.com/comment/40598604
has comment: http://stackoverflow.com/comment/40598005
has comment: http://stackoverflow.com/comment/51105853
has comment: http://stackoverflow.com/comment/40657397
has comment: http://stackoverflow.com/comment/40598477
answers question: http://stackoverflow.com/q/25932677
has comment: http://stackoverflow.com/comment/40658544
has comment: http://stackoverflow.com/comment/40598942
has comment: http://stackoverflow.com/comment/40598316
has comment: http://stackoverflow.com/comment/40657449
downvote count: 0
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/40657504
has comment: http://stackoverflow.com/comment/40657542
has comment: http://stackoverflow.com/comment/71691026
score: 6
has body: You don't need to use AlarmManager class . Your application consumes more battery if you use AlarmManager class. The easiest way to do it is using a broadcast listener for the intent ACTION_BATTERY_CHANGED. public class AlarmReceiverTest extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { int batteryLevel = intent.getIntExtra( BatteryManager.EXTRA_LEVEL, 0); int maxLevel = intent .getIntExtra(BatteryManager.EXTRA_SCALE, 0); int batteryHealth = intent.getIntExtra( BatteryManager.EXTRA_HEALTH, BatteryManager.BATTERY_HEALTH_UNKNOWN); float batteryPercentage = ((float) batteryLevel / (float) maxLevel) * 100; // Do something with batteryPercentage and batteryHealth. // batteryPercentage here ranges 0-100 } } onReceive runs every time the battery level changes. In your main activity register the broadcast receiver: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AlarmReceiverTest mBatteryLevelReceiver = new AlarmReceiverTest(); registerReceiver(mBatteryLevelReceiver, new IntentFilter( Intent.ACTION_BATTERY_CHANGED)); }

http://stackoverflow.com/comment/40491295
type: Comment
has text: That wouldn't help him, he would like 1 key for a pair of values.
comment on: http://stackoverflow.com/a/25874487
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40590336
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25896046
score: 0
has text: I think I have tried the `<addictionalClaspathElements/>` tag before asking this question. Let me try again and see if I missed something.

http://stackoverflow.com/q/25940298
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: primefaces
has title: Problems with serialization in java, calling a stateless javabean from a primefaces baking bean
score: 0
has answer: http://stackoverflow.com/a/26049084
answer count: 1
tagged with: javabeans
tagged with: serialization
has body: First of all: sorry for my english, I'll try to do my best :) I have a Java EE application, with javabeans providing the logic via remote interfaces and a primefaces interface with his baking beans. For example I have this in my ejb project: @Stateless @LocalBean public class reporteService implements reporteServiceRemote { [...] public LinkedList&lt;LineaBalanceteSaldosClientesTransport&gt; balanceteSaldosClientes(...parameters...) { LinkedList&lt;LineaBalanceteSaldosClientesTransport&gt; lineas = new LinkedList&lt;&gt;(); // execute a native query and return the results // the query return about 6/700 rows List results = this.balanceteSaldosClientes(...parameters...); Iterator it = results.iterator(); while (it.hasNext()) { Object[] result = (Object[])it.next(); String codigoCliente = (String) result[0]; Integer idCliente = (Integer) result[1]; Integer nombreCliente = (String) result[2]; // generate new line linea = new LineaBalanceteSaldosClientesTransport(); linea.setIdCliente(idCliente); linea.setCodigoCliente(codigoCliente); linea.setNombreCliente(nombreCliente); lineas.add(linea); } return lineas; } [...] } @Remote public interface ReporteServiceRemote { [...] public LinkedList&lt;LineaBalanceteSaldosClientesTransport&gt; balanceteSaldosClientes(...parameters...); [...] } This works fine, I've tried outputting the lines and the final linkedlist in the log and the method ends fine. The point is calling the method from the war, using his remote interface. This is the baking bean for a primefaces page that is supposed to show the results: @ManagedBean @ViewScoped public class ReporteBean implements Serializable { [...] @EJB private ReporteServicesRemote reporteServices; [...] public LinkedList&lt;LineaBalanceteSaldosClientesTransport&gt; obtenerBalanceteSaldosClientes() { try { LinkedList&lt;LineaBalanceteSaldosClientesTransport&gt; lbsct = reporteServices.balanceteSaldosClientes( this.getFechaSaldo(), this.getIdsMonedas(), cliente != null ? cliente.idCliente : …
accepted answer: http://stackoverflow.com/a/26049084

http://stackoverflow.com/q/25913157
has answer: http://stackoverflow.com/a/25913261
has answer: http://stackoverflow.com/a/25913256
has body: import java.util.GregorianCalendar; public class CalendarMain { public static void main(String[] args) { GregorianCalendar calendar = new GregorianCalendar(); int month = calendar.get(GregorianCalendar.MONTH)+1; int year = calendar.get(GregorianCalendar.YEAR); int weekday = calendar.get(GregorianCalendar.DAY_OF_WEEK); int dayOfMonth = calendar.get(GregorianCalendar.DAY_OF_MONTH); System.out.println(month+&quot;/&quot;+dayOfMonth+&quot;/&quot;+year); calendar.add(GregorianCalendar.DAY_OF_MONTH, 10); System.out.println(GregorianCalendar.DAY_OF_MONTH); } } I am trying to add 10 days to the current date but am getting a weird problem. It does not seem to be adding correctly. Output: 9/18/2014 5
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: date
has comment: http://stackoverflow.com/comment/40561367
answer count: 3
has answer: http://stackoverflow.com/a/25913210
downvote count: 0
has title: Adding date in Gregorian Calendar
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/25956462
has comment: http://stackoverflow.com/comment/40638259
type: Answer
has comment: http://stackoverflow.com/comment/40638196
has comment: http://stackoverflow.com/comment/40638207
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25956419
answers question: http://stackoverflow.com/q/25956419
upvote count: 2
has comment: http://stackoverflow.com/comment/40638296
type: AcceptedAnswer
has body: It is called ternary operator and it is only operator that takes 3 operands. In better sense, it is conditional operator that represent shorter format General Syntax : boolean expression ? value1 : value2 your example: ltVal = node.left != null ? node.left.height : 0; as same as if( node.left != null) itVal = node.left.height else itval = 0;

http://stackoverflow.com/q/26029272
tagged with: java
has answer: http://stackoverflow.com/a/26029331
accepted answer: http://stackoverflow.com/a/26029331
type: Question
tagged with: nested-class
score: 0
answer count: 1
tagged with: static
has title: nested class as testing method in Java
type: AnsweredQuestion
has body: //: innerclasses/TestBed.java // Putting test code in a nested class. // {main: TestBed$Tester} public class TestBed { public void f() { System.out.println("f()"); } public static class Tester { public static void main(String[] args) { TestBed t = new TestBed(); t.f(); } } } /* Output: f() *///:~ I am studying "Think in Java". I am just wondering why the above code doesn't work which should be a way to test each class, and can be removed by deleting TestBed$Tester.class file. The error msg instructs there should be a public static void main(String[] args) in TestBed class as program entry. java compile version: javac 1.7.0_40

http://stackoverflow.com/comment/40732519
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61811/discussion-between-diogosantana-and-oscar-f).
type: Comment
comment on: http://stackoverflow.com/a/26007702
type: AnswerComment

http://stackoverflow.com/a/25945639
downvote count: 0
has comment: http://stackoverflow.com/comment/40620045
answers question: http://stackoverflow.com/q/25945613
type: Answer
upvote count: 14
has comment: http://stackoverflow.com/comment/40620060
has body: You can't call your Fragment like this, Intent intent = new Intent(view.getContext(), FragmentGreen.class); view.getContext().startActivity(intent); getActivity().finish(); you need to call your fragment like this way FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); FragmentGreen llf = new FragmentGreen(); ft.replace(R.id.listFragment, llf); ft.commit(); Intent is basically used for call one activity from another. For add new Fragment you can't use Intent. For that you have to use FragmentManager and for open fragment FragmentTransaction. for more details go Here
score: 14
has comment: http://stackoverflow.com/comment/40620101

http://stackoverflow.com/q/26022861
tagged with: image-processing
type: Question
linked to: http://stackoverflow.com/q/21968342
has comment: http://stackoverflow.com/comment/40776998
has body: I have an application that requires images to be sent from a client to a server. For this operation speed and image size both need to be minimised. Thing is, the application records at around 20 fps when i don't write the images to a file. However speed gets decreased to ~10 fps when i save as JPEG. Also ironically, saving as "png" occupies only 75kb on average whereas saving as "JPEG" requires 125 kB. So i am a newbie when it comes to images. Should i save it as an image, or should i simply send the img over the network. Please help me out with the basic architecture. I have searched, but i don't get what exactly to do? As a bonus, please give me a hint as to "how to compress an image fast". Thanks!
score: 0
has comment: http://stackoverflow.com/comment/40759893
has comment: http://stackoverflow.com/comment/40762201
answer count: 0
type: UnansweredQuestion
has title: Sending Bufferred Image over network versus sending JPEG over network
tagged with: java

http://stackoverflow.com/comment/40641061
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25957916
has text: A `double` is 64 bits. 64-bit is enough to represent around 10 characters (assuming 62 unique character values).
type: Comment

distinct
tag name: distinct
tags question: http://stackoverflow.com/q/25905445
type: Tag

http://stackoverflow.com/comment/40660623
comment on: http://stackoverflow.com/q/25967776
type: Comment
score: 0
type: QuestionComment
has text: than you can use core functionality of db, use Trigger.

http://stackoverflow.com/comment/40640371
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25940089
has text: For some reason your edit got rejected. So I changed it to what you suggested. But I get an error (see first post) ln 24 -> "int item = details.getId();" I guess it’s because the output of details is null, (see comments)
type: AnswerComment

http://stackoverflow.com/q/26002462
favorite count: 0
tagged with: jax-rs
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26002548
has answer: http://stackoverflow.com/a/26020928
has title: How can you access the Response object inside ContainerResponseFilter?
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/25881675
type: Question
has body: In Jersey 1 you can create a container response filter and get access to the Response: public ContainerResponse filter(ContainerRequest request, ContainerResponse response) { Response r = response.getResponse(); // Now I have access to Reponse.getMetadata(), etc. } But in Jersey 2, the ContainerResponseFilter only gives me the response context: public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { // responseContext gives me the entity, but I want the JAX-RS Response object that my resources created } The implementation of ContainerResponseContext is ContainerResponse, which requires a JAX-RS Response object to build. So why can't I get access to it from within the filter? Am I missing something? The problem I have is that my resources all build Response objects and attach meta data to them, and I'd like a response filter that can examine this meta data. Without access to the raw Response, this doesn't seem possible.
answer count: 2
tagged with: jersey
downvote count: 0
tagged with: jersey-2.0

http://stackoverflow.com/q/26027277
has body: I see this question was posted under title "jconsole operation ordering", but didn't see any responses to it and couldn't add a comment as I am new. So posting this question again! I have an MBean with many operations and would want to present them in a certain order in JConsole or Java VisualVM. Couldn't find a way to do so. Was wondering if it's even possible to control the presentation ordering of operations in a MBean?
favorite count: 0
type: UnansweredQuestion
tagged with: jmx
tagged with: operations
has title: How to control the ordering of operations in my MBean when viewed in JConsole or Java VisualVM
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40841710
type: Question
tagged with: jconsole
downvote count: 0
score: 4
upvote count: 4

http://stackoverflow.com/q/26002513
has title: Display timezone name in locale Java
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26002645
has comment: http://stackoverflow.com/comment/40722593
downvote count: 0
type: Question
tagged with: java
upvote count: 2
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26002645
has body: I have this piece of code in Java public static void main(String[] args) { TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles"); System.out.println(tz.getDisplayName(new Locale("ja-JP"))); } It displays the output "Pacific Standard Time". I would think, it should display this timezone in Japanese? Is this not how this library is supposed to behave?
tagged with: timezone

http://stackoverflow.com/q/26023207
favorite count: 0
has answer: http://stackoverflow.com/a/26023338
downvote count: 2
has comment: http://stackoverflow.com/comment/40760346
has comment: http://stackoverflow.com/comment/40760990
score: -2
tagged with: recursion
has title: Java-Finding whether given numbe is prime or not by using recursive method call
tagged with: java
answer count: 3
accepted answer: http://stackoverflow.com/a/26023338
has comment: http://stackoverflow.com/comment/40760278
has answer: http://stackoverflow.com/a/26023334
upvote count: 0
has comment: http://stackoverflow.com/comment/40760734
has body: I had done a lot of googling about it but unable to figure out the right answer. While I am running the below code i am always getting output as "not prime even though the input is prime number like 13". Please help me out. import java.util.Scanner; public class PrimeRecurssion { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int number = sc.nextInt(); System.out.println("Your given number is:" + prime(number,2)); } public static String prime(int x,int temp ) { if(x%temp == 0) { return("not a prime"); } if(x != temp-1) { return prime(x,temp+1); } else return("prime"); } }
possible better answer: http://stackoverflow.com/a/26023334
has answer: http://stackoverflow.com/a/26023456
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/40640644
type: AnswerComment
has text: When I do that, my current calendar initializer seems to have stopped working. I have edited my original post to show the errors I get when I replace the import statement. Thanks for your help!
type: Comment
comment on: http://stackoverflow.com/a/25957901
score: 0

http://stackoverflow.com/a/65362872
downvote count: 0
has body: You can use a spring configuration to disable force lazy loading by default! @Configuration public class JacksonConfig { @Bean public ObjectMapper objectMapper() { ObjectMapper mapper = new ObjectMapper(); Hibernate5Module hibernate5Module = new Hibernate5Module(); hibernate5Module.configure(Feature.FORCE_LAZY_LOADING, false); // Enable below line to switch lazy loaded json from null to a blank object! //hibernate5Module.configure(Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS, true); mapper.registerModule(hibernate5Module); return mapper; } }
upvote count: 6
answers question: http://stackoverflow.com/q/25906985
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/132914877

http://stackoverflow.com/a/25889297
score: 1
upvote count: 1
has body: Use global variable for a TextView. Get reference to it in onCreateView and call setText on that reference. public class MainHandlerFragment extends Fragment { private TextView textView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new MyTask().execute("xyzname"); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.home_fragment, container, false); textView = (TextView) view.findViewById(R.id.text_frag); return view; } public class MyTask extends AsyncTask&lt;String, Void, Organization&gt; { @Override protected String doInBackground(String... urls) { // getting api calls } @Override protected void onPostExecute(String str) { loadData(str); } } public void loadData(String str){ getSupportFragmentManager().beginTransaction() // you miss something here textView.setText("name"); // should be ok now } } }
answers question: http://stackoverflow.com/q/25889113
type: Answer
downvote count: 0

http://stackoverflow.com/q/25952258
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has title: Changing returned content type in Spring MVC
score: 0
has answer: http://stackoverflow.com/a/25952437
accepted answer: http://stackoverflow.com/a/25952437
has body: I have a zip file with a custom extension that needs to be returned as content type application/zip, but for some reason, no matter what I do, it always gets returned as text/html. It would seem that configuring a content negotiation manager as in this article https://spring.io/blog/2013/05/11/content-negotiation-using-spring-mvc would do the trick, but it doesn't seem to work for me. If I request a .zip file through the same controller/method it works perfectly. I've tried configuring several different properties in an attempt to accomplish my goal, but here's my latest from my application-context.xml. &lt;bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"&gt; &lt;property name="favorPathExtension" value="true" /&gt; &lt;property name="ignoreAcceptHeader" value="true" /&gt; &lt;property name="defaultContentType" value="application/zip" /&gt; &lt;property name="mediaTypes"&gt; &lt;map&gt; &lt;entry key="xyz" value="application/zip" /&gt; &lt;/map&gt; &lt;/property&gt; &lt;/bean&gt; Here are my headers from my browser: Remote Address:::1:8080 Request URL:http://localhost:8080/app/faces/download/148943e4ead.xyz Request Method:GET Status Code:200 OK Request Headers Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Cache-Control:max-age=0 Connection:keep-alive Cookie:JSESSIONID=gcvvicbqtlyyrbgnth3qurfy; jwplayer.volume=100; SESSION-GUID=f8vdloov22qbmx6r; plushContainerWidth=100%25; plushMultiOps=1; plushNoTopMenu=0; SQLiteManager_currentLangue=2; _ga=GA1.1.1642769916.1411099193 DNT:1 Host:localhost:8080 User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 Response Headers Content-Length:2585515 Content-Type:text/html Server:Jetty(6.1.26)
tagged with: spring

http://stackoverflow.com/comment/40572701
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25918569
has text: @DavidConrad thank you for that, i'll do it when i'll be troubleshooting return values.
type: Comment

http://stackoverflow.com/comment/40655802
score: 0
type: Comment
type: QuestionComment
has text: Nonetheless, I recommend storing the file contents as a String, splitting it on new lines ("\r?\n") (giving you an array), giving you the length of the array(s) you probably want to create in the end.
comment on: http://stackoverflow.com/q/25965030

http://stackoverflow.com/comment/40737054
type: AnswerComment
has text: Not every time. No, only when you are using *a reference which is not final during concatenation*. So, `a + "khokhar"` will be resolved during compile time if `a` is *final*.
type: Comment
comment on: http://stackoverflow.com/a/26010612
score: 0

http://stackoverflow.com/q/25941673
tagged with: priority-queue
has body: If I want to create priority queue of nodes, and each node has only one field (i.e. int val) do I have to write a comparator for the priority queue?
answer count: 4
has answer: http://stackoverflow.com/a/25941715
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25941721
has title: Can I use Priority Queue in Java without implementing a comparator?
possible better answer: http://stackoverflow.com/a/25941719
has answer: http://stackoverflow.com/a/67083284
has answer: http://stackoverflow.com/a/25941719
linked to: http://stackoverflow.com/q/683041
downvote count: 0
accepted answer: http://stackoverflow.com/a/25941721
favorite count: 0
has comment: http://stackoverflow.com/comment/40613812

http://stackoverflow.com/comment/65353498
comment on: http://stackoverflow.com/a/25979319
type: AnswerComment
has text: Shoudn't the pointcut be: "execution(public * org.springframework.data.repository.Repository+.*(..))" ?
type: Comment
score: 0

http://stackoverflow.com/a/26023355
downvote count: 0
has body: Basically its not actually an error. It's your Eclipse, warning you that you aren't actually reading that variable (p), so you aren't receiving any input from it. Nowhere in the code, you use the variable p. To remove the error - it is necessary to remove the variable "p".
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26023262
score: 1

http://stackoverflow.com/q/25947332
score: 1
has comment: http://stackoverflow.com/comment/40622378
tagged with: java
has comment: http://stackoverflow.com/comment/40624335
has comment: http://stackoverflow.com/comment/40622415
has title: Cannot update eclipse ADT to 23.0.3 even after trying everything found on google
type: Question
has comment: http://stackoverflow.com/comment/40623596
has body: I am using eclipse for the first time. I copied an adt-bundle and everything worked fine until i connected to the internet. Then every time I open eclipse it says This Android SDK requires Android Developer Toolkit version 23.0.0 or above. Current version is 22.6.2.v201403212031-1085508. Please update ADT to the latest version. I tried to update by going to help>install new software and used both options 1.archive(by downloading plug in) and 2.work with 'https://dl-ssl.google.com/android/eclipse/' but end up getting the same error Cannot complete the install because of a conflicting dependency. Software being installed: Android Development Tools 23.0.3.1327240 (com.android.ide.eclipse.adt.feature.feature.group 23.0.3.1327240) Software currently installed: Android Developer Tools 22.0.5.v201307292155--757759 (com.android.ide.eclipse.adt.package.product 22.0.5.v201307292155--757759) Only one of the following can be installed at once: ADT XML Overlay 23.0.3.1327240 (overlay.com.android.ide.eclipse.adt.overlay 23.0.3.1327240) ADT XML Overlay 22.6.2.v201403212031-1085508 (overlay.com.android.ide.eclipse.adt.overlay 22.6.2.v201403212031-1085508) Cannot satisfy dependency: From: Android Development Tools 23.0.3.1327240 (com.android.ide.eclipse.adt.feature.feature.group 23.0.3.1327240) To: overlay.com.android.ide.eclipse.adt.overlay [23.0.3.1327240] Cannot satisfy dependency: From: Android Development Tools 22.6.2.v201403212031-1085508 (com.android.ide.eclipse.adt.feature.group 22.6.2.v201403212031-1085508) To: overlay.com.android.ide.eclipse.adt.overlay [22.6.2.v201403212031-1085508] Cannot satisfy dependency: From: ADT Package 22.0.5.v201307292155--757759 (com.android.ide.eclipse.adt.package.feature.group 22.0.5.v201307292155--757759) To: com.android.ide.eclipse.adt.feature.group 22.0.5 Cannot satisfy dependency: From: Android Developer Tools 22.0.5.v201307292155--757759 (com.android.ide.eclipse.adt.package.product 22.0.5.v201307292155--757759) To: com.android.ide.eclipse…
tagged with: adt
tagged with: eclipse
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25948700
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/40622690
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29273403
tagged with: android
downvote count: 0

http://stackoverflow.com/a/25975946
has comment: http://stackoverflow.com/comment/40696227
answers question: http://stackoverflow.com/q/25975750
score: 0
has body: If you can access HttpServletRequest form class, try like this String s = context.getMessage("intestazione",null, request.getLocale()));
type: Answer

http://stackoverflow.com/q/25974194
favorite count: 0
has body: I have a 3 Spring projects: 'web', worker' and 'core'. 'core' includes common functionality from 'web' and 'worker' such as domain beans or jpa repositories and it is included in 'worker' and 'web' projects as jar. POM in 'web' project com.proyecti.magmainside221b core 1.0.0.RC1 When I deploy 'web' project in Tomcat looks like Java config beans from 'core' are not being initialized since the 'datasource' bean (defined in 'core' project with @Bean in one class annotated with @Configuration) is not found to be injected into 'PersistentTokenBasedRememberMeServices'. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices#0': Cannot create inner bean '(inner bean)#1978517' of type [org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1978517': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dataSource' is defined What I have to do to initialize my java config beans from 'core' project when I deploy 'web' project? Thanks! Edited: I have found in the logs that my applicationContext files are being loaded. 2014-09-22 15:04:37,922 INFO [unknown] [localhost-startStop-1] o.s.b.f.x.XmlBeanDefinitionReader - Loading XML bean definitions from file [/home/aacevedo/workspaces/magma/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/web/WEB-INF/classes/META-INF/spring/applicationContext.xml] 2014-09-22 15:04:37,940 INFO [unknown] [localhost-startStop-1] o.s.b.f.x.XmlBeanDefinitionReader - Loading XML bean definitions from URL [jar:file:/home/aacevedo/workspaces/magma/.metadata/.plugins/org.eclipse.wst.server.c…
tagged with: spring
has comment: http://stackoverflow.com/comment/40670815
has answer: http://stackoverflow.com/a/25974693
has answer: http://stackoverflow.com/a/25995965
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40674590
tagged with: maven
upvote count: 1
possible better answer: http://stackoverflow.com/a/25974693
accepted answer: http://stackoverflow.com/a/25995965
has comment: http://stackoverflow.com/comment/40672072
has comment: http://stackoverflow.com/comment/40673374
type: Question
has comment: http://stackoverflow.com/comment/40672491
score: 1
tagged with: java
has title: Java config beans from dependent Spring project are not being initialized
has comment: http://stackoverflow.com/comment/40673086
has comment: http://stackoverflow.com/comment/40672015
answer count: 2
has comment: http://stackoverflow.com/comment/40673217
downvote count: 0

http://stackoverflow.com/comment/40503982
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25881263
has text: Yes, I tried on my C:\ partition, Desktop and Documents folder which are not inside Dropbox. I even tried turning off Dropbox.
score: 0

http://stackoverflow.com/q/26020036
tagged with: java
tagged with: methods
downvote count: 1
has title: Can an Static Method call an Instance Method in Java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26020115
has comment: http://stackoverflow.com/comment/40754166
answer count: 4
has answer: http://stackoverflow.com/a/26020118
score: 1
favorite count: 0
tagged with: static
type: Question
has answer: http://stackoverflow.com/a/26020367
has answer: http://stackoverflow.com/a/26020107
linked to: http://stackoverflow.com/q/2042813
has body: So I just started programming and what not and this question has me tearing my hair off. It's asking "Under what circumstances, if any, can a static method call an instance method?" I've tried going back to the chapters where it mentions both methods and get no hints. Can someone help?Would be appreciated.
upvote count: 2
duplicate of: http://stackoverflow.com/q/2042813

http://stackoverflow.com/q/25899153
has comment: http://stackoverflow.com/comment/41345198
type: Question
has title: No such bean definition found?
tagged with: portlet
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40535886
upvote count: 2
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/25899655
has body: I am working on a portal project. When I deploy portlets into WebSphere I am getting NoSuchBeanDefintionException and I also checked for the package in component-scan and also googled about it, but I didn't find any solution. All the required packages in context.xml of every portlet. Please see below for the logs Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.myhealthone.common.model.Account com.hca.cpp.coreservice.UserServiceImpl.account; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.myhea.common.model.Account] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@ringframework.beans.factory.annotation.Autowired(required=true)} &gt; at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcesva:514) &gt; at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) &gt; at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor285) ... 147 more &gt; Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.myhealthone.common.model.Account] found for depy: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotatiowired(required=true)} I added all the required packages to component-scan.
score: 2
tagged with: java

http://stackoverflow.com/q/25969544
has body: Im trying to learn hibernate and wicket. Im actually not sure when to open and close a hibernate session. I´ve searched a lot and read many things about the session factory, but I still dont get it. I want to get some data of my database and show it in a table in the browser. That actually works if im the first time on that site, but if I use the back button and go onto that site again it shows me this error: Last cause: Unknown service requested [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider] I think its because I close my SessionFactory to early or something like that. But I dont know how to solve the problem. My Java Class: public class CategoryPanel extends Panel { private WebMarkupContainer categoryContainer; public CategoryPanel(String id) { super(id); SessionFactory sessionFactory = DbFactory.getSessionFactory(); // creating the Session Factory StandardDao&lt;Category&gt; categoryDao = StandardDao.getInstance(sessionFactory); // creating dao to access data List&lt;Category&gt; categoryList = categoryDao.getAll(Category.class); // get data of the db CategoryDataProvider dataProvider = new CategoryDataProvider(categoryList); categoryContainer = new WebMarkupContainer("categoryTable"); final DataView dv = new DataView("categoryList", dataProvider) { @Override protected void populateItem(Item item) { final Category category = (Category) item.getModelObject(); final CompoundPropertyModel&lt;Category&gt; categoryModel = new CompoundPropertyModel&lt;Category&gt;(category); item.add(new Label("catTitle", categoryModel.bind("title"))); } }; categoryContainer.add(new Label("categoryTitle", Model.of("Titel"))); add(categoryContainer); sessionFactory.close(); // here I close the factory, this seems to be wrong. I dont know if i close it anyway.. } } My Dao: public class StandardDao&lt;T&gt; { private static StandardDao instance = null; private static final Object syncObject = new Object(); private SessionFactory sessionFactory; private StandardDao(SessionF…
tagged with: session
tagged with: java
tagged with: hibernate
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25969696
accepted answer: http://stackoverflow.com/a/25969696
tagged with: wicket
favorite count: 0
score: 2
upvote count: 2
has title: Hibernate Session handling
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/40519421
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25887993
has text: @flow I want to use smack 4, but could not connect to Facebook with smack4

http://stackoverflow.com/a/25969350
accepted answer of: http://stackoverflow.com/q/25969161
downvote count: 0
answers question: http://stackoverflow.com/q/25969161
score: 1
has body: If you want to check for a specific object that where .equal returns true, you don't need to use an argument matcher, simply pass it as an argument: @Before public void setUp() { Map&lt;String, String&gt; = new HashMap&lt;&gt;(); someSpecificMap.put("key", "value"); when(mockedObject.get(someSpecificMap).thenReturn(1); } The mocked return value of 1 will be returned if you pass a map that is equal to someSpecificMap, i.e. a map with one element "key": "value" If you want to check if the map has a specific key, then I would suggest that you use the Hamcrest hasEntry matcher: import static org.hamcrest.Matchers.hasEntry; import static org.mockito.Matchers.argThat; @Before public void setUp() { when(mockedObject.get((Map&lt;String, String&gt;) argThat(hasEntry("key", "value")))) .thenReturn(1); } This mock setup returns 1 for all invocations of mockedObject.get that get passed a map with the key "key": "value", other keys may be present or not.
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40599506
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25934319
score: 0
has text: What is your question?

http://stackoverflow.com/comment/40783130
comment on: http://stackoverflow.com/a/26030624
type: Comment
has text: Yeah, I see that now. The ListView used to be a TextView. I just changed it without even looking that up. So that was super easy to fix apparently. Note that you do *not* need to pass an array of any kind to the adapter. It does indeed have one built in; but you can't see anything but the first element if you put a scroller inside a scroller. /note Please submit the remove scroller as an answer so I can checkmark you as a correct answer.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26009591
type: Question
has answer: http://stackoverflow.com/a/26010134
possible better answer: http://stackoverflow.com/a/26009706
has answer: http://stackoverflow.com/a/33665201
has comment: http://stackoverflow.com/comment/40735852
accepted answer: http://stackoverflow.com/a/26009740
has comment: http://stackoverflow.com/comment/40735267
has answer: http://stackoverflow.com/a/26009706
has comment: http://stackoverflow.com/comment/40735183
score: 1
has comment: http://stackoverflow.com/comment/40735248
has comment: http://stackoverflow.com/comment/40735516
has comment: http://stackoverflow.com/comment/40735226
favorite count: 0
upvote count: 2
tagged with: letter
tagged with: regex
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40735599
has answer: http://stackoverflow.com/a/26009740
tagged with: java
has title: How to replace last letter to another letter in java using regular expression
downvote count: 1
has body: i have seen to replace "," to "." by using ".$"|",$", but this logic is not working with alphabets. i need to replace last letter of a word to another letter for all word in string containing EXAMPLE_TEST using java this is my code Pattern replace = Pattern.compile("n$");//here got the real problem matcher2 = replace.matcher(EXAMPLE_TEST); EXAMPLE_TEST=matcher2.replaceAll("k"); i also tried "//n$" ,"\n$" etc Please help me to get the solution input text=>njan ayman output text=> njak aymak

http://stackoverflow.com/q/25883759
has comment: http://stackoverflow.com/comment/44870879
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44871071
has comment: http://stackoverflow.com/comment/40511066
tagged with: java
has answer: http://stackoverflow.com/a/28256324
has body: I've been studying for interviews lately, and came across the computing of Fibonacci sequence question. I stumbled on this solution on the Wikipedia Rosetta page. They claim that it computes it in O(log (n)) time. However, wouldn't it be O(m(n)* log n ) where m(n) is the time for the multiplication of two numbers of n digits. I understand that it's O(log n ) arithmetic operations, but I don't believe it's also O( log n) time. Am I correct in this assumption or totally confused? Can someone clarify this for me? Here's the code: public class fibonacci { public static long fib(long n) { if (n &lt;= 0) return 0; long i = (int) (n - 1); long a = 1, b = 0, c = 0, d = 1, tmp1,tmp2; while (i &gt; 0) { if (i % 2 != 0) { tmp1 = d * b + c * a; tmp2 = d * (b + a) + c * b; a = tmp1; b = tmp2; } tmp1 = (long) (Math.pow(c, 2) + Math.pow(d, 2)); tmp2 = d * (2 * c + d); c = tmp1; d = tmp2; i = i / 2; } return a + b; } }
linked to: http://stackoverflow.com/q/2307283
type: Question
tagged with: fibonacci
has comment: http://stackoverflow.com/comment/40508075
tagged with: algorithm
score: 0
has comment: http://stackoverflow.com/comment/40507955
tagged with: time-complexity
answer count: 1
has title: Fibonacci analysis - Is this solution in log(n) or ((m(n) *log n)) time complexity?
tagged with: big-o
has comment: http://stackoverflow.com/comment/40508041

http://stackoverflow.com/comment/53942271
has text: Wrong! `mov %eax,0xfffffffc(%ebp)` is in AT&T syntax, which moves the value stored in eax to the address ebp+0xfffffffc, not the other way around
comment on: http://stackoverflow.com/a/25888243
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25885535
accepted answer of: http://stackoverflow.com/q/25885422
score: 2
answers question: http://stackoverflow.com/q/25885422
has body: Making a field static final only makes the reference threadsafe; it doesn't synchronize access to the referenced object. Because instances of SimpleDateFormat are not threadsafe, if an instance is used concurrently by multiple threads, you must synchronize access to it (as you did). Making the field static final just guaranteed that all threads would see the same value for the reference. However, your current code is a potential bottleneck, as all threads must queue up to use the instance, possibly yielding worse performance than just creating a new one each time. If you want to safely reuse instances of SimpleDateFormat, consider using ThreadLocal to conveniently allow a separate instance to be using for each thread, which would allow you to remove synchronization: private static final ThreadLocal&lt;SimpleDateFormat&gt; formats = new ThreadLocal&lt;SimpleDateFormat&gt;() { @Override protected SimpleDateFormat initialValue() { return new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss", Locale.US); } }; public void setDate(String string) throws ParseException { return formats.get().parse(string); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40528245
has comment: http://stackoverflow.com/comment/40520164
type: Answer
upvote count: 2

http://stackoverflow.com/q/26017357
tagged with: recursion
has comment: http://stackoverflow.com/comment/40778938
has comment: http://stackoverflow.com/comment/40818596
has body: I'm using MergeSort on a custom linked list lines where the Nodes have String data and I want the algorithm to sort the elements in the list according to how many non-space characters each String has. Here is the method for counting the number of non-space characters in a Stringm (which is the datum of each Node). I'm pretty confident this works as it should. public static int numberOfCharacters(Node line) { return line.data.replaceAll(" ", "").length(); } Here is the algorithm itself. It is invoked by mergeSort(lines.head); public static Node mergeSort(Node list1) { if (list1 == null || list1.next == null) { return list1; } Node list2 = split(list1); list1 = mergeSort(list1); list2 = mergeSort(list2); return merge(list1, list2); } public static final Node split(Node list1) { Node list2 = list1.next; list1.next = list2.next; list2.next = split(list2.next); return list2; } NetBeans is telling me before I even compile that split() will recurse infinitely. The error I'm getting is Exception in thread "main" java.lang.NullPointerException.
score: 0
tagged with: mergesort
has comment: http://stackoverflow.com/comment/40749795
has comment: http://stackoverflow.com/comment/40749086
type: UnansweredQuestion
tagged with: linked-list
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40778925
has title: What is wrong with my MergeSort recursion?
type: Question

http://stackoverflow.com/a/25878225
downvote count: 0
has body: I remember figuring this out way back when I was learning GUI! I'll explain the basic concepts for you. Let's say we have two colors, RGB(A,B,C) and RGB(X,Y,Z) for simplicity. If we know the position percentage-wise (we'll call this P, a float 0 for beginning, 1.0 at end) along the line, we can calculate what color should be there using the following: Resultant Color = RGB(A*(1-P)+X*P,B*(1-P)+Y*P,C*(1-P)+Z*P) In other words, you average out the individual RGB values along the line.
type: AcceptedAnswer
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/40499351
accepted answer of: http://stackoverflow.com/q/25878029
answers question: http://stackoverflow.com/q/25878029
has comment: http://stackoverflow.com/comment/40499418
score: 3

http://stackoverflow.com/comment/40604775
type: Comment
type: QuestionComment
has text: thats the string array :)
score: 0
comment on: http://stackoverflow.com/q/25936812

http://stackoverflow.com/comment/40702577
has text: http://stackoverflow.com/questions/20216243/xmlpullparser-getattributevalue-returns-null Finally I find my answer here..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25989413

http://stackoverflow.com/comment/40782259
comment on: http://stackoverflow.com/q/26021189
type: Comment
type: QuestionComment
has text: I feel it may be a problem with my custom Spinner, but can't figure it out yet...
score: 0

http://stackoverflow.com/a/59075467
type: Answer
score: 2
has body: What I ended up with def deleteRecursively(f: File): Boolean = { if (f.isDirectory) f.listFiles match { case files: Array[File] =&gt; files.foreach(deleteRecursively) case null =&gt; } f.delete() }
answers question: http://stackoverflow.com/q/25999255
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/25874818
tagged with: java
tagged with: itext
type: Question
tagged with: footer
has comment: http://stackoverflow.com/comment/40498638
score: 0
has body: Using OnEndPage, I add a footer to my PDF created with iTextSharp. The footer font gets progressively bolder with each page. How can I create consistent NORMAL fonts in my footer? Here is my code: public override void OnEndPage(PdfWriter writer, Document doc) { iTextSharp.text.Image gif = null; if (FooterImage) { if (File.Exists(PathImages)) { gif = iTextSharp.text.Image.GetInstance(PathImages); gif.ScaleToFit(75f, 75f); gif.SetAbsolutePosition(0, 0); } } string sFooter = string.Empty; if (FooterURL != null &amp;&amp; FooterURL.Length &gt; 0) { sFooter = FooterURL + " "; } if (FooterDate != null &amp;&amp; FooterDate.Length &gt; 0) { sFooter += FooterDate + " "; } if (FooterPage) { sFooter += "Page " + doc.PageNumber.ToString(); } PdfPTable footerTbl = new PdfPTable(1); footerTbl.TotalWidth = 900; footerTbl.HorizontalAlignment = Element.ALIGN_CENTER; Phrase ph = new Phrase(sFooter, FontFactory.GetFont(FontFactory.TIMES, 10, iTextSharp.text.Font.NORMAL)); PdfPCell cell = new PdfPCell(ph); cell.Border = 0; cell.PaddingLeft = 10; footerTbl.AddCell(cell); if (FooterImage) { PdfContentByte cbfoot = writer.DirectContent; PdfTemplate tpl = cbfoot.CreateTemplate(gif.Width / 5, gif.Height / 5); tpl.AddImage(gif); cbfoot.AddTemplate(tpl, doc.PageSize.Width - 100, 10); } footerTbl.WriteSelectedRows(0, -1, 10, 30, writer.DirectContent); }
answer count: 1
has title: iTextSharp Footer Gets Progressively Bolder with Each Page
has answer: http://stackoverflow.com/a/25884033
accepted answer: http://stackoverflow.com/a/25884033
type: AnsweredQuestion

http://stackoverflow.com/comment/99468966
comment on: http://stackoverflow.com/q/26027396
type: Comment
has text: Java 10 has true immutable list : https://stackoverflow.com/a/52536126/1216775
type: QuestionComment
score: 2

http://stackoverflow.com/a/25951304
score: 1
has comment: http://stackoverflow.com/comment/40640960
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25949495
answers question: http://stackoverflow.com/q/25949495
has body: I get that you've already chosen an accepted answer. But if you need the solution provided to you. I've added the source code below that will achieve your intended operation. And yes as Floegipoky has pointed out your code is not easily readable. Just make sure that the relevant code is grouped together -- that solves half your readability issues. import java.util.Properties; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.IOException; public class ReadFile { public static void main(String args[]) throws FileNotFoundException, IOException { Properties config = new Properties(); config.load(new FileInputStream("config.properties")); int itemsPerPage = Integer.parseInt(config.getProperty("itemsPerPage")); int currentIndex = Integer.parseInt(config.getProperty("currentIndex")); int totalItemCount = Integer.parseInt(config.getProperty("totalItemCount")); if(currentIndex &lt; totalItemCount) { for(int iterator = 0; iterator &lt; itemsPerPage; iterator++) { if(currentIndex &lt; totalItemCount) { //TODO Insert what ever processing of those batch operations here currentIndex++; continue; } } config.setProperty("currentIndex", ((Integer)currentIndex).toString()); config.store(new FileOutputStream("config.properties"),null); } } }
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25899818
score: -1
type: Question
answer count: 2
tagged with: htmlunit
upvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/25759512
tagged with: xpath
has body: I need to test a program on site, so I can´t test it until I am at the site. I want to know if the following Xpath is the right one. I have read the syntax on http://www.w3schools.com/xpath/xpath_syntax.asp but I am still not sure if this is right. If there is a button in a tablerow &lt;tr&gt; and in the &lt;tr&gt; there is a &lt;td&gt;. Within the &lt;td&gt; is a &lt;button value = 'button'&gt; specified. I think the Xpath would be: "/html/body//table//tr//td//button[@value=['button']" Is this correct? Thanks in advance
has title: Xpath Syntax correct?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25899988
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25899973

http://stackoverflow.com/q/26000767
favorite count: 0
has answer: http://stackoverflow.com/a/26000871
has comment: http://stackoverflow.com/comment/40719582
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
has title: JAVA Exception in thread "Thread-2" java.lang.NullPointerException
type: Question
accepted answer: http://stackoverflow.com/a/26000871
has body: I'm using a open source launcher for minecraft and i'm trying to edit it but is a little bit difficult. I distribute my launcher trought all the people and half of them have this problem of NullPointer, the rest runs it well. The launcher starts but then, where it is supposed to be the modpack icon there is nothing. I checked that it wasn't a problem of URL of firewall and infact in the console log it's written this: Exception in thread "Thread-2" java.lang.NullPointerException at it.planetgeeks.mclauncher.modpack.ModPackUtils.analyzePacks(ModPackUtils.java:82) at it.planetgeeks.mclauncher.modpack.ThreadGetPacksInfo.run(ModPackUtils.java:34) at java.lang.Thread.run(Unknown Source) The Modpack.utils package it.planetgeeks.mclauncher.modpack; import it.planetgeeks.mclauncher.GameLauncher; import it.planetgeeks.mclauncher.Launcher; import it.planetgeeks.mclauncher.LauncherLogger; import it.planetgeeks.mclauncher.Settings; import it.planetgeeks.mclauncher.utils.DirUtils; import it.planetgeeks.mclauncher.utils.DirUtils.OS; import it.planetgeeks.mclauncher.utils.FileUtils; import it.planetgeeks.mclauncher.utils.LanguageUtils; import java.awt.Image; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.net.URL; import java.util.ArrayList; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JOptionPane; /** * @author PlanetGeeks * */ class ThreadGetPacksInfo implements Runnable { @Override public void run() { ModPackUtils.analyzePacks(); } } public class ModPackUtils { public static ArrayList&lt;ModPack&gt; modPacks = new ArrayList&lt;ModPack&gt;(); public static EnumFilterType filter = EnumFilterType.ALL; public static String filterStr = null; public static ArrayList&lt;ModPack&gt; filteredList = new ArrayList&lt;ModPack&gt;(); public static ModPack selected = null; public static boolean updatePaused = false; public static boolean updateStopped = false; private static ArrayList&lt;M…
upvote count: 0
has comment: http://stackoverflow.com/comment/40719432
answer count: 1
tagged with: minecraft

http://stackoverflow.com/q/25947376
has comment: http://stackoverflow.com/comment/40622860
type: AnsweredQuestion
tagged with: reflection
accepted answer: http://stackoverflow.com/a/25960773
downvote count: 1
type: Question
has body: I'm writing a plugin for the Minecraft server implementation CraftBukkit, and I've come across a problem where I need to cast to a class that is found through reflection. Here's the deal. The original code I wrote looked like this, with irrelevant parts removed: import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Random; import net.minecraft.server.v1_7_R3.EntityAnimal; import net.minecraft.server.v1_7_R3.EntityHuman; import org.bukkit.craftbukkit.v1_7_R3.entity.CraftAnimals; import org.bukkit.craftbukkit.v1_7_R3.entity.CrafteEntity; import org.bukkit.World; import org.bukkit.entity.Animals; import org.bukkit.entity.Entity; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; public class Task extends BukkitRunnable { private static final int MATING_DISTANCE = 14; private final JavaPlugin plugin; private final Random randomizer; private boolean mateMode; private double chance; public Task(JavaPlugin plugin, double chance, boolean mateMode) { this.plugin = plugin; this.randomizer = new Random(); this.chance = chance; this.mateMode = mateMode; this.theTaskListener = listener; } public void run() { List&lt;World&gt; worlds = plugin.getServer().getWorlds(); Iterator&lt;World&gt; worldIterator = worlds.iterator(); while (worldIterator.hasNext()) { World world = worldIterator.next(); Collection&lt;Animals&gt; animals = world.getEntitiesByClass(Animals.class); Iterator&lt;Animals&gt; animalIterator = animals.iterator(); while (animalIterator.hasNext()) { Animals animal = (Animals) animalIterator.next(); EntityAnimal entity = (EntityAnimal) ((CraftEntity) ((CraftAnimals) animal)).getHandle(); EntityHuman feeder = null; entity.f(feeder); } } } } However, as you can see in the imports, this code imported the classes from only one version of the Minecraft server package - v1_7_R3. Now the problem is, I want to add support for more than that…
tagged with: java
has comment: http://stackoverflow.com/comment/40622964
possible better answer: http://stackoverflow.com/a/25947940
tagged with: bukkit
score: -1
has answer: http://stackoverflow.com/a/25947940
answer count: 3
tagged with: casting
upvote count: 0
has answer: http://stackoverflow.com/a/25949919
favorite count: 0
has title: Dynamic Typecasting in Java
has answer: http://stackoverflow.com/a/25960773

http://stackoverflow.com/comment/40640835
type: QuestionComment
score: 0
has text: Then add handling for `ol` (to reset the counter) and `li` (to insert the number).
comment on: http://stackoverflow.com/q/25956775
type: Comment

http://stackoverflow.com/a/25982328
has body: for (String[] y: x) Means 'for each String array (Called y) in the array of arrays (Called x)'. So y[0], for example is {"a", "a^2", "a^3"} Then similarly, for (String z: y) means 'for each String called z in the String array we previously defined as y. So z[0] at the first pass of y is "a". Then z[1] is "a^2" and z[2] is "a^3". This completes the iteration of the first entry of y, and we repeat with the next one, etc, etc.
answers question: http://stackoverflow.com/q/25982225
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/25918979
has comment: http://stackoverflow.com/comment/40573028
answers question: http://stackoverflow.com/q/25918671
upvote count: 1
type: Answer
has body: You have at least two obvious sources of NPE Document xml = xBuilder.parse(new URL("http://www.npr.org/rss/rss.php?id=1001").openStream()); if(xml==null) System.out.println("No XML DOM Document retrieved."); xml.getDocumentElement().normalize(); NodeList nList = xml.getElementsByTagName("channel"); if(nList ==null) System.out.println("No elements with tag name channel retrieved.");
downvote count: 0
score: 1

law-of-demeter
tags question: http://stackoverflow.com/q/26021140
type: Tag
tag name: law-of-demeter

jms
tags question: http://stackoverflow.com/q/25978784
tags question: http://stackoverflow.com/q/26009223
tags question: http://stackoverflow.com/q/25998284
tags question: http://stackoverflow.com/q/25891761
tags question: http://stackoverflow.com/q/26032272
tags question: http://stackoverflow.com/q/25999559
tags question: http://stackoverflow.com/q/25927269
tag name: jms
tags question: http://stackoverflow.com/q/25901363
tags question: http://stackoverflow.com/q/25884925
tags question: http://stackoverflow.com/q/25919108
tags question: http://stackoverflow.com/q/26033029
tags question: http://stackoverflow.com/q/25908124
type: Tag
tags question: http://stackoverflow.com/q/26003184
tags question: http://stackoverflow.com/q/26005902
tags question: http://stackoverflow.com/q/25878949
tags question: http://stackoverflow.com/q/25888400

http://stackoverflow.com/q/26028797
favorite count: 0
has body: I would like to create a limited version of my Android app, excluding about a dozen class files from the final APK. Of course, I can just move them to a different folder, or use "Build Path > Exclude". I am wondering if there were a more elegant way of achieving this, via a single flag somewhere in the project. Any ideas?
tagged with: android
linked to: http://stackoverflow.com/q/17107014
linked to: http://stackoverflow.com/q/16737006
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26029057
has comment: http://stackoverflow.com/comment/40771310
upvote count: 1
type: Question
tagged with: build
accepted answer: http://stackoverflow.com/a/26029057
score: 1
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/19912393
downvote count: 0
answer count: 1
has title: Conditionally excluding java files from build/apk

http://stackoverflow.com/q/25934678
has title: How to rotate the LinearGradient in a given Shape?
type: Question
has comment: http://stackoverflow.com/comment/40601261
upvote count: 12
score: 12
tagged with: javafx-8
answer count: 2
has comment: http://stackoverflow.com/comment/40600919
downvote count: 0
favorite count: 0
has body: I try to find the way to rotate the LinearGradient object nested into e.g. Rectangle object, say: Rectangle rect = new Rectangle(0, 0, 200, 200); LinearGradient lg = new LinearGradient(0, 0, 100, 0, false, CycleMethod.REPEAT, new Stop[] { new Stop(0, Color.BLACK); new Stop(0.5, Color.WHITE); new Stop(1, Color.BLACK); }); rect.setFill(lg); Now, I try to rotate this lg object, for example for 45 degrees to the left, but without rotating the whole rect. Is there any way to achieve that?
has answer: http://stackoverflow.com/a/73049916
possible better answer: http://stackoverflow.com/a/73049916
tagged with: javafx-2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25935582
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/40600680
accepted answer: http://stackoverflow.com/a/25935582

http://stackoverflow.com/comment/40602676
has text: Have any links or places for good tutorials on it?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25935909
score: 0

http://stackoverflow.com/a/25980544
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25980237
score: 1
has body: You should use a Producer-Consumer pattern. Have one thread to listen for changes in the files and pass off that work to other threads. You can use a BlockingQueue for this to make the code very simple. First you need two classes, a producer: class Producer implements Callable&lt;Void&gt; { private final BlockingQueue&lt;Path&gt; changedFiles; Producer(BlockingQueue&lt;Path&gt; changedFiles) { this.changedFiles = changedFiles; } @Override public Void call() throws Exception { while (true) { if (something) { changedFiles.add(changedFile); } //to make the thread "interruptable" try { Thread.sleep(TimeUnit.SECONDS.toMillis(1)); } catch (InterruptedException ex) { break; } } return null; } } And a Consumer: class Consumer implements Callable&lt;Void&gt; { private final BlockingQueue&lt;Path&gt; changedFiles; Consumer(BlockingQueue&lt;Path&gt; changedFiles) { this.changedFiles = changedFiles; } @Override public Void call() throws Exception { while (true) { try { final Path changedFile = changedFiles.take(); //process your file //to make the thread "interruptable" } catch (InterruptedException ex) { break; } } return null; } } So, now create an ExecutorService, submit one Producer and as many consumers as you need: final BlockingQueue&lt;Path&gt; queue = new LinkedBlockingDeque&lt;&gt;(); final ExecutorService executorService = Executors.newCachedThreadPool(); final Collection&lt;Future&lt;?&gt;&gt; consumerHandles = new LinkedList&lt;&gt;(); for (int i = 0; i &lt; numConsumers; ++i) { consumerHandles.add(executorService.submit(new Consumer(queue))); } final Future&lt;?&gt; producerHandle = executorService.submit(new Producer(queue)); So you guarantee that only one file is being worked on at a time because you control that yourself. You also do so with minimum synchronisation. It might be worthwhile the Consumer also reading the file to remove the the shared disc IO that will happen otherwise - this will likely slow the system down. You could also add another Consumer tha…
type: AcceptedAnswer
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25980237

http://stackoverflow.com/comment/40673382
has text: Thanks guys, for you support, I get what you are saying, give me some time and shall post an update.
comment on: http://stackoverflow.com/q/25974488
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40519719
has text: the compiler errors should give you enough clues
score: 0
comment on: http://stackoverflow.com/q/25890543
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40626945
has text: I notice if we type let's say 'list.remove(list.size() - 1), i', it means to remove the last 1 in the array right?
type: Comment
comment on: http://stackoverflow.com/a/25950124
score: 0
type: AnswerComment

http://stackoverflow.com/a/26027156
accepted answer of: http://stackoverflow.com/q/25874078
type: Answer
type: AcceptedAnswer
has body: From the documentation, it looks like you want to call getStartedActivityIntent().
answers question: http://stackoverflow.com/q/25874078
score: 0

http://stackoverflow.com/a/25976062
answers question: http://stackoverflow.com/q/25975750
score: 0
type: AcceptedAnswer
type: Answer
has body: You can have the current Locale injected into a controller method by simply declaring it as a parameter. Alternatively you could use LocaleContextHolder.getLocale().
accepted answer of: http://stackoverflow.com/q/25975750

http://stackoverflow.com/a/26013967
has body: To my knowledge this is not possible as of JDK 1.8. The only workaround is to detect retina and use the scale affine transform when drawing. However, detecting retina seems to be a problem since the only option that seems to be available isn't on a per monitor case which is probably not a good solution: How can I detect whether a Mac has a Retina display from Java?
answers question: http://stackoverflow.com/q/25906175
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/94920982
accepted answer of: http://stackoverflow.com/q/25906175

http://stackoverflow.com/comment/40711657
comment on: http://stackoverflow.com/a/25991572
has text: If you rewrite the URL using the catalog file, you don't need to upload anything. Catalog file may have any extension as long as you configure it in the POM: https://svn.java.net/svn/maven-jaxb2-plugin~svn/trunk/tests/episodes/d/pom.xml
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25939185
type: Answer
has body: A JSP is a servlet too, and hence you could immediately forward to the servlet. (Normally it is the other way round, the servlet as Controller, preparing a Data Model as request attribute and forwarding to a JSP View for displaying the data.) The servlet could be defined in the web.xml with a servlet mapping. If you use annotations instead the mapping is similar. &lt;% request.setAttribute("answer", "42"); RequestDispatcher rd = request.getRequestDispatcher("/myservlet"); rd.forward(request, response); return; // No output from the JSP %&gt; In the above "/myservlet" would correspond to the servlet mapping. Forwarding does not go back to the browser, but leaves that to the servlet forwarded to. You may alternatively redirect to the servlet. That means going back to the browser that then calls the servlet's URL. response.sendRedirect(response.encodeRedirectURL(redirect)); Though looking more circumstantial, it is frequently used to prevent the user navigating back on a posted form, submitting the form twice. If your question relates to file paths. request.getServletContext().getRealPath("/css/styles.css") is the normal way to receive file system paths. In NetBeans one makes a Web-Project generating a .war to deploy, and servlets may reside in any package you like. WEB-INF/web.xml for the traditional minded, Annotations in the servlet class otherwise.
answers question: http://stackoverflow.com/q/25938874
score: 0

http://stackoverflow.com/comment/40512234
has text: sorry for this.setEnabled(false);
type: Comment
comment on: http://stackoverflow.com/q/25885959
type: QuestionComment
score: 0

http://stackoverflow.com/q/25966036
tagged with: jsoup
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40656040
has title: StringIndexOutOfBoundsException error for String.charAt
score: 0
has body: I've created a java application about getting element from a web page and this is the code. public class rpms { public rpms() { } private static final String USER_AGENT = "Mozilla/5.0"; private static final String URL ="https://url.com"; public static void main(String[] args) { URLget labaccess = new URLget(); try { getElementTd(sendGetRequest(URL).toString()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static String sendGetRequest(String urlString) throws IOException { URL obj = new URL(urlString); HttpURLConnection httpConnection = (HttpURLConnection) obj .openConnection(); httpConnection.setRequestMethod("GET"); httpConnection.setRequestProperty("User-Agent", USER_AGENT); int responseCode = httpConnection.getResponseCode(); if (responseCode == 200) { BufferedReader responseReader = new BufferedReader( new InputStreamReader(httpConnection.getInputStream())); String responseLine; StringBuffer response = new StringBuffer(); while ((responseLine = responseReader.readLine()) != null) { response.append(responseLine + "\n"); } responseReader.close(); // print result return response.toString(); } return null; } public static void getElementTd(String sourceCode) throws FileNotFoundException, UnsupportedEncodingException { String fragment = sourceCode; ArrayList&lt;String&gt; ip = new ArrayList&lt;String&gt;(); Document doc = Jsoup.parseBodyFragment(fragment); Elements elements = doc.select("td p"); for (int i = 0; i &lt; elements.size(); i++) { // System.out.println(i+1+" ) "+elements.eq(i).text().toString()); if (fileExplode(elements.eq(i).text().toString())) { System.out.println(elements.eq(i).text().toString()); } } } public static boolean fileExplode(String str1) { boolean hasRPM = false; String[] split1 = str1.replace(".", " ").split(" "); for (int i = 0; i &lt; split1.length; i++) { if ((i + 1) == split1.length) { if (split1[i].equalsIgnoreCase("rpm") || (split1[i].charAt(0) == 'r' &amp;&amp; sp…
answer count: 1
duplicate of: http://stackoverflow.com/q/23111468
has answer: http://stackoverflow.com/a/25966103
linked to: http://stackoverflow.com/q/23111468
type: UnansweredQuestion
tagged with: java
tagged with: httpconnection
type: Question

http://stackoverflow.com/comment/40613274
type: QuestionComment
comment on: http://stackoverflow.com/q/25941362
score: 0
has text: Your AndroidManifest should declare SMSReceiver as a receiver instead of an activity. Then add the intent action and permission to listen for the BOOT_COMPLETED intent.
type: Comment

http://stackoverflow.com/q/25955389
tagged with: elasticsearch
has comment: http://stackoverflow.com/comment/40637857
favorite count: 0
has comment: http://stackoverflow.com/comment/40643319
answer count: 0
type: UnansweredQuestion
has body: Im using Spring MVC project in which Im using elasticsearch. I have created an elasticsearch.yml file in my SRC project folder. However, when I`m running on tomcat7 server Im getting an error: Failed to load setting from [file:/var/lib/tomcat7/webapps/projectName/WEB-INF/classes/elasticsearch.yml] These are contents in my elasticsearch.yml file DATA_DIR=/var/data/elasticsearch/
has comment: http://stackoverflow.com/comment/40637892
tagged with: tomcat7
tagged with: spring-mvc
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40637833
has comment: http://stackoverflow.com/comment/40638238
type: Question
downvote count: 0
has title: Elasticsearch yml file in tomcat7 failed to load settings
has comment: http://stackoverflow.com/comment/40637628
has comment: http://stackoverflow.com/comment/40638357
upvote count: 1

http://stackoverflow.com/comment/40550270
score: 1
comment on: http://stackoverflow.com/a/25906955
type: AnswerComment
has text: Thanks, that did it! I was looking in Selector and SelectionKey for some kind of remove(), thought the set was re-created every time.
type: Comment

http://stackoverflow.com/a/25984460
has comment: http://stackoverflow.com/comment/40702009
has comment: http://stackoverflow.com/comment/40741537
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40728378
answers question: http://stackoverflow.com/q/25981428
type: Answer
has body: Just connect the GZipOutputStream directly to the output stream and write. No file necessary.
upvote count: 2

http://stackoverflow.com/q/25902132
upvote count: 2
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25904444
tagged with: java
tagged with: gradle
tagged with: caching
type: Question
tagged with: intellij-idea
downvote count: 0
favorite count: 0
has body: Is there a way to configure Gradle to shorten the folder names of its cached dependencies? From the Gradle user guide it does not appear its possible, but figured to check with others. My use case is because using the 'idea' Gradle plugin it helps with settings up Module dependencies. A problem arises when the Module classpath becomes 'too long' for cmd.exe (I'm not trying to discuss these limitations). Idea loads the project just fine, but its unable to run my program since it states the classpath is too long. Since this is not an Idea problem, I figured it would be lovely if there was a way Gradle could cache deps using shorter folder names. Example from: C:\.gradle\caches\modules-2\files-2\com.google.application\application\2.0\SVABNSAVSASAMNVSMAVSASN\application.jar Options 1 To: C:\.gradle\caches\modules-2\files-2\c.g.a\a\2.0\SVABNSAVSASAMNVSMAVSASN\application.jar Options 2 To: C:\.gradle\caches\modules-2\files-2\co.go.ap\ap\2.0\[tinyurl-equivalent]\application.jar Options 3 To: C:\.g\c\m-2\f-2\c.g.a\a\2.0\[tinyurl-equivalent]\application.jar Options 4 To: C:\.g\[tinyurl-equivalent]\application.jar I do know that Idea does recognize the long classpath and prompts to enabled Dynamic Classpaths, but this has been known to cause other problems (some invoked apps cannot see the full classpath) and therefore I'd like to avoid this Idea option.
has answer: http://stackoverflow.com/a/25904444
has title: How to shorten Gradle dependency cache folder names?
answer count: 1

http://stackoverflow.com/comment/40588046
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25927093
has text: I Have restarted my server several times
score: 0

http://stackoverflow.com/a/25925805
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40584851
type: Answer
answers question: http://stackoverflow.com/q/25925306
accepted answer of: http://stackoverflow.com/q/25925306
score: 3
has body: As others have noted, you have two separate problems. The first one is that count++ (and count--) isn't an atomic operation, even for primitive int types. So this won't work without some sort of locking or other concurrency handling. For count++ where count is an int, the compiler generates something like the following byte code instructions: getstatic count iconst_1 iadd putstatic count This is not likely to be atomic even if/when compiled to native code. The second problem is that you are not locking on a consistent object, so operations are not serialised. The code: count++; // "count" is an "Integer" object type. Creates a new object. In essence it does something like the following: count = Integer.valueOf(count.intValue() + 1); So your count object is getting replaced by a new object, and subsequent entry into the synchronized section will be synchronizing against a different object. As a safety tip, if you are using synchronized (someObject), where someObject is a class or instance field, then it's a good idea to make that field final. That way it can't be inadvertently reassigned to a different value. There are two straightforward solutions to the problem that I can think of. One with locking against a specific object used for locking like so: public class ThreadInterference { public static final Object COUNT_LOCK = new Object(); public static int count = 1000; // Either "int" or "Integer" OK, depending on need public static class MyThread implements Runnable { @Override public void run() { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } for (int i = 0; i &lt; 10000; i++) { synchronized(COUNT_LOCK) { count++; count--; count++; count--; } } } } // And so on... } Another option is to use an AtomicInteger which may give better concurrent performance, if that matters: public class ThreadInterference { public static AtomicInteger count = new AtomicInteger(1000); public static class MyThread implements Runnable { @Override public…
upvote count: 3
has comment: http://stackoverflow.com/comment/40585138

http://stackoverflow.com/a/26486708
accepted answer of: http://stackoverflow.com/q/25909311
has comment: http://stackoverflow.com/comment/41610962
upvote count: 2
type: AcceptedAnswer
has body: You check the map for presence of the key, then spend time generating the value, then put the value into the map. While you're generating the value, another thread can process the same key. Since it's not been added yet, you now have two threads generating the same value. So the count of values generated is larger than the final size of the map. The solution is to add the result (may be a placeholder) and check for the key's presence atomically using putIfAbsent().
type: Answer
has comment: http://stackoverflow.com/comment/41607979
has comment: http://stackoverflow.com/comment/41620009
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25909311

http://stackoverflow.com/a/25903762
accepted answer of: http://stackoverflow.com/q/25903726
answers question: http://stackoverflow.com/q/25903726
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40544420
type: Answer
has body: You have an error in your loop condition for (firstLength=0;firstLength==firstArray.length;firstLength++) This should be for (firstLength=0;firstLength&lt;firstArray.length;firstLength++) Because the condition firstLength==firstArray.length is false, so your program will never enter the loop. And I believe: String[] firstArray = firstWord.split("\\a"); String[] secondArray = secondWord.split("\\a"); is wrong, you just need char array, so using this instead: char[] first = firstWord.toCharArray(); char[] second = secondWord.toCharArray(); Working version: public boolean anagram(String firstWord, String secondWord) { firstWord = firstWord.toLowerCase(); secondWord = secondWord.toLowerCase(); char[] firstArray = firstWord.toCharArray(); char[] secondArray = secondWord.toCharArray(); int firstLength = firstWord.length(); int secondLength = secondWord.length(); Map&lt;Character, Integer&gt; firstDictionary = new HashMap&lt;&gt;(); Map&lt;Character, Integer&gt; secondDictionary = new HashMap&lt;&gt;(); for (firstLength = 0; firstLength &lt; firstArray.length; firstLength++) { // System.out.println("checking the letter " + firstArray[firstLength] + " in array" + firstArray.toString()); if (!firstDictionary.containsKey(firstArray[firstLength])) { firstDictionary.put(firstArray[firstLength], 1); } else { firstDictionary.put(firstArray[firstLength], firstDictionary.get(firstArray[firstLength]) + 1); } } for (secondLength = 0; secondLength &lt; secondArray.length; secondLength++) { if (!secondDictionary.containsKey(secondArray[secondLength])) { secondDictionary.put(secondArray[secondLength], 1); } else { secondDictionary.put(secondArray[secondLength], secondDictionary.get(secondArray[secondLength]) + 1); } } if (firstDictionary.equals(secondDictionary)) { return true; } else { return false; } }
score: 1
has comment: http://stackoverflow.com/comment/40544508
upvote count: 1

http://stackoverflow.com/comment/40598005
type: AnswerComment
has text: I also agree that AlarmManager is not necessary - ACTION_BATTERY_CHANGED is not called very frequently. It is also worth repeating that as per http://developer.android.com/reference/android/content/Intent.html#ACTION_BATTERY_CHANGED this receiver must be registered in code and not in manifest.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25933382

http://stackoverflow.com/comment/40603990
comment on: http://stackoverflow.com/a/25935095
type: AnswerComment
has text: i am still working to understand thread system. Thanks for answers.
score: 0
type: Comment

http://stackoverflow.com/q/26008173
favorite count: 0
downvote count: 5
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40732838
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/40732830
tagged with: java
has title: How to simulate multiplication by addition java
has answer: http://stackoverflow.com/a/26008212
accepted answer: http://stackoverflow.com/a/26008212
type: Question
has comment: http://stackoverflow.com/comment/40732811
tagged with: simulate
has comment: http://stackoverflow.com/comment/40732886
has body: I need to simulate multiplication by addition by not using the operator of multiplication such as asterisk This is my code trial code but seems not working :( while (sum &lt; a + b) { sum += a; } System.out.println (a+" x "+b+" is "+sum); } }
answer count: 1

http://stackoverflow.com/comment/40760544
type: QuestionComment
has text: Can you give us sample input, expected output, and actual output? Your question is a bit too broad and it seems you're already printing out the total.
comment on: http://stackoverflow.com/q/26023421
score: 0
type: Comment

http://stackoverflow.com/q/25989449
has comment: http://stackoverflow.com/comment/40700153
has answer: http://stackoverflow.com/a/26452586
downvote count: 0
accepted answer: http://stackoverflow.com/a/27587874
has comment: http://stackoverflow.com/comment/40699782
favorite count: 0
has title: Parsing and Translating Java 8 lambda expressions
has comment: http://stackoverflow.com/comment/40700499
has comment: http://stackoverflow.com/comment/40700128
has comment: http://stackoverflow.com/comment/40699438
has comment: http://stackoverflow.com/comment/40700240
has comment: http://stackoverflow.com/comment/40700348
has comment: http://stackoverflow.com/comment/40699876
tagged with: expression-trees
tagged with: lambda
has comment: http://stackoverflow.com/comment/40699404
answer count: 4
has body: In C# you can enclose a lambda expression in an expression tree object and then possibly parse it. I was wondering if this is also possible in Java? What I'm looking for is doing something like this: BooksRepository.getAll() .where(b -&gt; b.getIban() == "SomeIban") .and(b -&gt; b.getAuthor() == "SomeAuthor"); //etc. And then the BooksRepository should somehow translate that query to the following RESTful API request based on the predicates specified as lambdas: GET http://mylibrary.com/books?Iban=SomeIban&amp;Author=SomeAuthor and then return the result to the client. Any idea if this is even possible in Java?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40700225
has answer: http://stackoverflow.com/a/26031279
has answer: http://stackoverflow.com/a/26022104
tagged with: java-8
has comment: http://stackoverflow.com/comment/40700457
type: Question
has answer: http://stackoverflow.com/a/27587874
tagged with: c#
has comment: http://stackoverflow.com/comment/40699002
has comment: http://stackoverflow.com/comment/40698917
possible better answer: http://stackoverflow.com/a/26031279
has comment: http://stackoverflow.com/comment/40700204
has comment: http://stackoverflow.com/comment/40700078
tagged with: java
score: 18
has comment: http://stackoverflow.com/comment/40699076
upvote count: 18
has comment: http://stackoverflow.com/comment/40699200

http://stackoverflow.com/q/25954176
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/25954249
type: Question
has title: Java Comp Sci nested loops to find closest fraction
has comment: http://stackoverflow.com/comment/40681759
score: 0
answer count: 2
tagged with: nested
has answer: http://stackoverflow.com/a/25954287
type: UnansweredQuestion
has body: I want to find the closest fraction equal to 16/76. Whenever i run this i get 1 no matter what. I am doing this for Java class in school. public class ClassOne { public static double limit = 16/76; public static double difference = 1; public static double numer = 1; public static double denom = 1; public static void main(String[] args) { for(int i = 1;i&lt;=100;i++) { for(int x = 1;x&lt;=100;x++) { double temp = limit-(double)(x/i); System.out.println((x/i)); if(Math.abs(temp) &lt; difference &amp;&amp; x/i != 16/76){difference = temp;numer = x; denom = i; System.out.println("hi");} } } System.out.println(numer + " " + denom); } }

http://stackoverflow.com/q/25944389
has comment: http://stackoverflow.com/comment/59690697
has comment: http://stackoverflow.com/comment/40621070
answer count: 7
has comment: http://stackoverflow.com/comment/59941495
favorite count: 0
linked to: http://stackoverflow.com/q/36089518
has comment: http://stackoverflow.com/comment/59956022
has comment: http://stackoverflow.com/comment/40618808
has answer: http://stackoverflow.com/a/36141259
has answer: http://stackoverflow.com/a/36143587
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40618947
has comment: http://stackoverflow.com/comment/40677478
upvote count: 11
has answer: http://stackoverflow.com/a/36119569
has comment: http://stackoverflow.com/comment/59690149
tagged with: httpconnection
has comment: http://stackoverflow.com/comment/59689906
has answer: http://stackoverflow.com/a/36160302
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40624082
has comment: http://stackoverflow.com/comment/40618490
has comment: http://stackoverflow.com/comment/59900368
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/46647612
has comment: http://stackoverflow.com/comment/40618385
has answer: http://stackoverflow.com/a/36106037
has body: I know there are several question regarding this topic But I did't find an answer in any of them. I'm trying to open a connection to my local server but I keep getting connection refused. I have the server running and I tested the connection with the Browser and with a Google App called Postman and it works. It's failing when opening the connection as if there where nothing to connect to. or maybe something is blocking the connection? I tested with firewall and antivirus down, no luck. testing in Postman the URL returns a User as it should... If I replace the url with "http://www.google.com" It Works fine. here is my code: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; /** * * @author Gabriel */ public class HttpConnection { public HttpConnection() { } public void makeRequest() throws MalformedURLException, IOException { String url = "http://localhost:8000/users/1"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); // optional default is GET con.setRequestMethod("GET"); //add request header con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"); con.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); con.setRequestProperty("Accept-Encoding", "gzip,deflate,sdch"); con.setRequestProperty("Accept-Language", "en-US,en;q=0.8,es;q=0.6"); con.setRequestProperty("Connection", "keep-alive"); con.setRequestProperty("Host", "localhost:8000"); int responseCode = con.getResponseCode(); System.out.println("\nSending 'GET' request to URL : " + url); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while (…
has comment: http://stackoverflow.com/comment/40618273
has answer: http://stackoverflow.com/a/36019834
has comment: http://stackoverflow.com/comment/40619005
has title: Java HttpUrlConnection throws Connection Refused

http://stackoverflow.com/comment/40595068
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25931650
score: 0
has text: an input element does not require an end tag. http://www.w3schools.com/tags/tag_input.asp

http://stackoverflow.com/q/25914987
upvote count: 1
tagged with: javapns
downvote count: 1
type: Question
has body: I'm building an application to send push notifications to Apple devices from ColdFusion 8 using notnoop's java-apns library, and when calling a method in the library, I'm receiving "method not found" exception, even though the method is clearly defined in the library (line 161). I am able to send push notifications successfully, just this one method is not working. What is possibly wrong here??? Code: &lt;cfscript&gt; LOCAL.APNSService = CreateObject("java", "com.notnoop.apns.APNS").newService() .withCert( "MyCert.p12", "MyPassword" ) .withProductionDestination() .build(); LOCAL.APNSService.start(); LOCAL.InactiveDevices = LOCAL.APNSService.getInactiveDevices(); LOCAL.payload = CreateObject("java", "com.notnoop.apns.APNS").newPayload() .badge(1) .alertBody("Hello, world.") .sound("PushNotification.caf") .build(); LOCAL.APNSNotification = CreateObject("java", "com.notnoop.apns.SimpleApnsNotification") .init( JavaCast("string", LOCAL.MyDeviceToken), JavaCast("string", LOCAL.payload) ); LOCAL.APNSService.push(LOCAL.APNSNotification); LOCAL.APNSService.stop(); &lt;/cfscript&gt; Exception: The getInactiveDevices method was not found. Stack Trace: coldfusion.runtime.java.MethodSelectionException: The getInactiveDevices method was not found. at coldfusion.runtime.java.ObjectHandler.findMethodUsingCFMLRules(ObjectHandler.java:322) at coldfusion.runtime.StructBean.invoke(StructBean.java:527) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2300)
has comment: http://stackoverflow.com/comment/40579584
has comment: http://stackoverflow.com/comment/40578998
score: 0
has answer: http://stackoverflow.com/a/26125396
answer count: 1
has comment: http://stackoverflow.com/comment/40945428
tagged with: apple-push-notifications
favorite count: 0
has title: Why can't I call java-apns getInactiveDevices() method in ColdFusion 8?
tagged with: coldfusion-8
has comment: http://stackoverflow.com/comment/40578851
accepted answer: http://stackoverflow.com/a/26125396
tagged with: coldfusion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40579086
has comment: http://stackoverflow.com/comment/40949944
has comment: http://stackoverflow.com/comment/40571419
tagged with: java

http://stackoverflow.com/comment/40600545
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25914564
type: Comment
has text: The org.nist (com.telestax) packages are not the issue- The javax.sip.* and javax.sdp.* are the problem, since they use the same name as the JDK's(SDK's) core libraries.

http://stackoverflow.com/a/26037479
has body: Looking at sources of FieldEditorPreferencePage, I found that initialize() is resetting PropertyChangeListeners for all fileds /** * Initializes all field editors. */ protected void initialize() { if (fields != null) { Iterator&lt;FieldEditor&gt; e = fields.iterator(); while (e.hasNext()) { FieldEditor pe = e.next(); pe.setPage(this); pe.setPropertyChangeListener(this); pe.setPreferenceStore(getPreferenceStore()); pe.load(); } } } initialize() is called after createFieldEditors(); protected Control createContents(Composite parent) { fieldEditorParent = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 0; layout.marginWidth = 0; fieldEditorParent.setLayout(layout); fieldEditorParent.setFont(parent.getFont()); createFieldEditors(); if (style == GRID) { adjustGridLayout(); } initialize(); checkState(); return fieldEditorParent; } So it is solved with code below @Override protected void initialize() { super.initialize(); expressPath.setPropertyChangeListener(new MyPropertyChangeListener(this)); } private class MyPropertyChangeListener implements IPropertyChangeListener{ private FieldEditorPreferencePage page; public MyPropertyChangeListener(FieldEditorPreferencePage nodePreferencePage) { page = nodePreferencePage; } @Override public void propertyChange(PropertyChangeEvent event) { page.propertyChange(event); // The IS_VALID property is only fired when the valid state changes. if (event.getProperty().equals(FieldEditor.IS_VALID)) { isValidPath = ((Boolean) event.getNewValue()).booleanValue(); if (!isValidPath) { expressVersion.setStringValue( "Selected path is not valid" ); } return; } if (!isValidPath) { // if it is still not valid file, we don't need to check again return; } if (event.getProperty().equals(FieldEditor.VALUE)) { String newExecutablePath = (String) event.getNewValue(); expressVersion.setStringValue( ProcessUtils.getCurrentVersionOf(newExecutablePath)); } } }
answers question: http://stackoverflow.com/q/26033966
score: 1
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/25948775
answers question: http://stackoverflow.com/q/25948706
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25948706
type: Answer
upvote count: 10
has body: Background: On Linux, it is not Java that is expanding the wildcards in the command arguments. The shell does it before the java command is launched. The way to stop the shell from expanding wildcards is to quote the arguments. How you do this depends on the shell you are using. Now for the Windows case ... which is what you are really asking about. From what I have read, the standard "cmd.exe" shell (in its various versions / flavours) does NOT do wildcard expansion. It is left to the application to do expansion (or not) on an ad-hoc basis. Obviously this is problematic for the Java "write once, run everywhere" philosophy, so the Java designers have tried to make wild-cards in command line arguments work on Windows like they do on Unix and Linux. But unfortunately, they can't do a perfect job of this ... hence this anomaly. However, according to this page, putting double quotes around an argument tells Java to not do wild-card expansion. But if this doesn't help, you are probably out of luck. Here are some links to Oracle documentation on this topic, taken from Oracle Java bug report #5036373: Java Wildcard expansion on Windows platform has been documented. See the following links: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html Wildcard expansion does not work in a Windows command shell for a single element classpath due to the Microsoft bug described in: http://connect.microsoft.com/VisualStudio/feedback/details/98756/vs2005-setargv-obj-wildcard-handling-broken. The limitations are also mentioned in 7u10 release notes: http://www.oracle.com/technetwork/java/javase/7u10-relnotes-1880995.html However, I think that the Oracle employee who wrote that was being deliberately obtuse, because the wildcard expansion in general is patently NOT documented in those "manual" pages. They only talk about wildcard expansion in the -cp argument.
score: 10

http://stackoverflow.com/a/26001684
has comment: http://stackoverflow.com/comment/40721375
has comment: http://stackoverflow.com/comment/40721223
has comment: http://stackoverflow.com/comment/40720890
has comment: http://stackoverflow.com/comment/40721544
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26001398
has comment: http://stackoverflow.com/comment/40720904
has comment: http://stackoverflow.com/comment/40721353
has comment: http://stackoverflow.com/comment/40721919
answers question: http://stackoverflow.com/q/26001398
score: 0
has comment: http://stackoverflow.com/comment/40720942
type: Answer
has comment: http://stackoverflow.com/comment/40721166
has comment: http://stackoverflow.com/comment/40721242
has body: I'm still unsure about your directory structure but this should work public class game { public static void main(String[] args) { try{ InputStream is = game.class.getResourceAsStream("/testing.txt"); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); System.out.println(reader.readLine()); } catch( IOException e){ } } }
has comment: http://stackoverflow.com/comment/40721129

http://stackoverflow.com/a/25941769
downvote count: 0
score: 10
has comment: http://stackoverflow.com/comment/40618433
has comment: http://stackoverflow.com/comment/40614666
has comment: http://stackoverflow.com/comment/40616821
has comment: http://stackoverflow.com/comment/40614864
type: Answer
has comment: http://stackoverflow.com/comment/40614807
has comment: http://stackoverflow.com/comment/40621594
has comment: http://stackoverflow.com/comment/40614482
has body: Be careful in your title, static fields and methods are NOT inherited. This means that when you comment staticMethod() in Sub , Sub.staticMethod() actually calls Super.staticMethod() then Sub static initializer is not executed. However, the question is more interesting than I thought at the first sight : in my point of view, this shouldn't compile without a warning, just like when one calls a static method on an instance of the class. EDIT: As @GeroldBroser pointed it, the first statement of this answer is wrong. Static methods are inherited as well but never overriden, simply hidden. I'm leaving the answer as is for history.
has comment: http://stackoverflow.com/comment/40617806
upvote count: 10
has comment: http://stackoverflow.com/comment/40614526
has comment: http://stackoverflow.com/comment/40617194
has comment: http://stackoverflow.com/comment/40614224
answers question: http://stackoverflow.com/q/25941744
has comment: http://stackoverflow.com/comment/60509025
has comment: http://stackoverflow.com/comment/60493369

http://stackoverflow.com/comment/40692449
score: 0
type: Comment
type: QuestionComment
has text: ok ok @nem i just tried it and it fails. i guess 2d array should be checked manually?
comment on: http://stackoverflow.com/q/25985791

http://stackoverflow.com/a/25919357
has comment: http://stackoverflow.com/comment/40573311
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40580673
type: Answer
has body: Here, &lt;TextView android:id="@+id/last_sync" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="@string/last_sync" /&gt; and then in onCreate() put the following: Resources resources = context.getResources(); String syncString = String.format(resources.getString(R.string.last_sync), fileLastSync); TextView lastSyncTextView = ( (TextView) findViewById(R.id.last_sync) ); lastSyncTextView.setText(syncString);
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25919088
answers question: http://stackoverflow.com/q/25919088
score: 1

http://stackoverflow.com/comment/40765522
has text: can you please [run this sample](https://github.com/googleads/googleads-mobile-android-examples/tree/master/admob/BannerExample) to rule out issues with your emulator. I just ran this example, and i see adview no problem.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26024849

http://stackoverflow.com/q/26016699
type: UnansweredQuestion
tagged with: android
score: 1
has comment: http://stackoverflow.com/comment/40747945
tagged with: java
has comment: http://stackoverflow.com/comment/40748502
has comment: http://stackoverflow.com/comment/40748069
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40748160
has answer: http://stackoverflow.com/a/26017266
linked to: http://stackoverflow.com/q/6407324
answer count: 2
has answer: http://stackoverflow.com/a/26016871
has comment: http://stackoverflow.com/comment/40748796
has title: Get pictures-url and text-url in Android
downvote count: 0
has body: I've developed an Android-application, which parses a web-page and as a result return pictures and texts from it. But when I show my application code to my customer, he said, he want me to write my application using more easy algorithm: application must find picture-urls and text-urls, and then show a content using founded urls. How to do it? This a parsing class from my application: public class NetworkConnect extends AsyncTask&lt;String, Void, Void&gt; { //Background processing ProgressDialog parsingBar = ProgressDialog.show(StackParser.this, "Working...", "requesting to URL and parsing content", true, false); protected Void doInBackground(String... arg) { try { Log.d(LOG_TAG, arg[0]); Document doc; Elements urls; Elements data; Intent intent = new Intent(StackParser.this, AvailableContent.class); doc = Jsoup.connect(arg[0]).timeout(10000).get(); data = doc.getAllElements(); Log.d(LOG_TAG, "Data: " + data.toString()); stringData = doc.text(); Log.d(LOG_TAG, "String data: " + stringData.toString()); urls = doc.select("[href$=.png]"); imageURL = urls.get(0).attr("href"); Log.d(LOG_TAG, "imageURL = " + imageURL); if(!stringData.equals("")) { intent.putExtra("Send to the content-activity", stringData); intent.putExtra("Send imagesURLs to the content-activity", imageURL); startActivity(intent); finish(); } else { intent.putExtra("Send to the content-activity", "empty"); startActivity(intent); finish(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //catch (InterruptedException e) { // TODO Auto-generated catch block //e.printStackTrace(); //} return null; } protected void onPostExecute(Void result) { //Убираем диалог загрузки parsingBar.dismiss(); } } }
favorite count: 0

http://stackoverflow.com/a/25894748
has body: You don't need to remove before calling put. JSONObject#put will replace any existing value. Simply call js.getJSONObject("glossary").getJSONObject("GlossDiv").put("seeds", "555"); But how to get to wanted key for one step? You don't. You have a nested object tree. You must go through the full tree to reach your element. There might be a library out there that does this for you, but underneath it all, it will be traversing everything.
answers question: http://stackoverflow.com/q/25894559
score: 10
upvote count: 10
downvote count: 0
type: Answer

compareto
tags question: http://stackoverflow.com/q/26019123
type: Tag
tag name: compareto

http://stackoverflow.com/comment/40501286
comment on: http://stackoverflow.com/q/25879761
has text: debug it by look at the values to see whats happening, print out sentancestart and sentanceend to see if they are different. looks like they are evaluating to the same values.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40604300
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25936809
score: 2
has text: It would be very helpful if you'd show us what `someIntegerValue` is.

http://stackoverflow.com/comment/40764828
has text: `setChildren()` is being used by other classes so I can not change it to `private`. But I did change setChildren() to set `Parent` for each `Child`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26024787

http://stackoverflow.com/comment/40552256
comment on: http://stackoverflow.com/a/25907014
type: AnswerComment
score: 0
type: Comment
has text: The problem seems to be more likely with compilation. Your application is not compiled successfully. Try checking the build path, clean and build the project, if you are using maven, try maven clean and then install.

http://stackoverflow.com/comment/40565726
type: Comment
type: QuestionComment
has text: Yes tried to mock a String object and now a string directly in the when method. Does not work. I'm new to testing as well so Maybe there is already a specific way to mock String methods.
comment on: http://stackoverflow.com/q/25915490
score: 0

http://stackoverflow.com/comment/40556085
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25910341
has text: @ares Not even in javaEE.

http://stackoverflow.com/a/25950541
downvote count: 0
answers question: http://stackoverflow.com/q/25932068
has body: Remember-me should work after a restart. Most likely you are sending the request over an insecure connection (HTTP), but you have set use-secure-cookie to true, which means the cookie will only be sent over HTTPS. Hence the browser doesn't send the cookie and the server doesn't log the user in. You should use an HTTPS connection to your server. You should be able to debug this by monitoring the requests and responses sent by your browser (always a good idea).
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/25910704
answer count: 1
has body: Noob question on generics. I was trying to override the loadAll method in the CacheLoader class. Its signature is public Map&lt;K,V&gt; loadAll(Iterable&lt;? extends K&gt; keys) now when I override with loadAll(List&lt;Integer&gt;) it throws an error and suggests removing the @Override annotation however the same works with loadAll(Iterable&lt;? extends Integer&gt;). Can someone tell me the difference. Isn't list an iterable too?
has answer: http://stackoverflow.com/a/25911026
tagged with: generics
has comment: http://stackoverflow.com/comment/40556774
has comment: http://stackoverflow.com/comment/40556648
accepted answer: http://stackoverflow.com/a/25911026
type: AnsweredQuestion
tagged with: guava
tagged with: java
type: Question
score: 0
has title: Guava Cache overriding error

http://stackoverflow.com/q/26021026
tagged with: spring
type: AnsweredQuestion
tagged with: cxf
has answer: http://stackoverflow.com/a/26069055
tagged with: java
has body: I'm trying to push some monitoring message to my client jsf page using websocket. But from past 2days have come close to solve but still unable to push message to jsf page though I sucesseded in creating connection to web socket. Here is my javaScript code. websocket = new WebSocket("ws://localhost:9000/jdbc/monitor"); websocket.binaryType = 'arraybuffer'; websocket.onopen = function(evt) { onOpen(evt); }; websocket.onclose = function(evt) { onClose(evt); }; websocket.onmessage = function(evt) { onMessage(evt); }; websocket.onerror = function(evt) { onError(evt); }; function startSocket() { websocket.send("Started"); } function stopSocket() { websocket.close(); } function onOpen(evt) { console.log("Connection opened" + evt); } function onClose(evt) { console.log("Connection closed" + evt); } function onMessage(evt) { console.log("Recieved message" + evt); } function onError(evt) { console.log("error occured" + evt); } function doSend(message) { console.log("sending message..."); websocket.send(reqmsg.value); } The CXF Rest Class @Path("/jdbc/") @Service public class JdbcMonitor { private final static Logger LOG = LoggerFactory.getLogger(JdbcMonitor.class); private final Set&lt;OutputStream&gt; monitor = new HashSet&lt;OutputStream&gt;(); @GET @Path("/monitor") @Produces("text/*") public StreamingOutput monitor() { return new StreamingOutput() { @Override public void write(OutputStream wr) throws IOException, WebApplicationException { LOG.debug("Recieved a connection"); monitor.add(wr); wr.write(("Regsitered for monitor at" + new java.util.Date() .toString()).getBytes()); LOG.debug("Write completed"); } }; } public synchronized void sendData(final String message) { LOG.debug("Triggered a websocket send"); int i=0; for (final Iterator&lt;OutputStream&gt; it = monitor.iterator();it.hasNext();) { LOG.debug("Sending number"+ i++); final OutputStream out = it.next(); try { out.write(message.getBytes()); } catch (IOException e) { try { out.close(); LOG.debug("Closing conne…
type: Question
answer count: 1
downvote count: 0
tagged with: websocket
has comment: http://stackoverflow.com/comment/65633396
accepted answer: http://stackoverflow.com/a/26069055
has title: CXF WebSocket configurtion
has comment: http://stackoverflow.com/comment/65633338
tagged with: cxfrs
favorite count: 0
score: 2
upvote count: 2

http://stackoverflow.com/q/25897909
tagged with: exception
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25898320
has comment: http://stackoverflow.com/comment/40533703
type: Question
has comment: http://stackoverflow.com/comment/40533781
has comment: http://stackoverflow.com/comment/40533681
accepted answer: http://stackoverflow.com/a/25898320
has comment: http://stackoverflow.com/comment/40533696
answer count: 1
has title: who handles RuntimeException?
has body: I have a class extends HttpServlet contains following two methods. When a client makes a request to web app running on a Tomcat server, http request will be handled via this class however if doSomething method throws RunTimeException how it gets handled based on below example? protected void doPost(HttpServletRequest reqst, HttpServletResponse resp) { doSomething(); } private void doSomething() { if (false) { throw new RuntimeException("exception caught calling doSomething method"); } else { ... } } [update] Can I add try/catch block inside of doPost where doSomething() is invoked?
linked to: http://stackoverflow.com/q/588634

http://stackoverflow.com/q/25946128
type: Question
has comment: http://stackoverflow.com/comment/40621102
has comment: http://stackoverflow.com/comment/40620606
has comment: http://stackoverflow.com/comment/40621176
has body: I will like to display a series of messages for few seconds and disappears during connection to DB. How do I do that in Java? The first message should say "Connecting to database", the second message should say "creating a database" and the last message should say " database creation successful". Here is the code of the class. I simply want to replace println statement with a pop up that closes it after few seconds. public class ExecuteSQL { static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://localhost/?allowMultiQueries=true"; // Database credentials static final String USER = "root"; static final String PASS = ""; public static void connectExe() { Connection conn = null; Statement stmt = null; try{ Class.forName("com.mysql.jdbc.Driver"); System.out.println("Connecting to database..."); conn = DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("Creating database..."); stmt = conn.createStatement(); String sql = Domain.getCurrentDatabaseSQL(); stmt.executeUpdate(sql); System.out.println("Database created successfully..."); }catch(SQLException se){ se.printStackTrace(); }catch(Exception e){ e.printStackTrace(); }finally{ try{ if(stmt!=null) stmt.close(); }catch(SQLException se2){ } try{ if(conn!=null) conn.close(); }catch(SQLException se){ se.printStackTrace(); } }//end try } } I'm using Swing.
has comment: http://stackoverflow.com/comment/40634639
has comment: http://stackoverflow.com/comment/40621602
answer count: 1
has comment: http://stackoverflow.com/comment/40635917
has title: How to display messages during long running task?
favorite count: 0
linked to: http://stackoverflow.com/q/13203415
has comment: http://stackoverflow.com/comment/40691705
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40620673
linked to: http://stackoverflow.com/q/9671546
has comment: http://stackoverflow.com/comment/40632373
has answer: http://stackoverflow.com/a/25953490
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40622667
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/40806079
downvote count: 1

http://stackoverflow.com/comment/40564769
has text: @JonSkeet didn't know that a line break could be represented by two characters, thanks for the advice
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25915073
score: 0

http://stackoverflow.com/q/25966492
tagged with: zebra-printers
type: UnansweredQuestion
tagged with: java
downvote count: 2
has title: Phonegap - Printing bluetooth
has answer: http://stackoverflow.com/a/26170895
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/29088116
tagged with: javascript
score: -1
tagged with: ionic-framework
answer count: 2
favorite count: 0
has body: I have the following problem: I have a MZ320 printer Zebra works by bluetooth, but application is under develop phonegap. I found this plugin (https://github.com/EionRobb/phonegap-print-plugins), but do not know how to implement it (and install). I am a neophyte at this, please help. My English sucks, sorry
tagged with: cordova

http://stackoverflow.com/a/25950462
type: Answer
has comment: http://stackoverflow.com/comment/44115308
has comment: http://stackoverflow.com/comment/40630067
has comment: http://stackoverflow.com/comment/40629701
has comment: http://stackoverflow.com/comment/40629807
has body: in your AndroidManifest give the following permission : &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt; and in java file : PowerManager powerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE); WakeLock wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Lock"); wakeLock.acquire(); release this lock when application is paused or destroyed or on button click: wakeLock.release(); hope it helps. few links : completely-disable-keyguard disable-keyguard-and-display-an-activity-to-the-user disabled-keyguard-lock-re-enables-itself-after-clicking-on-a-notification
answers question: http://stackoverflow.com/q/25949317
score: 0

http://stackoverflow.com/a/25959867
score: 0
has body: void mirror(struct node* node) { if (node==NULL) return; else { struct node* temp; /* do the subtrees */ mirror(node-&gt;left); mirror(node-&gt;right); /* swap the pointers in this node */ temp = node-&gt;left; node-&gt;left = node-&gt;right; node-&gt;right = temp; } }
upvote count: 1
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/25959795

http://stackoverflow.com/comment/60797333
type: Comment
has text: Maybe it would help to split up this question into 2 different parts? Part 1 about singleton and part 2 about sub-mediators.
type: QuestionComment
comment on: http://stackoverflow.com/q/26019794
score: 0

http://stackoverflow.com/a/25893349
score: 1
answers question: http://stackoverflow.com/q/25893249
upvote count: 1
has body: Keep in mind that there is a separation between the JVM that Eclipse itself is running in and the various JREs that you can configure in Eclipse to run your programs/applications. You need to specify to Eclipse what JVM you want it to run under, using eclipse.ini. That's separate from the Installed JREs configuration you show in your screen shot above.
downvote count: 0
type: Answer

http://stackoverflow.com/a/25944164
has comment: http://stackoverflow.com/comment/40618211
has comment: http://stackoverflow.com/comment/40732275
accepted answer of: http://stackoverflow.com/q/25941261
has comment: http://stackoverflow.com/comment/40732387
type: Answer
answers question: http://stackoverflow.com/q/25941261
has body: I'm not quite sure that I am understanding you correctly, but is this what you want? To simply store the time it takes to execute each sort and finally take their average. import java.util.Scanner; //call up classes to be used in the program import java.util.Random; public class TermProject { public static void main(String[] args) { int n; //designate variables int randomNumMin; int randomNumMax; int iteration; int swap; Scanner scan = new Scanner(System.in); //create scanner System.out.print("How many numbers should be in the array? "); //get input from user to designate the size of the array to be used n = scan.nextInt(); //this method allows for ease of use when changing the parameters of the program System.out.print("What should the minimum value for the array be? "); //user input, same reasoning, ease of use when changing parameters randomNumMin = scan.nextInt(); System.out.print("What about the maximum value? "); randomNumMax = scan.nextInt(); System.out.print("How many times do you want to run the program? "); //user input to designate how many times the program should execute iteration = scan.nextInt(); int[] ar = new int[n]; //create new array Random random = new Random(); //create foundation for random number generation long startTime; double[] eTime = new double[iteration]; // array used to store execution times for (int r = 0; r &lt; iteration; r++) { //tell program to start iterations here and run repitions System.out.println(); //up to the corresponding parse System.out.println("\n"); System.out.println(r + 1 + ". " + "The program will sort this array: "); //a label for the unsorted array startTime = System.nanoTime(); //store the current time when starting the loop for (int i = 0; i &lt; n; i++) { ar[i] = random.nextInt(ar.length); //populate unsorted array with randomly generated numbers System.out.print(" " + ar[i] + ", "); //print out the randomly generated array } for (int i = 0; i &lt; (n - 1); i++) { //sort the previously generated array for (in…
has comment: http://stackoverflow.com/comment/40618353
has comment: http://stackoverflow.com/comment/40748413
has comment: http://stackoverflow.com/comment/40633143
has comment: http://stackoverflow.com/comment/40633241
score: 0
has comment: http://stackoverflow.com/comment/40646855
type: AcceptedAnswer

http://stackoverflow.com/comment/40715718
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25986867
has text: Thank you! That worked. Do you have any insight as to why this statement doesn't work though? `JavaRDD<String> rdd = javaFunctions(sc).cassandraTable("tester", "empbyrole", Person.class).where("role=?", "IT Engineer").map(new Function<Person, String>()` it gives me an error if i leave the .where(), but if i remove it and leave the .map, the whole code works. it's documented that the .where should work
type: AnswerComment

github
tags question: http://stackoverflow.com/q/25998407
tags question: http://stackoverflow.com/q/25917852
tags question: http://stackoverflow.com/q/25902167
tags question: http://stackoverflow.com/q/25893524
tag name: github
type: Tag

http://stackoverflow.com/a/25970040
accepted answer of: http://stackoverflow.com/q/25969871
score: 4
upvote count: 4
has body: When i declare interface I{}; How is interface I related to Object class? From the Java Language Specification: If an interface has no direct superinterfaces, then the interface implicitly declares a public abstract member method m with signature s, return type r, and throws clause t corresponding to each public instance method m with signature s, return type r, and throws clause t declared in Object, unless a method with the same signature, same return type, and a compatible throws clause is explicitly declared by the interface. How would i consider reference variable o pointing to array c As stated in the comments, the array is itself a subclass of Object, so the following assignment is valid: Object o = c; The relevant part from the Java Language Specification says: In the Java programming language, arrays are objects (§4.3.1), are dynamically created, and may be assigned to variables of type Object (§4.3.2). This is also what is meant by "arrays are first class objects". In Java, an array is not a special type or some special construct - it is essentially a sub class of Object with additional fields (in particular length) (and some additional compiler support to be able to syntactically describe and initialize an array).
has comment: http://stackoverflow.com/comment/40782839
has comment: http://stackoverflow.com/comment/40663619
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40785694
downvote count: 0
has comment: http://stackoverflow.com/comment/40781621
answers question: http://stackoverflow.com/q/25969871
type: Answer
has comment: http://stackoverflow.com/comment/40663514

http://stackoverflow.com/q/25972681
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25985367
favorite count: 0
tagged with: rest
answer count: 1
tagged with: soap
has title: Same method for verify empty fields using REST and SOAP
accepted answer: http://stackoverflow.com/a/25985367
upvote count: 1
tagged with: web-services
has body: I created different methods for verify if there is empty fields in SOAP and REST services. For Soap i use something like this: if (fornecedor.isEmpty()) { throw new BadRequestException(error + " fornecedor"); } For REST i made this: if (fornecedor.isEmpty()) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, ERROR + " fornecedor"); } It means that I have @Context HttpServletResponse response as parameter in Rest and nothing on SOAP because it is an exception. There is other way to verify empty fields using same method for SOAP and REST?

http://stackoverflow.com/a/25969622
answers question: http://stackoverflow.com/q/25969553
type: Answer
has comment: http://stackoverflow.com/comment/40662539
has body: best solution is to use cron, async method which sun in the background, create one trigger for particular table where u required to get a update from, which store the data in one notification table using time stamp, the cron will automatically fire on specific time of duration like 2 min after(2000 miliseconds), this continues cron running process will notify every 2 min after any database changes (as notification)
score: 0
has comment: http://stackoverflow.com/comment/40662629

http://stackoverflow.com/q/25877154
has answer: http://stackoverflow.com/a/26887079
score: 0
answer count: 2
tagged with: atg
has comment: http://stackoverflow.com/comment/40679956
tagged with: atg-dynamo
tagged with: oracle-database
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/26020550
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26020550
has title: Getting ATG session scoped nucleus from Spring controller
tagged with: java
type: Question
has body: I have been struggling to see ATG profile in a Spring controller. At the begining, I thought it was possible to get atg profile from spring controller by reading this document by defining like this. <constructor-arg value="/atg/userprofiling/Profile"/> But, I have looked another atg documentation, and found out that session scoped neclues like /atg/userprofiling/Profile is not available if it does not go through atg DAF pipelining. Note:When you add your own servlets to the servlet pipeline, bear in mind that you cannot access the session object until the SessionServlet locates or creates it. So, if you add a servlet to the pipeline that needs to access the session object, make sure that your servlet appears in the pipeline after the SessionServlet. Thus, I tried to set PageFilter for spring servlets like the following. PageFilter /services/* HelloService com.my.services.HelloService HelloService /services/hello However, it failed. The reason is that spring Controller is not a Servlet, so that it cannot be at the end of ATG daf pipelininng. If I use a simple HttpServlet or DynamoServlet, I can access user profile. However, I really need to use Spring Framework because my company wants to use it. Another reason is we are at servlet2.3 and I really want to use Spring annotations. Questions are; Is there a way to get atg session scoped necleus from Spring controller without going through DAF pipelining? Like a JSP page, is there a way to set a spring controller at the end of ATG daf pipelining?
possible better answer: http://stackoverflow.com/a/26887079

datamapper
tag name: datamapper
type: Tag
tags question: http://stackoverflow.com/q/25893985

http://stackoverflow.com/a/26009617
accepted answer of: http://stackoverflow.com/q/26009453
type: Answer
answers question: http://stackoverflow.com/q/26009453
has body: You can use Map String cArray[]={"AX","BY","CZ"}; Map&lt;String, Integer&gt; map=new HashMap&lt;String, Integer&gt;(); map.put("A", 1); map.put("B", 2); map.put("C", 3); String[] c1Array = cArray[0].split("(?!^)");//Will give you A String[] c2Array = cArray[1].split("(?!^)");//Will give you B int total = map.get(c1Array[0]) + map.get(c2Array[0]); System.out.println(total);//Output: 3
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/40735716

http://stackoverflow.com/a/26008271
score: 1
has body: If you don't want it to blow up, you'll have to do something like this: public void arrayPrint() { if (array != null) { for(String i : array) { if(i != null) { System.out.println(i); } } } }
downvote count: 0
answers question: http://stackoverflow.com/q/26008209
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40672491
comment on: http://stackoverflow.com/q/25974194
score: 0
has text: If have added a screenshot with the info but the `BasicDataSourceConfig` constructor is not being reached in debug mode
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40787595
type: QuestionComment
has text: @munyul thanks for the explanation. Than this sounds gr8. However still overhead of an additional where condition can't be ignored. Thanks!!
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26032634

http://stackoverflow.com/comment/40690861
type: QuestionComment
comment on: http://stackoverflow.com/q/25966456
type: Comment
has text: @Alexander_Winter: no, I use ctrl+shift+F every day, it's format, ctrl+f without the shift is find. maybe your IDE is configured differently.
score: 0

http://stackoverflow.com/a/25892005
answers question: http://stackoverflow.com/q/25891788
score: -1
has body: Under normal circumstances. Java properties of the variable names are lowercase letter, such as: userName, ShowMessage, but there are special circumstances, taking into account certain interesting English acronym (USA, XML, etc.), JavaBean also allows capital letters beginning the attributes variable name, but must meet the first two letters of the variable is either all uppercase or all lowercase "requirements, such as: the IDCODE ICcard IDCODE property variable name is legal, but the iC, iCcard, iDCode attribute variables The name is illegal.
upvote count: 1
type: Answer
downvote count: 2

http://stackoverflow.com/comment/40603939
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25918356
score: 0
has text: If you don't like straight connections, try a spline and then make the path adjust width to match the two exits.

http://stackoverflow.com/q/25957356
favorite count: 0
accepted answer: http://stackoverflow.com/a/25957519
tagged with: android
has title: How to read text file and store in a vector of classes - Android
tagged with: c++
type: AnsweredQuestion
has body: I want to read a text file into my android program and store the contents in a vector of classes. A sample of the contents of the text file is shown below: Latitude Longitude Radioactivity 56.0349 -3.34267 8690000 56.0328 -3.342 867289 56.0328 -3.342 867289 56.0348 -3.34242 404430 56.0348 -3.34247 295287 56.0338 -3.34122 221830 56.0346 -3.34242 193347 56.0337 -3.34118 182304 56.0342 -3.34141 155572 56.0337 -3.34173 145229 56.0347 -3.34239 125143 I want to store these values in a vector (or an array since the list is of finite length) so that I can access the list in a for loop to compare the users current position to the list of points (like geofencing except I have a database of points). I have already done this in c++ but I have not programmed in java before and this is my first android app. Below is my c++ code. My question is, how do I do the same thing in java for my android app?? #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt; #include &lt;fstream&gt; #include &lt;vector&gt; #include &lt;iomanip&gt; using namespace std; struct radioactivityData { double lat; double lon; int radioactivity; }; int main() { std::ifstream dataFile; dataFile.open("combinedorderedData.txt"); std::string tmpLine; std::vector&lt;radioactivityData&gt; radioactivityTable; while(std::getline(dataFile, tmpLine)) { std::stringstream inputLine(tmpLine); radioactivityData rad; if(!(inputLine &gt;&gt; rad.lat &gt;&gt; rad.lon &gt;&gt; rad.radioactivity)) { // ... error parsing input. Report the error // or handle it in some other way. continue; // keep going! } radioactivityTable.push_back(rad); }
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25957519
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/40644690
has text: @Zouter: you're not showing us the code for the Punt class, but surely it has methods for extracting its x and y values.
type: Comment
comment on: http://stackoverflow.com/a/25960047
score: 0
type: AnswerComment

http://stackoverflow.com/a/25947638
score: 0
type: Answer
has body: Same code, with average outside the loop and the useless array removed: Scanner scanner = new Scanner(System.in); double sum = 0; System.out.println("How many entries would you like input"); int entry = scanner.nextInt(); for (int counter = 1; counter &lt;= entry; counter++) { System.out.println("Please input number " + counter); sum += scanner.nextDouble(); } System.out.println("The total sum is: " + sum); double average = sum / entry; System.out.println("The total average is: " + average);
answers question: http://stackoverflow.com/q/25947567

http://stackoverflow.com/q/25956890
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/13387742
has answer: http://stackoverflow.com/a/25956956
duplicate of: http://stackoverflow.com/q/13387742
has answer: http://stackoverflow.com/a/25956915
tagged with: android
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40639174
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40639239
downvote count: 1
type: Question
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40638893
has body: I am trying to create a type of triangle app for my homework but when I tried to use if statement in java, for some reason, when I click on the "Generate Button", it keeps on showing the " Scalene Triangle: No Congruent Sides" , even thought my inputs are : 2,2,3 which should be an Isosceles Triangle. Please help. Is my logic wrong or something? Thanks a lot. Java code: package com.example.trianglegame; import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class TriangleGame extends Activity {// implement-have to use all of the // methods // set up the variables here Button Gen; EditText Input1; EditText Input2; EditText Input3; TextView Output1; TextView Output2; TextView Output3; TextView Display; Editable a; Editable b; Editable c; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.game); Input1 = (EditText) findViewById(R.id.editText1); a = Input1.getText(); Input2 = (EditText) findViewById(R.id.editText2); b = Input2.getText(); Input3 = (EditText) findViewById(R.id.editText3); c = Input3.getText(); Display = (TextView) findViewById(R.id.textView5); // display edit text Gen = (Button) findViewById(R.id.button1); Gen.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if ((a == b && b != c) || (a == c && b != c) || (b == c && a != c)) { Display.setText("Isosceles Triangle: 2 Congruent Sides"); } else if (a == b && a == c && b == c) { Display.setText("Equilateral Triangle:All sides are equal"); } else if (a != b && a != c && b != c) { Display.setText("Scalene Triangle: No Congruent Sides"); } else { Display.setText("Error"); } } }); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); } } xml code…
has title: If statement not working for android programming
tagged with: java
score: -1

http://stackoverflow.com/a/30109508
has body: Just for fun, I wrote a Angular js directive for doing this same thing: angular.module('ldPortal.directives') .directive('routingnumber', function(){ return { // only use as an attribute restrict: 'A', require: 'ngModel', link: function(scope, elem, attr, ctrl){ var regex = new RegExp('^[0-9]{9}$',''); var num_at = function(str, index){ try { return parseInt(str.charAt(index)) }catch (execption){ console.write(execption); } }; var validate = function(value){ if(! (value)){ return false; } var strVal = value.toString(); if (!regex.test(strVal)){ return false; } var checksum = parseInt(strVal.substr(strVal.length-1)); var sum = 0; sum += 7 * (num_at(strVal, 0)+num_at(strVal, 3)+num_at(strVal,6)); sum += 3 * (num_at(strVal, 1)+num_at(strVal, 4)+num_at(strVal, 7)); sum += 9 * (num_at(strVal, 2)+num_at(strVal, 5)); var mod = sum % 10; return checksum == mod; }; ctrl.$parsers.push(function(value){ var is_valid = validate(value); ctrl.$setValidity('routingnumber', is_valid); return is_valid ? value : undefined; }); ctrl.$formatters.push(function(value){ var is_valid = validate(value); ctrl.$setValidity('routingnumber', is_valid); return value; }); } }; });
has comment: http://stackoverflow.com/comment/61918191
has comment: http://stackoverflow.com/comment/63958094
score: 0
has comment: http://stackoverflow.com/comment/61888492
has comment: http://stackoverflow.com/comment/63972163
type: Answer
answers question: http://stackoverflow.com/q/25936153

http://stackoverflow.com/comment/40760576
score: 0
comment on: http://stackoverflow.com/q/26023073
type: QuestionComment
type: Comment
has text: the code in the first code block works, did you try using the 2 alternate regexps below though? (they didn't paste in correct java format for some reason so you'd have to add backslashes back in)

http://stackoverflow.com/a/25981067
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: File file = new File("E:\\Testing.txt"); If you trying to access E this is one of the ways to do it
answers question: http://stackoverflow.com/q/25980887

http://stackoverflow.com/comment/86367528
has text: Interesting! I tried it but Eclipse says the directory (Web, XML, Java EE and OSGi) is installed already. Yet, when I create a new Dynamic Web Project. In the Package Explorer, they are missing!
type: Comment
comment on: http://stackoverflow.com/a/25906159
type: AnswerComment
score: 0

http://stackoverflow.com/q/25969655
has title: XStream marshalling unmarshalling XMLGregorianCalendar and Java.util.Date
tagged with: java.util.date
has body: Firstly a bit of background information an please forgive me if the format isn't correct. I have two objects I am trying to map back and forth from via XML. One is auto-generated via wsimport so I am not able to use JAXB or XStream annotations. The other is auto-generated by the tool we are implementing. I am in a situation where I am trying to map two objects to each other which are identical other than the Date fields on one is a Java.util.Date's and the other is a XMLGregorian Calendar. I figured the quickest way instead of a huge manual mapping process would be to use XStream to grab XML String swap the root elements around and serialize to the other object. That's when I encountered the problem with converting dates. I have tried using a converter but again I am encountering another conversion issue. I hope someone might be able to help me with this. I have two test entities: import java.util.Date; import javax.xml.datatype.XMLGregorianCalendar; import com.eccles.utilities.*; public class SampleEntityGregorian { private XMLGregorianCalendar date = DateUtils.xmlGregCalFromDate(new Date()); public XMLGregorianCalendar getGregCal() { return date; } public void setGregCal(XMLGregorianCalendar gregCal) { this.date = gregCal; } } And import java.util.Date; public class SampleEntityJavaUtil { private Date date = new Date(); public Date getUtilDate() { return date; } public void setUtilDate(Date utilDate) { this.date = utilDate; } } I have a custom converter that I am registering with Xstream to marshall/unmarshall from jav.util.date and XMLGregorianCalendar between the two. import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.GregorianCalendar; import java.util.Locale; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.converters.Mar…
accepted answer: http://stackoverflow.com/a/25975784
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
score: 0
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25975784
tagged with: jaxb
type: Question
tagged with: xstream

http://stackoverflow.com/q/26010659
favorite count: 0
has comment: http://stackoverflow.com/comment/40737262
type: UnansweredQuestion
tagged with: addition
tagged with: append
has answer: http://stackoverflow.com/a/26011487
has comment: http://stackoverflow.com/comment/40738192
has body: I'm creating an application which will get the all the rpms in the table, well when I want to append it to a textfile something wrong, Please see the code below. public class rpms(){ public static void main(String[] args) { URLget rpms = new URLget(); try { getTdSibling(sendGetRequest(URL).toString()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static void getTdSibling(String sourceTd) throws FileNotFoundException, UnsupportedEncodingException { String fragment = sourceTd; Document doc = Jsoup.parseBodyFragment(fragment); for (Element table : doc.select("table")) { for (Element row : table.select("tr")) { Elements lines = row.select("td"); String linesToStr = lines.text(); String[] linestoStrArray = linesToStr.split("\n"); for (String line : linestoStrArray) if (!line.contains("Outdated")){ //System.out.println(""+line);// display the rpms that do not have outdated for (int i = 0; i &lt; lines.size(); i++) { if(!lines.eq(i).text().toString().equals(" ")){ splitStr(lines.eq(i).text().toString()); } } } } } } public static void splitStr(String str1) throws FileNotFoundException, UnsupportedEncodingException{ ArrayList&lt;String&gt; outputContent = new ArrayList&lt;String&gt;(); String[] split1 = str1.split(" "); for (int i = 0; i &lt; split1.length; i++) { if(fileExplode(split1[i])){ System.out.println(split1[i]); outputContent.add(split1[i]); } } copyFile(outputContent); } public static void copyFile(ArrayList&lt;String&gt; fileCon1) throws FileNotFoundException, UnsupportedEncodingException{ PrintWriter writer1 = new PrintWriter("C:\\Users\\usersb\\Downloads\\rpms\\newrpms.txt", "UTF-8"); for(int i = 0 ; i &lt; fileCon1.size() ; i++){ writer1.println(fileCon1.get(i)); } System.out.println("updated newrpms.txt"); writer1.close(); } public static boolean fileExplode(String str1) { boolean hasRPM = false; String[] split1 = str1.replace(".", " ").split(" "); for (int i = 0; i &lt; split1.length; i++…
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/40737552
type: Question
has comment: http://stackoverflow.com/comment/40737504
score: -2
has comment: http://stackoverflow.com/comment/40737685
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40737329
has comment: http://stackoverflow.com/comment/40737725
has comment: http://stackoverflow.com/comment/40738251
tagged with: jsoup
upvote count: 0
answer count: 1
has title: Append strings to a file

http://stackoverflow.com/comment/80439821
comment on: http://stackoverflow.com/a/28489471
has text: You could also do a similar thing with `jetty-env.xml` (although it might not be the architecturally ideal place): ` <New class="org.eclipse.jetty.server.handler.GzipHandler"/> ` (for Jetty 8.1; package name might have changed in Jetty 9)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25926770
tagged with: android
has comment: http://stackoverflow.com/comment/40586488
has comment: http://stackoverflow.com/comment/40586439
has comment: http://stackoverflow.com/comment/40586440
tagged with: android-activity
linked to: http://stackoverflow.com/q/16092431
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40587958
has comment: http://stackoverflow.com/comment/40586720
has comment: http://stackoverflow.com/comment/40587144
downvote count: 1
has comment: http://stackoverflow.com/comment/40587530
type: Question
has title: Android Home Button Click crashes the app
tagged with: android-layout
tagged with: java
has comment: http://stackoverflow.com/comment/40586879
has comment: http://stackoverflow.com/comment/40588087
has answer: http://stackoverflow.com/a/25928730
accepted answer: http://stackoverflow.com/a/25928730
has comment: http://stackoverflow.com/comment/40587545
score: 0
has comment: http://stackoverflow.com/comment/40586872
has comment: http://stackoverflow.com/comment/40587238
upvote count: 1
has comment: http://stackoverflow.com/comment/40587867
answer count: 1
has comment: http://stackoverflow.com/comment/40586667
has comment: http://stackoverflow.com/comment/40586905
has comment: http://stackoverflow.com/comment/40586570
has body: I am developing an application in which I came across a weird problem. The app works fine but when the user clicks on home button of the device the app crashes giving the following error. LogCat ** 09-19 10:45:33.989: W/ResourceType(4263): Failure getting entry for 0x7f0a0017 (t=9 e=23) in package 0 (error -75) 09-19 10:45:33.989: D/AndroidRuntime(4263): Shutting down VM 09-19 10:45:33.989: W/dalvikvm(4263): threadid=1: thread exiting with uncaught exception (group=0x41615d88) 09-19 10:45:34.039: E/AndroidRuntime(4263): FATAL EXCEPTION: main 09-19 10:45:34.039: E/AndroidRuntime(4263): Process: com.squarespix.MobieAlert, PID: 4263 09-19 10:45:34.039: E/AndroidRuntime(4263): android.view.InflateException: Binary XML file line #7: Error inflating class &lt;unknown&gt; 09-19 10:45:34.039: E/AndroidRuntime(4263): at android.view.LayoutInflater.createView(LayoutInflater.java:620) 09-19 10:45:34.039: E/AndroidRuntime(4263): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 09-19 10:45:34.039: E/AndroidRuntime(4263): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669) 09-19 10:45:34.039: E/AndroidRuntime(4263): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694) 09-19 10:45:34.039: E/AndroidRuntime(4263): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 09-19 10:45:34.039: E/AndroidRuntime(4263): at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 09-19 10:45:34.039: E/AndroidRuntime(4263): at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 09-19 10:45:34.039: E/AndroidRuntime(4263): at com.squarespix.MobieAlert.PostsGridAdapter.getView(PostsGridAdapter.java:134) 09-19 10:45:34.039: E/AndroidRuntime(4263): at android.widget.AbsListView.obtainView(AbsListView.java:2263) 09-19 10:45:34.039: E/AndroidRuntime(4263): at android.widget.GridView.onMeasure(GridView.java:1048) 09-19 10:45:34.039: E/AndroidRuntime(4263): at android.view.View.measure(View.jav…
favorite count: 0
has comment: http://stackoverflow.com/comment/40587149

http://stackoverflow.com/comment/40514888
comment on: http://stackoverflow.com/a/25886142
score: 0
type: AnswerComment
has text: yes you can move the `onClick()` code out of the block, move some edits to the code and then put the code just before you call `show()` on the dialog
type: Comment

http://stackoverflow.com/comment/40648729
comment on: http://stackoverflow.com/a/25962011
type: Comment
has text: This library comes with struts2-json-plugin, if you are using this plugin, then it uses that library as a dependency.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40545422
comment on: http://stackoverflow.com/q/25904346
has text: yes no comma after last letter, Character i mean only three upper case alphabets A,E and R
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25934791
has body: I was trying to follow a tutorial over at Mkyong regarding Spring. I created two simple classes, Customer and Person, which look like so: Customer: public class Customer { private Person person; public Customer() { } //Getters and setters for person here public String toString() { return "Customer [person=" + person +"]"; } } Person: public class Person { private String name; private String address; private int age; public Person() { } public Person(String name, String address, int age) { this.name = name; this.address = address; this.age = age; } //All getters and setters public String toString() { return "Person [address=" + address + ", age=" + age + ", name=" + name + "]"; } } I then created a Bean configuration file, using an inner bean (which is why I was taking the tutorial) that looks like so: // Standard bean declarations &lt;bean id="CustomerBean" class="com.andrew.SpringInnerBeans.Customer"&gt; &lt;property name="person"&gt; &lt;bean class="com.andrew.SpringInnerBeans.Person"&gt; &lt;property name="name" value="Andrew" /&gt; &lt;property name="address" value="Address" /&gt; &lt;property name="age" value="27" /&gt; &lt;/bean&gt; &lt;/property&gt; &lt;/bean&gt; &lt;/beans&gt; Finally, I created a MainApp to run this code: public static void main (String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "NewBean.xml"}); Customer cust = (Customer) context.getBean("CustomerBean"); System.out.println(cust); } Now, to my understanding, this is what is happening: The xml file is loaded and the bean with id CustomerBean is stored in the reference cust (which is a Customer object). CustomerBean takes an argument, "person", and the details of the three parameters which create the Person are supplied as the inner bean of customerBean. In the MainApp, the toString method of the reference cust is called and the proper output is displayed. As I am specifically providing references in my examples, why is a no argument constructor re…
accepted answer: http://stackoverflow.com/a/25935183
linked to: http://stackoverflow.com/q/7492652
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40600492
upvote count: 8
has title: Why is a no-args constructor needed to run this simple Spring configuration?
has answer: http://stackoverflow.com/a/25935111
has answer: http://stackoverflow.com/a/25935211
answer count: 4
score: 8
tagged with: constructor
has answer: http://stackoverflow.com/a/25935183
tagged with: spring
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25934930
has answer: http://stackoverflow.com/a/25934930
has comment: http://stackoverflow.com/comment/40600435
tagged with: java

http://stackoverflow.com/a/25936192
has body: Did you add this entry in /etc/hosts? 127.0.0.1 www.example.com If you did try this: ProxyPass / http://www.example.com:8080/sampleApp ProxyPassReverse / http://www.example.com:8080/sampleApp Otherwise: ProxyPass / http://localhost:8080/sampleApp ProxyPassReverse / http://localhost:8080/sampleApp and remove the proxyPort from your server.xml ps: remember to restart both tomcat and apache2
score: 0
answers question: http://stackoverflow.com/q/25935138
type: Answer
has comment: http://stackoverflow.com/comment/40604457
has comment: http://stackoverflow.com/comment/40606682

protractor
tags question: http://stackoverflow.com/q/25996987
tag name: protractor
type: Tag

http://stackoverflow.com/comment/40648397
has text: @HovercraftFullOfEels Maybe I'm misinterpreting the question too, but I think he has just a Component (`JPanel`) where he paints things into, and he don't care about the subcomponents - I think if he had, he would have already posted a comment to say this
comment on: http://stackoverflow.com/a/25960069
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40634621
comment on: http://stackoverflow.com/a/25954556
type: AnswerComment
score: 0
has text: you ran the code before i modified it. run my answer (current) again. the bug was fixed before you gave me that -1 vote.
type: Comment

http://stackoverflow.com/comment/40710450
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25995625
has text: @MikeAllen sorry, I missed the point of your question. So, back to the topic. It appears that there is no simple and clear way to make MessageFormat format Doubles as you want. I can just point that giving custom pattern like "#.##########################" will work (as you mentioned), but it doesn't actually require knowledge about Double's precision. You can specify any number of digits after point and it will work. Maybe you can consider making format constant with some extra digits in the tail and using it where appropriate.

http://stackoverflow.com/q/25995063
type: AnsweredQuestion
has title: How can i pass an array to an object during its initialisation in java? this gives me an error num can't be resolved (last line of code)
accepted answer: http://stackoverflow.com/a/25995133
downvote count: 2
type: Question
tagged with: object
tagged with: java
has answer: http://stackoverflow.com/a/25996821
tagged with: class
answer count: 3
upvote count: 0
tagged with: arrays
possible better answer: http://stackoverflow.com/a/25995170
has body: I want to know why the following code throws an error like num can't be resolved although I have already declared an array and initialised it. I am trying to pass an array to an object during creation of an object.... is it not allowed or there is some other error in my code? import java.util.Scanner; public class Search { public Search(int x[]) { for (int i=0;i&lt;10;i++) System.out.println("inside a constructer"+x[i]); } public static void main(String[] args) { Integer num[] = new Integer[10]; Scanner sc =new Scanner(System.in); System.out.println("Eneter the 10 integers:"); for(int i=0;i&lt;10;i++) { System.out.println("Enter the "+(i+1)+" number:"); num[i]=sc.nextInt(); } for(int j=0;j&lt;10;j++) System.out.println(num[j]); } Search obj=new Search(num); }
has answer: http://stackoverflow.com/a/25995133
has answer: http://stackoverflow.com/a/25995170
favorite count: 0
has comment: http://stackoverflow.com/comment/40708587
has comment: http://stackoverflow.com/comment/40708657
has comment: http://stackoverflow.com/comment/40708542
score: -2

http://stackoverflow.com/comment/40691068
comment on: http://stackoverflow.com/a/25983912
score: 0
type: Comment
has text: You need to post your AndroidManifest, but it sounds like you have not specified all of the config changes that are required for the AdActivity.
type: AnswerComment

http://stackoverflow.com/q/25914102
has answer: http://stackoverflow.com/a/25916502
type: UnansweredQuestion
has title: Use Solr to index my database
tagged with: java
tagged with: solr
type: Question
tagged with: lucene
has body: I don't know why my code java is not compiled. I need to index my database with solr. I launch my server with line commande . &gt;cd C:\Solr\solr-4.10.0\solr-4.10.0\example\solr &gt;java -jar start.jar After that i create a new project that contain my class to index database with solr. import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; //import org.apache.lucene.index.IndexWriter; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.impl.HttpSolrServer;// CommonsHttpSolrServer; import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest; import org.apache.solr.client.solrj.request.AbstractUpdateRequest.ACTION; import org.apache.solr.client.solrj.response.UpdateResponse; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.client.solrj.impl.HttpSolrServer; public class IndexFiles { public static void main(String[] args) { HttpSolrServer server = new HttpSolrServer("http://localhost:8983/solr/"); // i use SolrServer but it generate same error like this from httpSolrServer //SolrServer solr = new HttpSolrServer("http://localhost:8983/solr"); /* // TODO Auto-generated method stub String urlString = "http://localhost:8989/solr"; if (args != null &amp; args.length &gt; 1) { urlString = args[1]; } SolrServer solr = new HttpSolrServer("http://localhost:8983/solr"); //CommonsHttpSolrServer(urlString); try { indexDocs(solr, new File(args[0])); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } */ } } I get this error : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/NoHttpResponseException at IndexFiles.main(IndexFiles.java:23) Caused by: java.lang.ClassNotFoundException: org.apache.http.NoHttpResponseException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at …
score: 0
answer count: 1

http://stackoverflow.com/comment/40694553
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25984840
has text: Spring Security ACL might help you check this [tutorial](http://krams915.blogspot.ae/2011/01/spring-security-3-full-acl-tutorial.html)
score: 1

http://stackoverflow.com/comment/40774132
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26030516
type: Comment
has text: I don't think that's right. I mean, I obviously don't know, but I don't think so. How do you pass the arraylist to the adapter? Isn't it already adapting it? Isn't .add() the way you pass new values to the adapted array?

move
tags question: http://stackoverflow.com/q/25889904
tag name: move
type: Tag

javabeans
tags question: http://stackoverflow.com/q/25940298
type: Tag
tags question: http://stackoverflow.com/q/25903781
tag name: javabeans
tags question: http://stackoverflow.com/q/25874942

http://stackoverflow.com/a/25894037
score: 0
has body: Instead of using an AlertDialog use a ProgressBar, it will do the trick for you. private ProgressDialog progressBar; @Override protected void onPreExecute() { super.onPreExecute(); progressBar.setIndeterminate(true); progressBar.setCancelable(false); progressBar.setMessage("Your message"); progressBar.show(); } @Override protected void onPostExecute(final String error_code) { progressBar.dismiss(); }
type: Answer
answers question: http://stackoverflow.com/q/25893786

http://stackoverflow.com/comment/40538745
has text: I understand how I received the output I got, what doesnt make sense is that the dependency chain for the objects did not change, only the XML did. I order them one way, I dont leak resources, I order them the other, and I do. It seems to me that Spring should probably be checking at the very least that it can find the required type of the A class before constructing B. Same for B to C. But clearly it doesnt. IMHO, this pretty much eliminates Spring as an acceptable solution to serialization in the event classes have resources which need to be cleaned up.
comment on: http://stackoverflow.com/a/25900576
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25951351
has comment: http://stackoverflow.com/comment/40673523
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40675406
has body: The expression langauge (EL) ${item.id} is evaluated to empty string. That means that the item's id is null. You can do two things: Make sure that item exists in the scope (pageScope, requestScope, sessionScope...) that you want. Use a default value. &lt;input type="hidden" name="id" value="${not empty item.id ? item.id : '0' }"&gt;
has comment: http://stackoverflow.com/comment/40674686
answers question: http://stackoverflow.com/q/25951167

http://stackoverflow.com/comment/40543653
type: Comment
type: QuestionComment
score: 7
has text: Your question really isn't a good fit for this site. Please read the Help Center.
comment on: http://stackoverflow.com/q/25903354

http://stackoverflow.com/comment/40636300
has text: thanks guys. i'll send the full codes.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25955443

http://stackoverflow.com/comment/40572888
score: 0
has text: My output is Last Sync: %s. Updated post to reflect where I am setting the string.
comment on: http://stackoverflow.com/q/25919088
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40785461
comment on: http://stackoverflow.com/a/26037241
type: Comment
has text: i don't know why this works - especially when i'm using the proper List<IComponent> / List<IcomponentHandle> on the method but works **WITHOUT** ... i'm confused and happy!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40583543
type: QuestionComment
comment on: http://stackoverflow.com/q/25924366
score: 0
has text: @Lashane well...i dont think that will be a feasible solution because if the app using this db connector is going to be a distributed app, there is no way you are going to keep track of every client computer that the app is going to run on!
type: Comment

http://stackoverflow.com/q/25927269
accepted answer: http://stackoverflow.com/a/25930873
type: Question
has title: The method createConnection() is undefined for the the class ConnectionFactory
answer count: 1
tagged with: jms
has answer: http://stackoverflow.com/a/25930873
has body: I have been trying to learn ActiveMQ and JMS. When I compile the following code I get the above exception. Although, I have attached the right jar files for JMS and ActiveMQ. Eclipse asks me to add a cast to the ConnectionFactory object when I try to create a connection (i.e. connectionFactory.createConnection()) using the ConnectionFactory object. The codes that I see everywhere on the internet are the same as I have written. import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; public class JMSProducer { public static void main(String[] args) { try { // Create a ConnectionFactory ConnectionFactory connectionFactory=new ActiveMQConnectionFactory("admin", "admin", ActiveMQConnection.DEFAULT_BROKER_URL); // Create a Connection Connection connection = connectionFactory.createConnection(); //Error seen in above line connection.start(); // Create a Session Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // Create the destination Destination destination = session.createQueue("testQ"); // Create a MessageProducer from the Session to the Queue MessageProducer producer = session.createProducer(destination); producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); // Create a messages TextMessage message = session.createTextMessage("Helloworld"); producer.send(message); session.close(); connection.close(); System.out.println("Message sent"); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } } }
type: AnsweredQuestion
tagged with: activemq-classic
score: 0
tagged with: java

http://stackoverflow.com/a/25882937
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25875551
type: Answer
answers question: http://stackoverflow.com/q/25875551
score: 2
has body: import java.util.Map; import org.jsoup.Connection; import org.jsoup.Connection.Method; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class Main { public static void main(String[] args) { try { //In this url you must login String loginUrl = "http://slateisb.nu.edu.pk/portal/xlogin"; //This is an example, it can be anything else String url = "http://slateisb.nu.edu.pk/portal"; //First login. Take the cookies Connection.Response res = Jsoup .connect(loginUrl) .data("eid", "i110013") .data("pw", "001") .referrer("http://www.google.com") .userAgent( "Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .method(Method.POST).timeout(0).execute(); Map&lt;String, String&gt; loginCookies = res.cookies(); //Now you can parse any page you want, as long as you pass the cookies Document doc = Jsoup .connect(url) .timeout(0) .cookies(loginCookies) .referrer("http://www.google.com") .userAgent( "Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .get(); System.out.println("Title : " + doc.title()); } catch (Exception e) { e.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/40529320
has comment: http://stackoverflow.com/comment/40524409
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25922801
has answer: http://stackoverflow.com/a/25922959
answer count: 4
has comment: http://stackoverflow.com/comment/40579553
has comment: http://stackoverflow.com/comment/40579514
has body: I'm trying to store a string and determine whether it is a uppercase/lowercase letter or number, If the character is a lower case letter, redisplay the character in upper case, if the character is a upper case letter, redisplay the character in lower case if the character is a digit, display it as an asterisk. I could make it with the numbers but if I include .toString().toLowerCase() or .toUpperCase() for the letters the program keeps looping. What should I do? public class CharacterArray { public static void main(String[] args) { StringBuilder input = new StringBuilder("800 Test St NY"); for (int i = 0; i &lt; input.length(); i++) { System.out.println(input.charAt(i)); if(Character.isDigit(input.charAt(i))){ input.replace(i,i+1,"*"); } else if(Character.isUpperCase(input.charAt(i))) { input.replace(i, i+1,input.toString().toLowerCase()); } else if(Character.isLowerCase(input.charAt(i))) { input.replace(i, i+1,input.toString().toUpperCase()); } System.out.println(input); } } }
has answer: http://stackoverflow.com/a/25922917
score: 0
tagged with: java
type: Question
tagged with: stringbuilder
has answer: http://stackoverflow.com/a/25922962
has title: Stringbuilder java
has answer: http://stackoverflow.com/a/25922872
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40579566

http://stackoverflow.com/comment/40497574
score: 2
comment on: http://stackoverflow.com/a/25877010
has text: you **can't** cast a `TextView` to a `Button`, however, you can add a `clicklistener` to a `TextView` (or to any `View`), or cast a `Button` to a `TextView` (`Button` extends `TextView`)
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25952991
answer count: 2
has comment: http://stackoverflow.com/comment/40631671
accepted answer: http://stackoverflow.com/a/25953016
has comment: http://stackoverflow.com/comment/40631864
has comment: http://stackoverflow.com/comment/40631795
favorite count: 0
has comment: http://stackoverflow.com/comment/40631850
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/40631717
has comment: http://stackoverflow.com/comment/40631773
has answer: http://stackoverflow.com/a/25953016
upvote count: 0
possible better answer: http://stackoverflow.com/a/25953022
downvote count: 1
has title: NullPointerException with a bank account in Java
type: AnsweredQuestion
has body: I get this Exception when I try to create a new customer in my bank account program: Exception in thread "main" java.lang.NullPointerException at bank.program.Customer.addAccount(Customer.java:18) at bank.program.BankProgram.main(BankProgram.java:24) Java Result: 1 What does it mean, and what do I need to change to get rid of it? Bank class: public class Bank { String bankName; private ArrayList&lt;Customer&gt; customers = new ArrayList&lt;Customer&gt;(); Bank(String bankName) { this.bankName = bankName; } public void addCustomer(Customer newCustomer) { customers.add(newCustomer); } } Account class: public abstract class Account { protected double balance = 0; protected String accountId; public Account() {} //Defaultkonstruktor public Account(double bal, String id) { //Konstruktor if (balance &gt;= 0) { balance = bal; } else { balance = 0; } accountId = id; } public abstract void deposit(double amount); public abstract void withdraw(double amount); public abstract double getBalance(); public abstract String getAccountId(); public void transfer(double amount, Account account) { account.deposit(amount); balance -= amount; } } SavingsAccount class: public class SavingsAccount extends Account { private double interest = 2.9; public SavingsAccount() { super(); } public SavingsAccount(double bal, String id) { super(bal, id); } @Override public void deposit(double amount) { } @Override public void withdraw(double amount) { } @Override public double getBalance() { } @Override public String getAccountId() { } } Customer class: public class Customer { private String firstName; private String lastName; private String number; private ArrayList&lt;Account&gt; accounts; Customer(String firstName, String lastName, String number) { this.firstName = firstName; this.lastName = lastName; this.number = number; } public void addAccount(SavingsAccount account) { accounts.add(account); } public ArrayList&lt;Account&gt; getAccounts() { return accounts; } } Bank program class: public class …
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40631873
type: Question
has answer: http://stackoverflow.com/a/25953022

http://stackoverflow.com/a/26021297
accepted answer of: http://stackoverflow.com/q/26021141
has body: The question is: Should there be a pom.xml right below projectName-war Simply put yes. You have already figured out the trick, and since you haven't provided a project descriptor aka pom.xml to maven, it won't be able to call the projectName-war a valid child module. There must absolutely be a pom.xml file under projectName-war, and it must have an artifact id that matches the one under the parent declaring the module, i.e. projectName-war
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26021141
upvote count: 8
type: Answer
score: 8

http://stackoverflow.com/comment/40693714
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25986568
type: QuestionComment
has text: I don't need a `BigDecimal` - a regular double is just fine for my purposes. Converting to a BigDecimal is just as cumbersome for me as converting to a string.

http://stackoverflow.com/comment/40589521
type: AnswerComment
comment on: http://stackoverflow.com/a/25928397
type: Comment
has text: So as long as I am not attempting to iterate through some bufferedImage array inside of the paintComponent(or the like) I should be fine to use the if statement to..let's say check a timer and then paint an oval at a random point that travels across the screen governed by a different method.
score: 0

http://stackoverflow.com/q/25948436
has comment: http://stackoverflow.com/comment/40642537
score: 0
has comment: http://stackoverflow.com/comment/40658054
has title: Foreign key is showing null while inserting into Child Table
tagged with: jpa
has comment: http://stackoverflow.com/comment/40644369
has comment: http://stackoverflow.com/comment/40664063
tagged with: one-to-many
type: UnansweredQuestion
tagged with: hibernate-mapping
has body: I was trying to insert each parent table primary key Id into child table as a foreign key.First the parent table will update then the relevant child. But when I tried it always showing null.But If I only instert master data the primary key is generating properly. I was using JPA @OneToMany relationship in parent and @ManyToOne in child.. My First class is...(Which is transaction master class) package com.org.pc.entity; import java.io.Serializable; import javax.persistence.*; import java.util.Date; import java.util.List; import java.util.Set; /** * The persistent class for the physical_allocation_master database table. * */ @Entity @Table(name="physical_allocation_master", schema="spc_cg") @NamedQuery(name="PhysicalAllocationMaster.findAll", query="SELECT p FROM PhysicalAllocationMaster p") public class PhysicalAllocationMaster implements Serializable { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name="BudgetUpload_GENERATOR",sequenceName="spc_cg.seq_budget_id",allocationSize=1,initialValue=1) @GeneratedValue(generator="BudgetUpload_GENERATOR",strategy=GenerationType.SEQUENCE) @Column(name="physical_allocation_m_id") private Integer physicalAllocationMId; @Column(name="allocation_entry_by") private String allocationEntryBy; @Temporal(TemporalType.DATE) @Column(name="date_of_entry") private Date dateOfEntry; @Column(name="is_approved") private Integer isApproved; @Column(name="location_id") private Integer locationId; @Column(name="location_type_id") private Integer locationTypeId; @Column(name="scheme_id") private Integer schemeId; @Column(name="year_id") private Integer yearId; //bi-directional many-to-one association to PhysicalAllocationDetail @OneToMany(mappedBy="physicalAllocationMaster", cascade={CascadeType.ALL}, fetch=FetchType.EAGER) private List&lt;PhysicalAllocationDetail&gt; physicalAllocationDetails; public PhysicalAllocationMaster() { } public Integer getPhysicalAllocationMId() { return this.physicalAllocationMId; } public vo…
answer count: 0
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/40749339
type: QuestionComment
has text: No you didn't understand, I said it will create 11 objects IF YOU FILL IT. When you do new String[10], you just allocate the space, but there is nothing in your array, so that is just 1 object.
score: 0
comment on: http://stackoverflow.com/q/26013921
type: Comment

http://stackoverflow.com/a/25959690
score: 2
accepted answer of: http://stackoverflow.com/q/25959662
answers question: http://stackoverflow.com/q/25959662
has body: Add all your elements to a Set: for (Customer c: new HashSet&lt;Customer&gt;(customers)) { From the linked Javadoc: A collection that contains no duplicate element
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40644526

http://stackoverflow.com/q/26029707
has comment: http://stackoverflow.com/comment/40778726
has comment: http://stackoverflow.com/comment/40780588
tagged with: storage
has comment: http://stackoverflow.com/comment/40779991
has comment: http://stackoverflow.com/comment/40917242
answer count: 0
has comment: http://stackoverflow.com/comment/40780362
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40814247
type: Question
has comment: http://stackoverflow.com/comment/40814193
tagged with: java
has comment: http://stackoverflow.com/comment/40815358
has comment: http://stackoverflow.com/comment/40812132
has comment: http://stackoverflow.com/comment/40811516
has comment: http://stackoverflow.com/comment/40815243
has comment: http://stackoverflow.com/comment/40816191
has body: When I click on write button than create text file in internal storage but when I read them than how to display text file item on spinner. In text file contain name, age, std item when I click read button that item display on a particular spinner. In text file item is(name,age,std) three spinner(name,age,std) when I click on read button all text file item(name,age,std) display on another activity of each spinner. problem is how to text file item display each spinner. Mainactivity.java btnWriteSDFile = (Button) findViewById(R.id.b2); btnWriteSDFile.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Jour=display.getText().toString(); FILENAME = display.getText().toString(); if (FILENAME.contentEquals("")){ FILENAME = "UNTITLED"; } // write on SD card file data in the text box try { FileOutputStream fOut = openFileOutput(FILENAME,MODE_APPEND); fOut.write(display.getText().toString().getBytes()); fOut.close(); Toast.makeText(getBaseContext(),"file saved", Toast.LENGTH_SHORT).show(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } btnReadSDFile = (Button) findViewById(R.id.b3); btnReadSDFile.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // write on SD card file data in the text box int id = v.getId(); for (int i = 0; i &lt; activities.length; i++) { if (id == getResources().getIdentifier("b" + i, "id", "com.example.pp")) { Intent intent = new Intent("com.example.pp." + activities[i]); startActivity(intent); } } } }); list.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list); sp1=(Spinner) findViewById(R.id.spinner1); sp2=(Spinner) findViewById(R.id.spinner2); sp3=(Spinner) findViewById(R.id.spinner3); entry = (TextView)findViewById(R.id.TextView123); getFilesnames(); } private void getFilesnames() { // TODO Auto-generated method stub String[] filenames=getApplicationContext().fileList(); List&lt;Stri…
has comment: http://stackoverflow.com/comment/40817687
has comment: http://stackoverflow.com/comment/40774701
tagged with: android-spinner
has comment: http://stackoverflow.com/comment/40816707
has comment: http://stackoverflow.com/comment/40815262
score: 0
has title: how to text file item display on multiple spinner from internal storage
tagged with: android

http://stackoverflow.com/comment/40689189
type: Comment
type: QuestionComment
has text: Does anything different happen if you step through it with a debugger?
comment on: http://stackoverflow.com/q/25983919
score: 0

http://stackoverflow.com/comment/127769445
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25903874
has text: Although it's worth to know the low-level basic arithmetics because they can be applied in every language, I think this is the "no hard coding" the asker's instructor required.
score: 0

http://stackoverflow.com/comment/40711306
has text: Yes. I was about to post my answer. Glad you found it on your own!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25996570
type: Comment

http://stackoverflow.com/q/25956457
favorite count: 0
upvote count: 9
possible better answer: http://stackoverflow.com/a/25956599
has body: I have a calendar object as below that represents 08 Aug 2014.It is a Friday. So myCal.get(Calendar.DAY_OF_WEEK) should be 6. But it gives 2. Why is that? java.util.GregorianCalendar[time=1410177767000,areFieldsSet=true,lenient=true,zone=Asia/Calcutta,firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2014,MONTH=8,WEEK_OF_YEAR=37,WEEK_OF_MONTH=2,DAY_OF_MONTH=8,DAY_OF_YEAR=251,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=5,HOUR_OF_DAY=17,MINUTE=32,SECOND=47,MILLISECOND=0,ZONE_OFFSET=19800000,DST_OFFSET=0]
has answer: http://stackoverflow.com/a/52134329
has answer: http://stackoverflow.com/a/52130644
has answer: http://stackoverflow.com/a/25956599
tagged with: calendar
answer count: 4
type: AnsweredQuestion
has title: Calendar giving wrong day of week
downvote count: 0
tagged with: java
tagged with: date
type: Question
score: 9
has answer: http://stackoverflow.com/a/25956466
accepted answer: http://stackoverflow.com/a/25956466
tagged with: dayofweek

http://stackoverflow.com/comment/40549141
type: Comment
has text: A JDBC driver must throw an exception when an `executeXXX(String)` method is called on a `PreparedStatement`. It is a bug in MySQL that it even tries to actually execute it (which then results in a syntax error).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25906250

http://stackoverflow.com/a/25988840
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25988765
has body: Hi I got answer for questions after long time spent in google. It is simple mistake I made. The new entity variable was not have @coloumn Annotations. So when I checked in table the datatype stored as tiny BLOB. SO I set @ Coloumn annotations and realtionship with specific coloumn.. @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "assigned_user") Its Working fine...
type: Answer
answers question: http://stackoverflow.com/q/25988765
score: 0

http://stackoverflow.com/comment/40500511
type: QuestionComment
comment on: http://stackoverflow.com/q/25878906
has text: There is such a thing as an "executable jar" which can be run as a single file. Any IDE offers the ability to export an executable jar (and usually asks you to specify if it is executable or just a library if I recall correctly).
score: 0
type: Comment

http://stackoverflow.com/q/26000619
has title: Java (ImageJ): Quick tif unstacking
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40788980
upvote count: 1
type: Question
tagged with: tiff
tagged with: imagej
downvote count: 0
score: 1
favorite count: 0
has body: I'm currently iterating through an array of Files where each file is a tif and, if needed, unstacking it to multiple tif files. However my current approach is taking a long time. Could someone please take a look and let me know if there's anything I could do to improve performance? for( File f : stacks ){ System.out.println( "unstacking \"" + f.getName() + "\"... " ); ImageStack is = IJ.openImage( f.getAbsolutePath() ).getImageStack(); int nSlices = is.getSize(); boolean isStack = true; for( int sliceIndex = 1 ; sliceIndex &lt;= nSlices ; sliceIndex++ ){ String sliceLabel = is.getSliceLabel( sliceIndex ); if( sliceLabel == null ){ isStack = false; break; } System.out.println( "\textracting slice \"" + sliceLabel + "\"" ); IJ.saveAs( new ImagePlus( sliceLabel, is.getProcessor( sliceIndex ) ), "TIF", dir.getAbsolutePath() + File.separator + sliceLabel ); } if( isStack ){ f.delete(); System.out.println( "\tdone!" ); }else System.out.println( "\tnot a stack!" ); } Thank you!

http://stackoverflow.com/comment/40636769
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25948029
has text: Is BLOGPOST the name of a table or column? Did you verify this exists in your database?

http://stackoverflow.com/comment/40498333
type: QuestionComment
has text: Take a look at this: http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html
type: Comment
score: 3
comment on: http://stackoverflow.com/q/25878180

http://stackoverflow.com/comment/49923285
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26021695
type: Comment
has text: I disagree. I think it's still a problem. Think of it this way - if you need to test the class using outputDir, do you really want to instantiate entire object tree -- ctxt, options and scratchDir? A great talk about this - https://www.youtube.com/watch?v=RlfLCWKxHJ0

http://stackoverflow.com/comment/40606706
type: AnswerComment
score: 0
type: Comment
has text: @aelgoa: And what about removing the manifest? Does that then include everything you need? I think the example you've copied from is unfortunate in its choice of Class-Path...
comment on: http://stackoverflow.com/a/25936604

http://stackoverflow.com/a/25898299
accepted answer of: http://stackoverflow.com/q/25897712
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25897712
type: Answer
has comment: http://stackoverflow.com/comment/40545945
upvote count: 1
score: 1
has body: You don't need an inner class. I can see the reason you're doing it is because you want access to the the DefaultListModel, but it's unnecessary. You JAXB model classes shouldn't have to know anything about any gui aspects. It just simply meant to model. That said, your design is a little off. You should instead just make Configuration its own class file. You don't need the constructor the Configuration class either. Just have a getter for the List, and populate it from the save() method. Something like: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "component" }) @XmlRootElement(name = "Configuration") public class Configuration { protected List<String> component; public List<String> getComponent() { if (component == null) { component = new ArrayList<String>(); } return this.component; } } Then when you actually want to do the marshalling, just create the Configuration class, and fill it with the list model elements. Configuration config = new Configuration(); List<String> list = config.getComponent(); Object[] partsList = partsListRight.toArray(); for (Object object : partsList){ list.add((String)object); } JAXBContext context = JAXBContext.newInstance( Configuration.class.getPackage().getName()); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(config, System.out); UPDATE Thanks for the reply; I tried using this and now I've got a new error. javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "com.cooksys.assessment" doesnt contain ObjectFactory.class or jaxb.index... Sorry, I'm used to using xjc where you have an ObjectFactory created for you. In your case, just create the JAXBContext the same way you were before, with Configuration.class, instead of Configuration.class.getPackage().getName(); JAXBContext context = JAXBContext.newInstance(Configuration.class); Test …

http://stackoverflow.com/comment/40657931
has text: Hazelcast is an in-memory Open Source data grid, you will need to use JDBC to connect to your database
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25966925

http://stackoverflow.com/comment/40734474
type: Comment
has text: Okay I think I understand...but problem is that Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)); didn't produce anything
type: AnswerComment
comment on: http://stackoverflow.com/a/26008952
score: 0

http://stackoverflow.com/q/26017122
tagged with: java
type: Question
answer count: 2
score: -2
has body: How far a manual tester can upgrade himself to learn automation testing(java, selenium webdriver, testng). which programming will be easy for stepping into scripting for beginners
possible better answer: http://stackoverflow.com/a/54974440
has title: Beginning automation testing from scratch
favorite count: 0
tagged with: testng
has answer: http://stackoverflow.com/a/26018061
accepted answer: http://stackoverflow.com/a/26018061
downvote count: 2
has answer: http://stackoverflow.com/a/54974440
tagged with: selenium-webdriver
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/40633586
has text: Right-click your project, go to properties, go to Java Compiler, choose version 1.8.
comment on: http://stackoverflow.com/q/25953958
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40553514
comment on: http://stackoverflow.com/a/25908916
score: 0
has text: is there any solution to execute one by one thread using synchronize method.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25922962
has comment: http://stackoverflow.com/comment/40580073
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/40583103
has body: You need to use Character#toUpperCase and Character#toLowerCase public static void main(String[] args){ StringBuilder input = new StringBuilder("800 Test St NY"); for (int i = 0; i &lt; input.length(); i++) { System.out.println(input.charAt(i)); if(Character.isDigit(input.charAt(i))){ input.replace(i,i+1,"*"); } else if(Character.isUpperCase(input.charAt(i))) { input.replace(i, i+1,Character.toString(Character.toLowerCase(input.charAt(i)))); } else if(Character.isLowerCase(input.charAt(i))) { input.replace(i, i+1,Character.toString(Character.toUpperCase(input.charAt(i)))); } System.out.println(input); } } prints (the output of above code:) 8 *00 Test St NY 0 **0 Test St NY 0 *** Test St NY *** Test St NY T *** test St NY e *** tEst St NY s *** tESt St NY t *** tEST St NY *** tEST St NY S *** tEST st NY t *** tEST sT NY *** tEST sT NY N *** tEST sT nY Y *** tEST sT ny
score: -1
has comment: http://stackoverflow.com/comment/40581247
has comment: http://stackoverflow.com/comment/40579807
has comment: http://stackoverflow.com/comment/40580311
type: Answer
answers question: http://stackoverflow.com/q/25922801
has comment: http://stackoverflow.com/comment/40582406

http://stackoverflow.com/comment/40689985
type: QuestionComment
has text: Fixed it...impStr.split should come after impStr.replace(). But the problem now is, LibreOffice Calc opens it correctly. But Excel complains that there is a problem with the file and removes some of the formatting I had done.
comment on: http://stackoverflow.com/q/25984330
score: 0
type: Comment

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/25948821
tags question: http://stackoverflow.com/q/25924515
tags question: http://stackoverflow.com/q/25900483
tags question: http://stackoverflow.com/q/25953533

http://stackoverflow.com/q/26015560
has answer: http://stackoverflow.com/a/26015740
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26015729
has answer: http://stackoverflow.com/a/26015729
score: 9
type: Question
upvote count: 9
has body: Is there a difference between @Path having value starting with "/" and without it I have tested both usage, all work properly. @Path("message") public class MessageServices { @PUT @Path("sendsms") @Consumes(MediaType.APPLICATION_JSON) @Produces({MediaType.APPLICATION_JSON}) public Response sendSms() { //.... } } @Path("/message") public class MessageServices { @PUT @Path("/sendsms") @Consumes(MediaType.APPLICATION_JSON) @Produces({MediaType.APPLICATION_JSON}) public Response sendSms() { //.... } }
accepted answer: http://stackoverflow.com/a/26015740
has title: Restful Path Usage with "/"
answer count: 2
tagged with: uri
downvote count: 0
favorite count: 0
tagged with: rest
tagged with: path

http://stackoverflow.com/q/26011376
has title: Java Thread Start-Stop-Start on same button click in Eclipse
tagged with: java
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40738487
has answer: http://stackoverflow.com/a/26011500
has answer: http://stackoverflow.com/a/26011479
has body: I am creating a simple java program with a GUI built with the help of window builder in eclipse. The GUI consists of just a button. My Aim :- On button click,start a thread that will print to the console numbers infinitely until it is stopped by clicking the same button again. Here is my implementation:- Runner.java (The thread Class) public class Runner extends Thread{ private volatile boolean running = true; private int i = 1; @Override public void run() { while(running) { System.out.println(i++ +"\n"); try { sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void shutdown() { running = false; } } MainGUI.java (The ui class) Runner runIT = new Runner(); final JButton btnNewButton = new JButton("Start Thread"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String buttonText = btnNewButton.getText(); if(buttonText.equals("Start Thread")) { btnNewButton.setText("Stop Thread"); runIT.start(); } else if(buttonText.equals("Stop Thread")) { btnNewButton.setText("Start Thread"); runIT.shutdown(); } } }); My Problem :- The thread starts and stops perfectly but just once. That is, I am able to start and stop the thread only once. When I try to restart the stopped thread it fails. I want the thread to continue printing number from the same value at which it stopped. Error :- Exception in thread "AWT-EventQueue-0" java.lang.IllegalThreadStateException at java.lang.Thread.start(Thread.java:705) at com.zakoi.java.thread.GUI.MainGUI$2.actionPerformed(MainGUI.java:62) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:2…
answer count: 4
has answer: http://stackoverflow.com/a/26011605
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/26011842

http://stackoverflow.com/a/33141567
type: Answer
score: 3
upvote count: 3
has body: I get the same issue while writing a Java application for reading from hdfs on hadoop 2.6. My solution is : Add hadoop-2.X/share/hadoop/hdfs/hadoop-hdfs-2.X.jar to your classpath.
answers question: http://stackoverflow.com/q/25971333
has comment: http://stackoverflow.com/comment/67412632
downvote count: 0

http://stackoverflow.com/comment/40743121
score: 0
type: AnswerComment
type: Comment
has text: @Marc you can't use `+`,`-` with `boolean`. make `produkt` `boolean` and use `&&(AND)` or `||(OR)`
comment on: http://stackoverflow.com/a/26014075

http://stackoverflow.com/comment/40729421
type: Comment
has text: Use a `CardLayout` instead. And for better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example).
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/26006123

http://stackoverflow.com/comment/40700444
score: 1
comment on: http://stackoverflow.com/q/25990222
has text: Sorry, I was in a bit of a hurry as I needed this for a my University project, basically I am building a search engine prototype and I need to tokenize each word in the data source which contains 10,000+ news articles. One of the tasks of filtering is to remove symbols like !,?,. which occur at the end of sentences as markers.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40549377
type: QuestionComment
comment on: http://stackoverflow.com/q/25906505
score: 0
has text: Is your service method `createTranslateMap` annotated with `@Transactional`?
type: Comment

http://stackoverflow.com/a/26013894
upvote count: 1
has comment: http://stackoverflow.com/comment/40743321
type: Answer
downvote count: 0
score: 1
has body: You have to change for (i = 0; i &lt;= answer.length(); i++) ; to for (i = 0; i &lt;answer.length(); i++) ; There is no matching for answer.charAt(answer.length()), Not only that You need to remove for(i = 0; i &lt;= answer.length(); i++); &lt;==remove ; Then your for loop should like this for (i = 0; i &lt; answer.length(); i++) { if (Character.isUpperCase(answer.charAt(i))) Upper++; if (Character.isLowerCase(answer.charAt(i))) Lower++; if (Character.isDigit(answer.charAt(i))) Digits++; if (i == ' ') // i is an index this should be if(answer.charAt(i)==' ') Space++; }
has comment: http://stackoverflow.com/comment/40742953
answers question: http://stackoverflow.com/q/26013840

http://stackoverflow.com/q/25949977
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25950763
tagged with: java
accepted answer: http://stackoverflow.com/a/25950088
has answer: http://stackoverflow.com/a/25950763
upvote count: 1
has body: I need to get the count of Unmatched character in two strings. for example string 1 "hari", string 2 "malar" Now i need to remove the duplicates from both string ['a' &amp; 'r'] are common in both strings so remove that, now string 1 contain "hi" string 2 contain "mla". Remaining count = 5 I tried this code, its working fine if duplicate / repeart is not available in same sting like here 'a' come twice in string 2 so my code is didn't work properly. for (int i = 0; i &lt; first.length; i++) { for (int j = 0; j &lt; second.length; j++) { if(first[i] == second[j]) { getstrings = new ArrayList&lt;String&gt;(); count=count+1; Log.d("Matches", "string char that matched "+ first[i] +"==" + second[j]); } } } int tot=(first.length + second.length) - count; here first &amp; second refers to char[] first = nameone.toCharArray(); char[] second = nametwo.toCharArray(); this code is working fine for String 1 "sri" string 2 "hari" here in a string character didn't repeat so this above code is working fine. Help me to solve this ?
type: Question
has answer: http://stackoverflow.com/a/25950055
answer count: 6
has answer: http://stackoverflow.com/a/25950169
has answer: http://stackoverflow.com/a/66897807
has title: How to get the count of unmatched character in two strings?
downvote count: 0
score: 1
tagged with: string
has answer: http://stackoverflow.com/a/25950088
favorite count: 0
has answer: http://stackoverflow.com/a/25950067
tagged with: android

http://stackoverflow.com/a/25936208
upvote count: 4
has comment: http://stackoverflow.com/comment/40603068
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40603509
accepted answer of: http://stackoverflow.com/q/25935915
type: Answer
answers question: http://stackoverflow.com/q/25935915
score: 4
has body: Probably I misunderstood your problem, but I would separate standard and custom painting public abstract class BasePanel extends JPanel { ... @Override protected void paintComponent(Graphics g) { super.paintComponent(g); provideCustomPainting(g); } protected void provideCustomPainting(Graphics g) { Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); this.standardDraw(drawObjects,g2); } } public class AspectRatioPanel extends BasePanel { protected void provideCustomPainting(Graphics g) { Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); // Get ViewPort Bounding Box to clip BoundingBox viewPortBoundingBox = this.getViewPortBoundingBox(); // Clip to viewport g2.setClip((int)viewPortBoundingBox.topLeft.getX(),(int)viewPortBoundingBox.topLeft.getY(),(int)viewPortBoundingBox.getWidth(),(int)viewPortBoundingBox.getHeight()); this.standardDraw(drawObjectsBuf,g2); } }

http://stackoverflow.com/q/26030579
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26030593
has comment: http://stackoverflow.com/comment/40774445
has body: Supposedly the user will enter their "ID #: 1203103" then after that it will automatically create a text file named 1203103.txt How can I do that? Here is my code. what will I change in my code? String id = scan.nextLine(); File file = new File(id.txt); FileWriter fileWrite = new FileWriter(file); BufferedWriter bufferedWriter = new BufferedWriter(fileWrite);
has title: Writing file name in java
favorite count: 0
answer count: 4
has answer: http://stackoverflow.com/a/26030625
type: UnansweredQuestion
downvote count: 2
tagged with: file
has comment: http://stackoverflow.com/comment/40774832
upvote count: 1
has answer: http://stackoverflow.com/a/26031528
type: Question
has answer: http://stackoverflow.com/a/26030600

http://stackoverflow.com/q/25955552
type: Question
possible better answer: http://stackoverflow.com/a/25955947
tagged with: libgdx
has answer: http://stackoverflow.com/a/25957082
accepted answer: http://stackoverflow.com/a/25957082
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25955947
has title: LibGDX development on many platforms
tagged with: android-2.2-froyo
has body: As a student in a software development class I have been assigned to be part of a group project. Naturally our 4 man group decided to make a game. I suggested LibGDX and got a team member to try it, however, when he tried to import the LibGDX project I created in Windows into eclipse on his linux computer it gave him the could not find sdk message. The build was trying to use the SDK path that I had specified in my own windows computer. Is it possible to have multiple members on different platforms develop with LibGDX. Please let me know if this is not possible, I have already invested multiple days learning how to develop with LibGDX, and hope that there is some way to develop with windows and linux.
type: AnsweredQuestion
tagged with: java
tagged with: cross-platform
linked to: http://stackoverflow.com/q/23983221

http://stackoverflow.com/comment/40521830
type: AnswerComment
comment on: http://stackoverflow.com/a/25890838
has text: it will give arr1[0]..etc values..but how to assign each single value to String array ...String[] a = {"this","is","a","very"} ??
score: 0
type: Comment

http://stackoverflow.com/comment/40757819
type: Comment
has text: **Incorrect** answer. See the [answer by Meno Hochschild](http://stackoverflow.com/a/26014153/642706) for details.
comment on: http://stackoverflow.com/a/26010019
score: 2
type: AnswerComment

http://stackoverflow.com/a/25941004
answers question: http://stackoverflow.com/q/25937051
has body: I have figured it out. I was trying to generate the class stubs from WSDL2Java (Axis 1.x). I had to download the Axis 1.3 version and point Tools (Axis 1.3) to the Axis 1.3 installation. I am able to generate code now.
accepted answer of: http://stackoverflow.com/q/25937051
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26020854
score: 0
has answer: http://stackoverflow.com/a/26020975
has answer: http://stackoverflow.com/a/26020895
has body: Ok so I am new to java and for some reason the else if is only executed when all 3 of the variables are below 0. How can I fix it so if one of them is less than 0 it does the error message? import javax.swing.JOptionPane; import java.util.*; import java.text.*; public class ChristianBondurant_3_05 { public static void main (String [] args) { //Declaring all needed variables at the top. double a, b, c; //declares the sides of the triangle" double perimeter; double s; double area; StringTokenizer st; String inputStr = new String(); DecimalFormat df = new DecimalFormat("#.0"); inputStr = JOptionPane.showInputDialog("Enter the sides of the triangle seperated by spaces: "); st = new StringTokenizer(inputStr); a = Double.parseDouble(st.nextToken());//Enter your A variable b = Double.parseDouble(st.nextToken());//Enter your B variable c = Double.parseDouble(st.nextToken());;//Enter your C variable //Making our variables equivlent to these equations. if (a &gt; 0 || b &gt; 0 || c &gt; 0){ perimeter = a + b + c; s = perimeter / 2; area = Math.sqrt(s * ( s - a ) * ( s - b ) * ( s - c )); JOptionPane.showMessageDialog(null, "The Sides of the Triangle are: " + + a + ", " + b + ", and " + c + "\n" + "The Perimeter is :" + perimeter + "\n" + "The area formatted to one decimal place: " + df.format(area) +"\n" + "The area unformatted: " + area + "\n"); } else if(a &lt; 0 || b &lt; 0 || c &lt;0) { JOptionPane.showMessageDialog(null,"Error! Please enter an integer."); } } } Sorry if this has been asked I tried searching for my question but I found nothing on it.
has answer: http://stackoverflow.com/a/26020911
accepted answer: http://stackoverflow.com/a/26020911
answer count: 4
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40755832
has title: How do I make an if statement not execute and go to the else if statement if one or more variables are less than 0?
has comment: http://stackoverflow.com/comment/40755773
type: Question
tagged with: if-statement
possible better answer: http://stackoverflow.com/a/26020895
has answer: http://stackoverflow.com/a/26020907

http://stackoverflow.com/a/25943997
has body: I think the problem is that the wildcard you are using tells the compiler, that entity is any ClientServerComparator, not necessarily related to T. However, you already know that entity is of type T (which you have defined by the type annotation where you instantiate entity). Also, you are checking whether entity is an instance of ClientServerComparator. I am assuming, that you always expect entity to be an instance of ClientServerComparator. If this is the case, then you can change the generic type of EntityTest to &lt;T extends ClientServerComparator&lt;T&gt;&gt; and get rid of the instanceof check and the type cast: public class EntityTest&lt;T extends ClientServerComparator&lt;T&gt;&gt; { public void testPutObject(Client client, T obj) { T entity = testGetObject(client); if (entity.compare(entity, obj)) { throw new UnExpectedStatusException(); } } } Now T is a ClientServerComparator&lt;T&gt;, hence you can call compare on entity.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40617734
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25943858

http://stackoverflow.com/a/25937890
has body: I believe Log4j's LevelMatchFilter allows you to do what you're after: def dailyRollingInfoFile = new DailyRollingFileAppender(...) dailyRollingInfoFile.addFilter(new org.apache.log4j.varia.LevelMatchFilter(levelToMatch:'INFO', acceptOnMatch: true)) dailyRollingInfoFile.addFilter(new org.apache.log4j.varia.DenyAllFilter()) The DenyAllFilter drops the messages that the LevelMatchFilter does not match (ie. everything other than level INFO)
downvote count: 0
has comment: http://stackoverflow.com/comment/40662351
score: 1
has comment: http://stackoverflow.com/comment/40922651
accepted answer of: http://stackoverflow.com/q/25935836
answers question: http://stackoverflow.com/q/25935836
has comment: http://stackoverflow.com/comment/40610105
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40662383
has comment: http://stackoverflow.com/comment/40611124
has comment: http://stackoverflow.com/comment/40610188
type: Answer

http://stackoverflow.com/a/25899080
answers question: http://stackoverflow.com/q/25898897
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40536297
has body: @deprecated is the right tag to use
type: Answer
downvote count: 2
has comment: http://stackoverflow.com/comment/40535973
upvote count: 0
score: -2
accepted answer of: http://stackoverflow.com/q/25898897

http://stackoverflow.com/q/25974865
tagged with: plugins
tagged with: java
tagged with: classpath
type: Question
score: 0
answer count: 1
has body: I have a java project and imported plug-in in my workspace and I'd like to add the project to plug-in's classpath. I know that it's possible by exporting the project to jar file and then importing it in plug-in's manifest, but when I make a change in project I have to export it again. Is there a way to add java project instead of jar file to the plug-in's classpath?
has answer: http://stackoverflow.com/a/25975416
tagged with: eclipse-rcp
has title: Add a java project into an rcp plugin's classpath
type: UnansweredQuestion

http://stackoverflow.com/a/73049916
has body: Trig ratios can be used for a more flexible gradient angle. Please note: It does not implement repeat, hence add more stops in the gradient object. private fun createGradient(width: Float, height: Float): LinearGradient { val mode = TileMode.CLAMP val angleInRadians = Math.toRadians(mAngle.toDouble()) val halfWidth = width / 2 val halfHeight = height / 2 val sinAngle = sin(angleInRadians) val cosAngle = cos(angleInRadians) val x0 = (halfWidth * (1 + sinAngle)).toFloat() val y0 = (halfHeight * (1 - cosAngle)).toFloat() val x1 = (halfWidth * (1 - sinAngle)).toFloat() val y1 = (halfHeight * (1 + cosAngle)).toFloat() return LinearGradient(x0, y0, x1, y1, mGradient, null, mode) }
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/133737114
answers question: http://stackoverflow.com/q/25934678
downvote count: 0

http://stackoverflow.com/q/25887554
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25889066
tagged with: ms-access
favorite count: 0
accepted answer: http://stackoverflow.com/a/25889066
upvote count: 2
has title: Jackcess equivalent of SQL WHERE clause with > ("strictly greater than") condition
has body: I want search all rows where value of Date columns > '2014/03/01'. How can do this? If there are no rows with Date value = '2014/03/01'`, how can I position the cursor without a full scan table? Table table = db.getTable("Facture"); IndexCursor cursor = CursorBuilder.createCursor(table.getIndex("DateIndex")); Date search_date = Date('2014/03/01'); for(Row row : cursor.newEntryIterable(search_date)) { ... }
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: select
type: Question
tagged with: where-clause
tagged with: jackcess

http://stackoverflow.com/a/25912806
answers question: http://stackoverflow.com/q/25912550
type: Answer
score: 0
has body: Look up the documentation of Integer.parseInt(String): The characters in the string must all be decimal digits.

http://stackoverflow.com/a/25963796
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25963734
has body: You can use a String Array to hold the cards and a Random object to select one. Example: String[] cards = {"one", "two", "three", "four", "five"}; // array Random random = new Random(); // random object int index = random.nextInt(cards.length); // assign the next random int with a maximum of the array length System.out.println(cards[index] + " was selected."); Don't forget to import this import java.util.Random;. That should help.
answers question: http://stackoverflow.com/q/25963734
score: 0

http://stackoverflow.com/comment/40827112
has text: No, because you set a new component only for the tab. And you set the listener on the new component a label for example.
type: Comment
comment on: http://stackoverflow.com/a/26049555
score: 0
type: AnswerComment

http://stackoverflow.com/q/25898897
favorite count: 0
has answer: http://stackoverflow.com/a/25899353
has title: Java anotation to warn eclipse for unused methods
has answer: http://stackoverflow.com/a/25899080
downvote count: 1
possible better answer: http://stackoverflow.com/a/25899353
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25899080
tagged with: java
score: -1
tagged with: eclipse
type: Question
answer count: 2
upvote count: 0
has body: Is there any Java Eclipse annotation, what inform me (in Eclipse Ctrl + Space thingy) like: "This method is there just because of extends and do nothing", and if its not how do I create it?
has comment: http://stackoverflow.com/comment/40536056

http://stackoverflow.com/q/25961555
has answer: http://stackoverflow.com/a/25961720
type: AnsweredQuestion
tagged with: database-connection
tagged with: java
has title: Where should I create a local db, and connect-disconnect from a database?
tagged with: mysql
type: Question
tagged with: database
score: 0
tagged with: sql
answer count: 1
accepted answer: http://stackoverflow.com/a/25961720
has body: in a college project I have a Java application, the main method do some stuff, then call a method that every 10 seconds: -connects to a local database, (localhost, username and password are known), -do some stuff with data from the tables -then disconnect. My questions are: 1- is it a bad idea connect and disconnect to the database everytime that this method runs? should I connect and disconnect in the main method and pass as an arguments the database handler?? 2- this projects runs in my pc becouse I have MySQL process (I'm using Xampp) running and becouse I know database name and table name. If i want this project be able to run everywhere (without making the other people create a database with same name and table in their local mysql) should I create the db or tables from my project? is that possible? Thank you!!

http://stackoverflow.com/a/25905959
accepted answer of: http://stackoverflow.com/q/25905901
has body: Generally, in java, marking the Object references as null is done to make it explicitly eligible for GC. If an object is unreachable, then it becomes eligible for GC, so, yes, you can mark it as null and let the GC do its work. The Object will become unreachable only when there is no reference pointing to it. example : class MyTest { @Override protected void finalize() throws Throwable { System.out.println("object is unreachable.."); } } // In some other class public static void main(String[] args) { MyTest o1 = new MyTest(); MyTest o2 = new MyTest(); System.gc(); o1 = null; System.gc(); System.out.println("hello"); } O/P: hello object is unreachable.. Here, you might have several thousand lines of code after "hello". You might want to make the GC's job easier by marking the object's references as null.
type: Answer
downvote count: 1
score: 1
upvote count: 2
answers question: http://stackoverflow.com/q/25905901
type: AcceptedAnswer

http://stackoverflow.com/comment/40643309
score: 1
type: AnswerComment
type: Comment
has text: It works, amazing!!!!! You really helped me out even to understand why it did not work. Thanks a lot!!
comment on: http://stackoverflow.com/a/25952166

http://stackoverflow.com/q/25914819
answer count: 1
has comment: http://stackoverflow.com/comment/40564127
has answer: http://stackoverflow.com/a/25922186
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40566384
has comment: http://stackoverflow.com/comment/40564259
has title: Copy file from local
type: Question
has body: I'm trying to copy a file from local to hdfs in these three ways: FileSystem fs = FileSystem.get(context.getConfiguration()); LocalFileSystem lfs = fs.getLocal(context.getConfiguration()); lfs.copyFromLocalFile(new Path("file:///pathToFile/file.properties"), new Path("/destPath/")); fs.copyFromLocalFile(new Path("file:///pathToFile/file.properties"), new Path("/destPath/")); fs.copyFromLocalFile(new Path("file:///pathToFile/file.properties"), new Path("/destPath/")); But none of them are working. I always get a FileNotFound exception for /pathToFile/file.properties, but the file exists on that path on Unix and has read and write permissions for the user that runs the Map/Reduce. Any ideas what I'm missing here? Job is running with Ozzie CDH4 Thank you very much for your help. opalo
tagged with: java
tagged with: hadoop
score: 0
has comment: http://stackoverflow.com/comment/40564682

numbers
tags question: http://stackoverflow.com/q/25926465
tags question: http://stackoverflow.com/q/25882094
tags question: http://stackoverflow.com/q/25967475
type: Tag
tag name: numbers

http://stackoverflow.com/comment/40760735
has text: Shared workspace doesn't work for me, since changes can be made to the work space after the initial build... This has some unforeseen side effects.
type: Comment
comment on: http://stackoverflow.com/a/25963912
score: 0
type: AnswerComment

intellij-idea
tags question: http://stackoverflow.com/q/25915086
tags question: http://stackoverflow.com/q/25888023
tags question: http://stackoverflow.com/q/25922749
tags question: http://stackoverflow.com/q/25945091
tags question: http://stackoverflow.com/q/25929544
tags question: http://stackoverflow.com/q/25902132
tags question: http://stackoverflow.com/q/25943185
tags question: http://stackoverflow.com/q/25888763
tags question: http://stackoverflow.com/q/25959449
tags question: http://stackoverflow.com/q/25964298
type: Tag
tags question: http://stackoverflow.com/q/26031187
tags question: http://stackoverflow.com/q/26002264
tag name: intellij-idea
tags question: http://stackoverflow.com/q/25948218
tags question: http://stackoverflow.com/q/25875881
tags question: http://stackoverflow.com/q/26033241
tags question: http://stackoverflow.com/q/25880632
tags question: http://stackoverflow.com/q/25936365
tags question: http://stackoverflow.com/q/25913290
tags question: http://stackoverflow.com/q/25967846
tags question: http://stackoverflow.com/q/26012735
tags question: http://stackoverflow.com/q/25924108
tags question: http://stackoverflow.com/q/25949804
tags question: http://stackoverflow.com/q/26003776
tags question: http://stackoverflow.com/q/25947576
tags question: http://stackoverflow.com/q/25979359
tags question: http://stackoverflow.com/q/25990014
tags question: http://stackoverflow.com/q/25881263
tags question: http://stackoverflow.com/q/25906990
tags question: http://stackoverflow.com/q/25877127
tags question: http://stackoverflow.com/q/25908247
tags question: http://stackoverflow.com/q/25978559
tags question: http://stackoverflow.com/q/25878045
tags question: http://stackoverflow.com/q/25951117
tags question: http://stackoverflow.com/q/25889377
tags question: http://stackoverflow.com/q/25932536
tags question: http://stackoverflow.com/q/25914657

http://stackoverflow.com/q/25984330
tagged with: cell
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40690713
has comment: http://stackoverflow.com/comment/40690559
has comment: http://stackoverflow.com/comment/40689842
tagged with: apache-poi
answer count: 0
downvote count: 0
type: UnansweredQuestion
has title: issues with multi-line cell wrap in excel using Apache POI
has comment: http://stackoverflow.com/comment/40689799
has body: Am trying to create a multi-line cell in Excel through Apache POI. There are 10 columns. Here is my code. str[i] contains 10 values for 10 columns. for(int i=0; i &lt; 10; i++) { if(i == 3 || i == 4 || i == 5 || i == 6) { String impStr = str[i]; impStr = impStr.replace("\"", ""); impStr = impStr.replace("||", "\n"); String s[] = impStr.split("\n"); Cell cell = currentRow.createCell(i); CellStyle cs = workBook.createCellStyle(); cs.setWrapText(true); cell.setCellStyle(cs); cell.setCellValue(impStr); currentRow.setHeightInPoints(s.length * sheet.getDefaultRowHeightInPoints()); } else { String tempStr = str[i]; tempStr = tempStr.replace("\"", ""); currentRow.createCell(i).setCellValue(str[i]); } } I columns 3, 4, 5 and 6 have values delimited by || . The 6th column is important to me as it contains links separated by ||. I have tried to replace || with "\n" and "\r\n". I am not getting a wrapped cell. Instead I get only the last link. I am running this on a Windows 7 machine.
tagged with: excel
type: Question
has comment: http://stackoverflow.com/comment/40689985
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/74088911

http://stackoverflow.com/comment/40618991
type: QuestionComment
comment on: http://stackoverflow.com/q/25944782
has text: can you give examples of allowed input?
type: Comment
score: 1

http://stackoverflow.com/a/25933916
has body: Pattern p = Pattern.compile(".*\\\"(.*)\\\".*"); Matcher m = p.matcher(yourString); while (m.find()) { System.out.println(m.group(1)); } Explaination: .* - anything \\\" - quote (escaped) (.*) - anything (captured) \\\" - another quote .* - anything Read more about regex here
score: 0
has comment: http://stackoverflow.com/comment/40598832
type: Answer
answers question: http://stackoverflow.com/q/25933793

http://stackoverflow.com/comment/40632413
comment on: http://stackoverflow.com/a/25953390
type: AnswerComment
type: Comment
has text: Also you can use the convenient `Body#applyForceToCenter()` method.
score: 0

http://stackoverflow.com/comment/40735367
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25994772
has text: Yes i have all the jars required to read excel, here im not able to read only the password protected one. And also i have imported `import org.apache.poi.poifs.crypt.Decryptor;` it make sures the jar is present otherwise i wud have got compilation error
score: 0

http://stackoverflow.com/comment/40583938
comment on: http://stackoverflow.com/q/25925307
type: Comment
type: QuestionComment
has text: That's not an inner class! Inner classes should be inside the parent class - your `CustomButton` class is outside.
score: 0

http://stackoverflow.com/a/33676148
has body: You can instantiate an array of String like: String[] commands = new String[]{ "pickup", "drop", "help", "view", "quit" }; If you want to use a class for the game commands, better use an enumeration like: public enum Command { DROP, HELP, PICKUP, QUIT, VIEW }
score: 0
answers question: http://stackoverflow.com/q/25900547
type: Answer

http://stackoverflow.com/comment/40757508
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26018985
has text: If you have `String path = "box"` and `String number = "21"`, how you decide that `cell3` (and not cell1 or cell4?) value should be set. Also, you say you "want to set path to cell3", but you then do `cell3.setCellValue("21");`, which is setting cell3 to the same value as of `number`... Unclear!

http://stackoverflow.com/a/25880969
answers question: http://stackoverflow.com/q/25880932
has comment: http://stackoverflow.com/comment/40504033
accepted answer of: http://stackoverflow.com/q/25880932
has comment: http://stackoverflow.com/comment/40503696
upvote count: 3
has comment: http://stackoverflow.com/comment/40503418
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40503397
has body: public static void main(String[] args) // ^^^^^^^^^^^^^ When you run your program with something like: java progname arg1 arg2 the arguments appear in the string array handed to main(). You just extract them from there and do what you need. The following small (but complete) program shows this in action. It will echo back your arguments, one per line: public class Test { public static void main(String[] args) { for (int i = 0; i &lt; args.length; i++) System.out.println (args[i]); } } That's to get the commands as arguments to the program. If, instead, you want to still have the commands in a file and just supply the file name to the program, you simply need to change your scanner to use a file based reader rather than System.in. The following program accepts a file name argument then echos it to the screen: import java.io.FileInputStream; import java.util.Scanner; public class Test { public static void main(String[] args) { try { Scanner sc = new Scanner (new FileInputStream(args[0])); while (sc.hasNextLine()) System.out.println (sc.nextLine()); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } } You can even make it selectable, like UNIX filter programs using - to indicate standard input. If you want to use a file if provided but revert to standard input if not, you can do something like: Scanner sc; if (args.length &gt; 0) sc = new Scanner (new FileInputStream(args[0])); else sc = new Scanner (System.in); // Now just use scanner as before
score: 3
type: Answer

http://stackoverflow.com/q/25986323
accepted answer: http://stackoverflow.com/a/26028668
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26028668
favorite count: 0
has comment: http://stackoverflow.com/comment/40693260
has title: java help for converting temperture
has comment: http://stackoverflow.com/comment/40693258
upvote count: 0
downvote count: 5
has answer: http://stackoverflow.com/a/25986350
type: AnsweredQuestion
has body: *so if any one can help i am not sure whats wrong i think i need a while state meant it keeps giving me an error on the else statement * import java.util.*; //for class Scanner public class Tempconversion { public static void main(String[] args){ Scanner reader = new Scanner(System.in); double F = 0; double C = 0; int ConvertFer = 0; int ConvertCel = 1; int Done = 3; System.out.println("Welcome to the Temperature Converter!\n" + "Enter 0 to convert F --&gt; C and 1 to convert from C --&gt; F.\n" + "Enter 3 when done"); if (ConvertFer == 0) System.out.println("Welcome to the F --&gt; C Converter\n"+ "Enter Values to convert:"); C = reader.nextDouble(); F = ((F - 32)*5)/9; System.out.println(F + "F = " + C + "C."); else System.out.println("Welcome to the C --&gt; Fconverter\n"+ "Enter Values to convert:"); F = reader.nextdouble(); C = ((C * 90)/5))+32; System.out.println(C + "C =" + F +"F."); } }
score: -5
possible better answer: http://stackoverflow.com/a/25986350
tagged with: java

http://stackoverflow.com/comment/40610496
comment on: http://stackoverflow.com/a/25926772
type: AnswerComment
has text: @UwePlonus I believe this would be a sufficient answer since I did answer the question .Unfortuantely I can't explain what the difference is between the two. I actually found the fix by trial and error. There is no documentation I could find about this. If anybody could direct me to LWJGL documentation(I don't mean the javadoc, I mean actually documentation explaining stuff) I would be grateful
score: 0
type: Comment

http://stackoverflow.com/a/26006556
downvote count: 0
answers question: http://stackoverflow.com/q/26006543
type: Answer
score: 3
upvote count: 3
has body: You almost get it, just change where you position your ! like this: while (!(string.equals("y") || string.equals("n")))

http://stackoverflow.com/q/25902966
has title: what is the difference in Java 8 Stream.parallel and Scala trait Parallelizable.par
has body: Currently, I only know both Java 8 and Scala support parallel operation on the collection, I wrote several examples to play with it, but I am not sure what is the difference of it in term of performance, implementation technique and so on. When I search it, I didnt get sufficient materials about it Can someone share some experience about it ?
score: 0
answer count: 1
tagged with: scala
type: UnansweredQuestion
tagged with: parallel-processing
has answer: http://stackoverflow.com/a/29245678
tagged with: java
type: Question

http://stackoverflow.com/a/26033550
score: 1
upvote count: 1
has body: This quesiton is probably what you are looking for : How do I change JPanel inside a JFrame on the fly? However I would use a CardLayout in your case. Adding/Removing panels from a frame is more complicated than it seems.
answers question: http://stackoverflow.com/q/26033330
downvote count: 0
type: Answer

http://stackoverflow.com/q/25900547
tagged with: arrays
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40538591
has answer: http://stackoverflow.com/a/25900586
answer count: 4
has answer: http://stackoverflow.com/a/25901928
has body: I am not sure how to instantiate this array. I need to instantiate it with "pickup", "drop", "help", "view", "quit" private static Command[] gameCommands; //declared in class gameCommands = new Command[]{}; //I have no idea how to do this It needs to be done something like that. I have a constructor in another called called Command that has a setCommandName and getCommandName. I'm sure this is fairly simple I'm just having troubles thinking of it.
type: Question
has answer: http://stackoverflow.com/a/25900720
score: 0
tagged with: java
has title: Instantiate array of game commands in Java
tagged with: instantiation
has answer: http://stackoverflow.com/a/33676148

http://stackoverflow.com/a/25925818
has body: Form100DIV_V100 is not defined in your schema as a top level element, only as a type. You can simply just wrap the xs:complexType in a xs:element <xs:element name="Form100DIV_V100"> <xs:complexType> <xs:complexContent> <xs:extension base="AbstractForm100"> <xs:sequence> <xs:element name="AMOUNT" type="AmountType" minOccurs="0" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> In your xml instance, <Form100DIV_V100> is not terminated correctly. You are terminating it with </Tax1099Div_V100>. <Form100DIV_V100 xmlns="http://example.org/types/2003/04"> 100.00 </Form100DIV_V100> Given you have AbstractForm100 and AmountType types correctly defined and the rest of your -----s are correct, the above fixes should validate. Also, compiling with xjc should give you a Form100DIVV100 defined with a necessary @XmlRootElement annotation for your class @XmlRootElement(name = "Form100DIV_V100") public class Form100DIVV100 extends AbstractForm100 { Though it doesn't look like
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25924474
answers question: http://stackoverflow.com/q/25924474
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/25999997
upvote count: 3
answers question: http://stackoverflow.com/q/25999966
has body: Your code works fine. The only problem is that your second number (9876543210) is out of the int range, but you are using an int literal. To use a long literal, you can append an L to the end of the number: 9876543210L Here is a more complete example: public class Test { public static void main(String[] args){ for (long l = 1023456789L; l &lt;= 9876543210L; l++){ System.out.println(l); } } }
score: 3
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40739141
type: Comment
comment on: http://stackoverflow.com/a/26011661
score: 0
type: AnswerComment
has text: I completely understood it, however using your code did not seem to work. Pressing the button to open this code, just did nothing. no error, but no Jframe was shown.

http://stackoverflow.com/comment/47471499
type: AnswerComment
type: Comment
has text: http://developer.android.com/reference/android/media/ToneGenerator.html#TONE_SUP_INTERCEPT
comment on: http://stackoverflow.com/a/25882274
score: 0

parsing
tags question: http://stackoverflow.com/q/26018684
tags question: http://stackoverflow.com/q/26030534
tags question: http://stackoverflow.com/q/25885513
tags question: http://stackoverflow.com/q/26003171
tags question: http://stackoverflow.com/q/25885186
tags question: http://stackoverflow.com/q/25929112
tags question: http://stackoverflow.com/q/25938601
tag name: parsing
tags question: http://stackoverflow.com/q/26034097
tags question: http://stackoverflow.com/q/25941989
tags question: http://stackoverflow.com/q/25939514
tags question: http://stackoverflow.com/q/25889403
tags question: http://stackoverflow.com/q/25930347
tags question: http://stackoverflow.com/q/25977293
tags question: http://stackoverflow.com/q/25897666
tags question: http://stackoverflow.com/q/25936617
tags question: http://stackoverflow.com/q/25965484
tags question: http://stackoverflow.com/q/25884797
tags question: http://stackoverflow.com/q/26012660
tags question: http://stackoverflow.com/q/25990839
tags question: http://stackoverflow.com/q/25925198
type: Tag
tags question: http://stackoverflow.com/q/25904927
tags question: http://stackoverflow.com/q/25877821
tags question: http://stackoverflow.com/q/26033737
tags question: http://stackoverflow.com/q/25926507
tags question: http://stackoverflow.com/q/25924943
tags question: http://stackoverflow.com/q/25885350
tags question: http://stackoverflow.com/q/25939906

http://stackoverflow.com/q/26009086
answer count: 3
downvote count: 3
has title: Why the below code is not working (StringBuffer.toString !=null)
has answer: http://stackoverflow.com/a/26009485
accepted answer: http://stackoverflow.com/a/26009485
has comment: http://stackoverflow.com/comment/40735673
favorite count: 0
has answer: http://stackoverflow.com/a/26009139
has comment: http://stackoverflow.com/comment/40735331
has comment: http://stackoverflow.com/comment/40734727
has comment: http://stackoverflow.com/comment/40739183
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26009387
has comment: http://stackoverflow.com/comment/68735118
tagged with: java
has body: I am new to String World , I have coded as like below, StringBuffer buffer=new StringBuffer(); String addressLineOne=null; buffer.append(addreeLineOne); if(buffer.toString!=null) { system.out.println("Not NULL"); } Result:Not Null; (buffer.toString!=null)==true Eventhough I have append null to buffer ,I am not able to identify it by having NUll check, Code printing Not Null Why it so?
has comment: http://stackoverflow.com/comment/40734729
type: Question
has comment: http://stackoverflow.com/comment/40737313
tagged with: stringbuffer
score: -1
has comment: http://stackoverflow.com/comment/40736456
has comment: http://stackoverflow.com/comment/40734969
upvote count: 2
has answer: http://stackoverflow.com/a/26009387

http://stackoverflow.com/q/25893886
possible better answer: http://stackoverflow.com/a/25898096
downvote count: 0
score: 1
tagged with: hibernate-criteria
has body: I have two tables: A (x, y, z, date1, date2) B (t, date1, date2) I want to execute a query like this: SELECT A.x, A.y, A.z, A.date1 FROM A, B WHERE A.date1 &lt; B.date1 AND (A.date2 is null or A.date2 &lt;= B.date2 ) ORDER BY A.x DESC; How can I do that using Hibernate Criteria?
type: AnsweredQuestion
tagged with: criteria
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25899845
accepted answer: http://stackoverflow.com/a/25899845
type: Question
has title: Hibernate Criteria Query without Relationship Between Entities
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25898096
favorite count: 0

http://stackoverflow.com/comment/40583611
has text: Whoops you said no loop
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25925154

http://stackoverflow.com/comment/40654946
has text: See my answer for a working example.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25963720
score: 0

http://stackoverflow.com/comment/40612396
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25939551
type: Comment
has text: ah, sadly I don't need to run that to know the output, as I've messed around with that before. however, thanks for the answer

http://stackoverflow.com/a/25910034
has comment: http://stackoverflow.com/comment/40559235
upvote count: 0
has body: As opposed above - where do you add your key listener??? public class BetaTest { public static void main (String[] args){ new BetaTest().startUp(); } private void startUp() { final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); frame.setVisible(true); final KeyAdapter ka = new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { super.keyPressed(e); System.out.println("key pressed"); } }; frame.addKeyListener(ka); Runnable r = new Runnable() { @Override public void run() { try { Thread.sleep(1000); KeyEvent ke = new KeyEvent(frame, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_A, 'a'); ka.keyPressed(ke); } catch (InterruptedException e) { e.printStackTrace(); } } }; Thread t = new Thread(r); t.setDaemon(true); t.start(); } } and output is suprise key pressed
answers question: http://stackoverflow.com/q/25909039
type: Answer
has comment: http://stackoverflow.com/comment/40558848
has comment: http://stackoverflow.com/comment/40558207
has comment: http://stackoverflow.com/comment/40558670
downvote count: 1
score: -1

http://stackoverflow.com/comment/40587562
type: AnswerComment
score: 0
has text: Ok, found it. It seems log4j 2.x is significantly different from log4j 1.x. I got rid of the 2.x jars and put a 1.4 jar. It's working now. Thanks.
type: Comment
comment on: http://stackoverflow.com/a/25926989

http://stackoverflow.com/comment/49590035
type: QuestionComment
has text: I'm voting to close this question as off-topic because **it is about licensing or legal issues**, not programming or software development. [See here](http://meta.stackoverflow.com/a/274964/1402846) for details, and the [help/on-topic] for more.
comment on: http://stackoverflow.com/q/25888240
score: 4
type: Comment

http://stackoverflow.com/comment/40504950
type: QuestionComment
comment on: http://stackoverflow.com/q/25880952
has text: Sweet. Not a problem... I think that would be your best bet as I never heard about a post deployment "event/listener" feature for Tomcat and/or JBoss. And I use those quite a bit.
score: 0
type: Comment

http://stackoverflow.com/q/25998735
has body: Hello my fellow stackoverflows, I am writing an application where I implemented an Activity that handles share-intents. So far it works fine but during testing I have got a problem with Quickoffice (Android 4.4, KitKat), because it returns an URI from which I can´t get the filename from. I also tried sharing with other apps like Dropbox and it works there. The exact URI I get from the Qickoffice app: content://com.quickoffice.android.quickcommon.FileContentProvider/5cmeDeeatcdv8IFyu-bEr2w1jSHrvPmCzXGb_VvZulMBErE5Tmfd_5P5kckE68LaEYDVSp3q5r19%0A4sOkpYCEM_VqK6Y%3D%0A This was the code I used first: public String getRealPathFromURI(Uri contentUri) { Cursor cursor = null; try { String[] proj = {MediaStore.Images.Media.DATA}; // = "_data" ContentResolver cr = getContentResolver(); cursor = cr.query(contentUri, proj, null, null, null); // &lt;--EXCEPTION int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } catch (Exception exception) { Log.d("clixend", "Exception: " + exception); Toast.makeText(this, "Exception: " + exception, Toast.LENGTH_LONG).show(); } finally { if (cursor != null) { cursor.close(); } } return null; } Where I received following error: 09-23 16:54:17.664 32331-32341/? E/DatabaseUtils﹕ Writing exception to parcel java.lang.UnsupportedOperationException: Unsupported column: _data at com.google.android.apps.docs.quickoffice.FileContentProvider.query(FileContentProvider.java:78) at android.content.ContentProvider.query(ContentProvider.java:857) at android.content.ContentProvider$Transport.query(ContentProvider.java:200) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112) at android.os.Binder.execTransact(Binder.java:404) at dalvik.system.NativeStart.run(Native Method) After some research I figured out that Android 4.4 Kitkat introduces SAF (Storage Access Framework) which manages data different, so I tried the following Code from https://d…
tagged with: java
score: 4
type: Question
has answer: http://stackoverflow.com/a/26000680
accepted answer: http://stackoverflow.com/a/26000680
answer count: 1
has comment: http://stackoverflow.com/comment/40715776
tagged with: storage-access-framework
favorite count: 0
tagged with: android
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/40716596
has title: Extracting Filenames from SAF content URIs
type: AnsweredQuestion

http://stackoverflow.com/a/26010612
has comment: http://stackoverflow.com/comment/40737429
has comment: http://stackoverflow.com/comment/40737512
has body: String is a final class every time you user "+" and "=" new object will be created. For Variable assignments, if value already exists in pool then reference will be returned along with Object.
score: 0
has comment: http://stackoverflow.com/comment/40737054
type: Answer
answers question: http://stackoverflow.com/q/26010216
has comment: http://stackoverflow.com/comment/40737551

http://stackoverflow.com/a/26010798
has comment: http://stackoverflow.com/comment/40737845
has body: You should write a different List in the Background and then replace the old one with the update, when the Task is done. Synchronize the access (that is the complete drawing loop) while updating the view and replacing the list so they cannot interfere.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40737385
has comment: http://stackoverflow.com/comment/40737462
answers question: http://stackoverflow.com/q/26010312
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/26010312
upvote count: 1

http://stackoverflow.com/a/25990349
has comment: http://stackoverflow.com/comment/40700668
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Your code references num[5] , however you create an array of 5 values, which will be num[0] to num[4]. So you go out of bounds on your array. One common way to find the biggest element is to sort your array, and then picking the first (or last) item in that sorted array. Java also has way of doing this with Collections.max , you can simply do: int biggest = Collections.max(Arrays.asList(num)) However, if you want to do it yourself, a much better way than your current approach is to loop over your array and find the biggest value like so: public static int GetTheBiggestNum(int[] num) { if (num.length == 0) { throw new IllegalArgumentException("Array cannot empty") } int biggest = num[0]; for (int i = 1; i &lt; num.length; i++) { if (num[i] &gt; biggest) biggest = num[i]; } return biggest; }
accepted answer of: http://stackoverflow.com/q/25990229
upvote count: 1
answers question: http://stackoverflow.com/q/25990229
score: 1

http://stackoverflow.com/a/25949069
score: 0
has body: Its easy.What i woud do- Put listener onto JLabel, take text on event that you pick.Copy text from the JLabel value into Clipboard, Now you have text that you can manipulate. Drag effect.=Use (with combination of the previous listener) JNativeHook lib to get GLOBAL EVENTS of java application and outside. Listen for dragging(Do on your own its easy) , on mouse release onto your pdf input text. You might have to simulate mouse click(right after release) to select field (via robot class) to actualy SELECT THAT FIELD,so you can input text. Input text part=Use robot class to insert string char by char. This will work well.I dont have any other idea atm that woud be this easy to implement. You can also (fool user) with effect of floating text etc if you put transparent window over the top and check mouse location on screen.
type: Answer
answers question: http://stackoverflow.com/q/25946545

http://stackoverflow.com/comment/40710582
has text: Is there a specific reason you don't want to pass `null`? A null check in your view should be a special case, and a completely different meaning from if your dataSource were to possibly return an empty list.
score: 0
comment on: http://stackoverflow.com/q/25996289
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40637149
type: AnswerComment
has text: @johnny, I would not like to maintain your code. You don't understand the basic concept of min/max as range bounds. You can't set the value unless you know the range bounds. There are other examples in the JDK, for example a scrollbar. Once again you can't set the scrollbar to a value greater than the maximum value. It just does not make sense and the code prevents it. Or how about a JSpinner. Again the value must always be in the range of the spinner. I've done my best to explain a basic concept and am not about to spend any more time on the topic.
comment on: http://stackoverflow.com/a/25955293
type: Comment
score: 0

http://stackoverflow.com/comment/40566034
type: Comment
has text: As @Martin comments this only will work for characters and not for sequences, but the list of all possible characters for a line break is one of the things I was looking for, thank you!!
type: AnswerComment
comment on: http://stackoverflow.com/a/25915115
score: 0

http://stackoverflow.com/comment/40639688
comment on: http://stackoverflow.com/q/25955683
type: QuestionComment
score: 0
has text: @Ogen Yes. But all sequences will be "equally 50/50", which is what you asked about.
type: Comment

http://stackoverflow.com/comment/40746224
type: AnswerComment
type: Comment
has text: @ChrisK That's what I'm asking; if there is a way to do that. If there is a way, then yes. Calling it in the context of the `Base` class, it could not conceivably know about the child class. But again, it wouldn't matter, because what we are saying is "given that both of these are `Base` objects, are they equal in terms of being `Base` objects". It's like having a class `Child` with a field `firstName`. The scenario would be, "Comparing these two objects, as instances of `Child`, do they share the same first name. If yes, than as far as I'm aware, they are equal. They are both named "Johnny""
comment on: http://stackoverflow.com/a/25992853
score: 0

http://stackoverflow.com/a/25902382
has comment: http://stackoverflow.com/comment/40582131
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/51238047
has comment: http://stackoverflow.com/comment/40558709
has body: "the event DestroyWindow is sent to the hosted window" sounds like it's java runtime doing cleanup (and not respecting save set). From "connection close" section 10 of x11 protocol: When a client's resources are destroyed, for each window in the client's save-set, if the window is an inferior of a window created by the client, the save-set window is reparented to the closest ancestor such that the save-set window is not an inferior of a window created by the client. If the save-set window is unmapped, a MapWindow request is performed on it (even if it was not an inferior of a window created by the client). The reparenting leaves unchanged the absolute coordinates (with respect to the root window) of the upper-left outer corner of the save-set window. After save-set processing, all windows created by the client are destroyed. For each nonwindow resource created by the client, the appropriate Free request is performed. All colors and colormap entries allocated by the client are freed. Can you post xmon (or xtruss or xtrace) communication dump few seconds before and after crash? Also, for simple operations like "reparent this window and add to save set" I'd try to use low level client like https://github.com/xderoche/J11 and avoid all this "extra thread + ffi call to .so (is that xlib?)"
accepted answer of: http://stackoverflow.com/q/25890486
downvote count: 0
answers question: http://stackoverflow.com/q/25890486
type: Answer
score: 2

http://stackoverflow.com/a/25976915
answers question: http://stackoverflow.com/q/25976856
has comment: http://stackoverflow.com/comment/40695509
score: 0
has body: Use the JUnitCore class to do it : http://junit.sourceforge.net/javadoc/org/junit/runner/JUnitCore.html JUnitCore junit = new JUnitCore(); Result result = junit.runClasses(testClasses); // testClasses is the array of test classes to be executed
has comment: http://stackoverflow.com/comment/40694997
type: Answer

http://stackoverflow.com/q/25949598
has comment: http://stackoverflow.com/comment/40626164
has comment: http://stackoverflow.com/comment/40626005
tagged with: java
has body: i am beginner to servlet ... i want to pass a simple parameter from html to servlet but an error "HTTP Status 404 - Not Found" applears .. here it is my code ... web.xml <?xml version="1.0" encoding="UTF-8"?> NewClass NewClass NewClass /NewClass newhtml.html newhtml.xml Simple Application Simple Application Simple Application NewClass.java public class NewClass extends HttpServlet{ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException{ PrintWriter out = response.getWriter(); String req = request.getParameter("username"); out.println(req);}} please anyone tell me why is an error is appearing to me ??
tagged with: servlets
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/40626010
has comment: http://stackoverflow.com/comment/40626000
has comment: http://stackoverflow.com/comment/40626124
tagged with: tomcat
score: 0
has title: error in servalet java
answer count: 1
has answer: http://stackoverflow.com/a/25950907
type: UnansweredQuestion

http://stackoverflow.com/comment/40728103
type: Comment
comment on: http://stackoverflow.com/a/26005366
has text: But sometimes the word is embedded in the string like "ground" in "wunderground". I can't index "wunderground" ahead of time.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25892337
has comment: http://stackoverflow.com/comment/40523130
has answer: http://stackoverflow.com/a/27380325
tagged with: java
tagged with: classnotfoundexception
type: AnsweredQuestion
tagged with: php-java-bridge
downvote count: 0
score: 1
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/40523584
type: Question
has comment: http://stackoverflow.com/comment/40525417
has comment: http://stackoverflow.com/comment/54908081
tagged with: php
has comment: http://stackoverflow.com/comment/40524190
accepted answer: http://stackoverflow.com/a/27380325
has title: java.lang.ClassNotFoundException in PHP-Java bridge
upvote count: 1
answer count: 1
has body: I am working on PHP-Java Bridge. A syntax from my php file looks as follows: require_once("java/Java.inc"); $address = new Java('com.odus.apg.cfa.java.address'); I have placed the package file cfa.jar which consist com/odus/apg/cfa/java/address.class file in TOMCAT.HOME/webapps/JavaBridge/WEB-INF/lib And my php file is located at TOMCAT.HOME/webapps/JavaBridge After this set-up I get Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new com.odus.apg.cfa.java.address. Cause: java.lang.ClassNotFoundException: com.odus.apg.cfa.java.address VM: 1.7.0_40@http://java.oracle.com/" at: #-18 java.net.URLClassLoader$1.run(Unknown Source) #-17 java.net.URLClassLoader$1.run(Unknown Source) #-16 java.security.AccessController.doPrivileged(Native Method) #-15 java.net.URLClassLoader.findClass(Unknown Source) #-14 java.lang.ClassLoader.loadClass(Unknown Source) #-13 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) #-12 java.lang.ClassLoader.loadClass(Unknown Source) #-11 java.lang.Class.forName0(Native Method) #-10 java.lang.Class.forName(Unknown Source) #-9 php.java.bridge.Util.classForName(Util.java:1518) #-8 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:445) #-7 php.java.bridge.Request.handleRequest(Request.java:458) #-6 php.java.bridge.Request.handleRequests(Request.java:500) #-5 php.java.bridge.JavaBridge.handleRequests(JavaBridge.java:150) #-4 php in /usr/share/apache-tomcat-7.0.55/webapps/JavaBridge/java/Java.inc on line 195 Is this set-up even correct? Are the jar files and php files located in correct directories? How can this error be resolved?

http://stackoverflow.com/a/26006032
accepted answer of: http://stackoverflow.com/q/26005396
type: Answer
answers question: http://stackoverflow.com/q/26005396
downvote count: 0
has body: This doesn't work because methodA is defined in ChildA but getSibling returns Base reference. Although this Base reference happens to point to ChildA object, you should either perform explicit castings or generalize Base type. In this particular case, you may simply override getSibling: class ChildB extends Base { public ChildB(ChildA sibling) { super(sibling); } @Override public ChildA getSibling() { return (ChildA) super.getSibling(); } } This would not scale well if there are a lot of classes like ChildB though. Also, ChildB is restricted to contain only ChildA as it's sibling. Edit: it may not always be childB Alright, assuming you don't need Base class to be generic, you may replace it with: class ChildB &lt;T extends Base&gt; extends Base { public ChildB(T sibling) { super(sibling); } @Override @SuppressWarnings("unchecked") public T getSibling() { return (T) super.getSibling(); } } You may instantiate it as follows: brother = new ChildB&lt;ChildA&gt;(this);
score: 1
has comment: http://stackoverflow.com/comment/40754162
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40754921

http://stackoverflow.com/q/25907742
score: 0
has answer: http://stackoverflow.com/a/25970824
has answer: http://stackoverflow.com/a/31089622
has comment: http://stackoverflow.com/comment/40551932
tagged with: jdbc
linked to: http://stackoverflow.com/q/6865538
has comment: http://stackoverflow.com/comment/40554201
has body: coming from a php background i'm completely lost in the JAVA architecture. this is my first desktop app in over 10 yrs, and my first Java app. So pardon the noob questions. I use netbeans 7.0.1 + JDK 1.7.0. Create new desktop appliction, with just a single button. do the "import java.sql.*;" at the top of the "DesktopAppView.java" page. I went to library then added the MYSQL JDBC driver. Even downloaded and added the latest JDBC connection from MYSQL site. went to the services panel, right click on Drivers, MySQL (Connector/J driver) and added new connection and was able to connect to the DB. then in the button click function in "DesktopAppView.java" page, i added: //String driver = "com.mysql.jdbc.Driver"; String driver = "org.gjt.mm.mysql.Driver"; String url = "jdbc:mysql://localhost/test"; String username = "root"; String password = ""; Class.forName(driver); // load MySQL driver //Class.forName(driver).newInstance(); // load MySQL driver Connection conn = DriverManager.getConnection(url, username, password); System.out.println("done"); When it comes to the "getConnection" part, application just hangs. When i added a "?connectTimeout=3000" to the url string, it timedout the app raising exception : com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure... ...... at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) Caused by: java.net.SocketTimeoutException: Connect timed out at java.net.SocksSocketImpl.readSocksReply(SocksSocketImpl.java:125) however, when creating a java application in netbeans (not desktop app).. the same connection code works fine??? I'm pulling my hair out over the last two days. I'm not sure what stuff is added to teh desktop app that maybe conflicting with the DB connection. I have already tried all posted here by SOheil... Solving a "communications link failure" with JDBC and MySQL Nothing works PLs HELP !!!
tagged with: netbeans
type: UnansweredQuestion
has title: java desktop application , netbeans mysql jdbc
has comment: http://stackoverflow.com/comment/40552982
tagged with: java
tagged with: mysql
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40553143
has comment: http://stackoverflow.com/comment/40552052
tagged with: desktop

http://stackoverflow.com/q/26031941
answer count: 1
has comment: http://stackoverflow.com/comment/40794581
tagged with: arcgis
has body: I am using the ArcGIS Runtime SDK for Java in my project. I need to add latitude/longitude values for GPS tracking. I can't find a solution to perform this. There are sample codes to perform this, but I think they are using a CSV file for the values. I can't find a way to add a path of the CSV file or add a CSV file. Sample code: private static final String FSP = System.getProperty("file.separator"); private String getPathSampleData() { String dataPath = null; String javaPath = ArcGISRuntime.getInstallDirectory(); if (javaPath != null) { if (!(javaPath.endsWith("/") || javaPath.endsWith("\\"))) { javaPath += FSP; } dataPath = javaPath + "sdk" + FSP + "samples" + FSP + "data" + FSP; } File dataFile = new File(dataPath); if (!dataFile.exists()) { dataPath = ".." + FSP + "data" + FSP; } return dataPath; } Can any one help me to solve my issue?
has comment: http://stackoverflow.com/comment/40776056
accepted answer: http://stackoverflow.com/a/26042716
type: AnsweredQuestion
has title: how to add user latitude and longitude values in arcgis.?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26042716
score: 0

http://stackoverflow.com/comment/40658633
has text: Ok i am putting the complete working code which have error
comment on: http://stackoverflow.com/q/25967346
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25992744
has body: By Drag Drop you can Copy your file.So applying any changes from eclipse won't affect your original one. But while doing drag and drop you can select Link to Files so now you can change file of drive from eclipse.
downvote count: 0
answers question: http://stackoverflow.com/q/25992635
score: 2
upvote count: 2
type: Answer

http://stackoverflow.com/q/25876666
tagged with: android
possible better answer: http://stackoverflow.com/a/25877963
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25877963
tagged with: java
type: Question
has title: Can't do the insetion in database android
answer count: 2
accepted answer: http://stackoverflow.com/a/25876764
has comment: http://stackoverflow.com/comment/40495357
tagged with: database
score: 0
has body: There is a problem with insetion in database. I don't know what to do. It writes error inserting. public class MainActivity extends Activity implements OnClickListener { BaseOpener bo; private static final String ML = "ML"; Button read, write; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); read = (Button) findViewById(R.id.read); read.setOnClickListener(this); write = (Button) findViewById(R.id.write); write.setOnClickListener(this); bo = new BaseOpener(this); Log.i("Ml", "good start"); } @Override public void onClick(View v) { SQLiteDatabase db = bo.getWritableDatabase(); switch (v.getId()) { case R.id.write: { ContentValues cv = new ContentValues(); Log.i("ML", "write"); cv.put("id", 1); cv.put("name", "Petr"); cv.put("phone", "911"); cv.clear(); db.insert("table1", null, cv); } break; case R.id.read: {`enter code here` Log.i("ML", "read"); Cursor c = db.query("table1",null,null,null,null,null,null); if(c.moveToFirst()){ int idColIndex = c.getColumnIndex("id"); int nameColIndex = c.getColumnIndex("name"); int emailColIndex = c.getColumnIndex("phone"); Log.i("ML", "ID = " + c.getInt(idColIndex) + ", name = " + c.getString(nameColIndex) + ", phone = " + c.getString(emailColIndex)); } } break; } db.close(); Log.i("ML", "the base is closed"); } } public class BaseOpener extends SQLiteOpenHelper { public BaseOpener(Context context) { super(context, "contacts", null, 1); Log.i("ML", "the base is ready"); }`enter code here` @Override public void onCreate(SQLiteDatabase db) { db.execSQL("create table table1 (" + "id integer primary key," + "name String," + "phone String" + ");"); Log.i("ML", "table1 is ready"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub } }
has answer: http://stackoverflow.com/a/25876764
tagged with: sqlite
tagged with: insert

http://stackoverflow.com/comment/40579794
type: Comment
type: QuestionComment
has text: I'll try to clarify. I am to assume a NameNode JVM capacity of 100 GB. Given a ratio of Inodes to Blocks of 1.5 and assuming 3 Replicas of each Block, how many Inodes can fit on the heap of the NameNode’s JVM?
comment on: http://stackoverflow.com/q/25917116
score: 0

http://stackoverflow.com/q/26011851
has title: How to determine path to resources in java web application
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26011994
has comment: http://stackoverflow.com/comment/40739588
tagged with: jsp
tagged with: apache-tiles
score: 0
answer count: 1
has body: I'm writing a simple web application using Spring MVC Apache Tiles and Bootstrap and I'm having trouble with loading CSS and images. For deploying I use jetty server. My project structure look like following: My tiles config file looks <put-attribute name="footer" value="/WEB-INF/layout/footer.jsp" /> <put-attribute name="title" value="Car Store" /> <put-attribute name="body" value="/WEB-INF/jsp/index.jsp" /> And when I try to include css file in my classic.jsp, browser can't find relative resources. I try two cases like following and but error still throw. Spring controller method looks: @RequestMapping(value = "/") public String index(){ return "index"; } Dispatcher servlet config file: <context:component-scan base-package="org.yurabilash.car.store.controller"/> /WEB-INF/defs/general.xml
accepted answer: http://stackoverflow.com/a/26011994
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/41978308
score: 0
type: AnswerComment
has text: @RomanC many of my insertion code is written in jdbc and for fetch I am using hibernate and same problem I am facing for other code so Solution for this situation is very important for me
type: Comment
comment on: http://stackoverflow.com/a/26673023

http://stackoverflow.com/q/25912190
score: 26
possible better answer: http://stackoverflow.com/a/38003878
has body: I have written Java-Classes with JavaDoc-commands that contain special characters like äöü. I generate the JavaDoc using a gradle build-file: apply plugin: 'java' and the in the commandline: gradle javadoc. The encoding of the original files is UTF-8. The encoding of the JavaDoc files is also UTF-8. But there is no hint in the HTML-sources, that the files are UTF-8. Thats why my browser always thinks it is ISO-8859. How can I tell javadoc (via gradle) to also add &lt;meta charset="utf-8"/&gt; to the source codes, when generating the JavaDoc?
tagged with: java
tagged with: javadoc
upvote count: 26
has answer: http://stackoverflow.com/a/41772101
tagged with: gradle
type: Question
has title: How to set an encoding for the JavaDoc in gradle?
tagged with: encoding
downvote count: 0
has answer: http://stackoverflow.com/a/40354580
accepted answer: http://stackoverflow.com/a/25917146
has answer: http://stackoverflow.com/a/38003878
has answer: http://stackoverflow.com/a/25917146
tagged with: utf-8
answer count: 4
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/q/25889904
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25890490
has title: Sprite doesn't move in Java 2D game
tagged with: 2d
tagged with: java
tagged with: sprite
downvote count: 1
type: Question
score: -1
has body: I'm currently having a problem with my 2d Java game. Everything works for me up until the very end. When I try to move the sprite, nothing happens. If instead of player.setVelY(-5); I use player.setY(player.getY - 5); the sprite moves, but why setVelX and setVelY don't work? : / Here is part of my KeyInput.java @Override public void keyPressed(KeyEvent e){ int key = e.getKeyCode(); switch(BNeeto.state){ case MENU: break; case GAME: if(key == KeyEvent.VK_W) player.setVelY(-5); if(key == KeyEvent.VK_S) player.setVelX(5); if(key == KeyEvent.VK_A) player.setVelY(-5); if(key == KeyEvent.VK_D) player.setVelX(5); break; case OPTIONS: break; case PAUSE: break; default: break; } } Player.java package bneeto.entity; import bneeto.gfx.Texture; import bneeto.gfx.core.CoreObject; import java.awt.Graphics; public class Player extends CoreObject{ public Player(int x, int y, int id, Texture tex){ super(x, y, id, tex); } @Override public void tick() { x += velX; y += velY; } @Override public void render(Graphics g) { g.drawImage(tex.blockStone, x, y, null); } }
tagged with: move
upvote count: 0
has comment: http://stackoverflow.com/comment/40519304

http://stackoverflow.com/comment/40566807
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25914151
has text: use Double.parsedouble(textview.gettext().tostring());
score: 0

http://stackoverflow.com/a/27267028
upvote count: 1
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/25874197
score: 0
has body: You can change your default JVM Locale to let cucumber use the default date converter. Locale.setDefault(Locale.US);

http://stackoverflow.com/a/25974648
accepted answer of: http://stackoverflow.com/q/25966156
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40688043
has body: What you are looking for is called a NinePatch. Basically that is an special kind of image that defines strechable and not-strechable parts of the image. A typical use case for the NinePatch is a Button as you usually don't want the edges to get stretched and just stretch the rest. A Simple example of instantiating would be: NinePatch patch = new NinePatch(new Texture(Gdx.files.internal("knob.png")), 12, 12, 12, 12); For more details about this example you can see the wiki page about NinePatches: https://github.com/libgdx/libgdx/wiki/Ninepatches
type: Answer
answers question: http://stackoverflow.com/q/25966156
score: 0

http://stackoverflow.com/a/26002749
has comment: http://stackoverflow.com/comment/40722922
answers question: http://stackoverflow.com/q/26002695
has comment: http://stackoverflow.com/comment/40722771
downvote count: 0
score: 1
has body: In Java you have anonymous classes
upvote count: 1
has comment: http://stackoverflow.com/comment/40722880
type: Answer

http://stackoverflow.com/comment/40507166
comment on: http://stackoverflow.com/q/25883235
score: 0
has text: Great, so you are castig `null` to `null` and later on only `offG` is initialized
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25877483
accepted answer: http://stackoverflow.com/a/25877629
type: Question
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25877655
has comment: http://stackoverflow.com/comment/40497073
has answer: http://stackoverflow.com/a/25877655
score: 1
tagged with: javax.xml
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has answer: http://stackoverflow.com/a/25877629
upvote count: 1
has body: I've come across and problem that I've looked up on stack overflow but none of the solutions seems to solve the problem for me. I'm retrieving XML data from Yahoo and it comes back as below (truncated for brevity's sake). &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;fantasy_content xmlns="http://fantasysports.yahooapis.com/fantasy/v2/base.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" copyright="Data provided by Yahoo! and STATS, LLC" refresh_rate="31" time="55.814027786255ms" xml:lang="en-US" yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/league/328.l.108462/settings"&gt; &lt;league&gt; &lt;league_key&gt;328.l.108462&lt;/league_key&gt; &lt;league_id&gt;108462&lt;/league_id&gt; &lt;draft_status&gt;postdraft&lt;/draft_status&gt; &lt;/league&gt; &lt;/fantasy_content&gt; I've been having a problem getting XPath to retrieve any elements so I've written a unit test to try to resolve it and it looks like: final File file = new File("league-settings.xml"); javax.xml.parsers.DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); dbFactory.setNamespaceAware(true); javax.xml.parsers.DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); org.w3c.dom.Document doc = dBuilder.parse(file); javax.xml.xpath.XPath xPath = XPathFactory.newInstance().newXPath(); xPath.setNamespaceContext(new YahooNamespaceContext()); final String expression = "yfs:league"; final XPathExpression expr = xPath.compile(expression); Object nodes = expr.evaluate(doc, XPathConstants.NODESET); assert(nodes instanceof NodeList); NodeList leagueNodes = (NodeList)nodes; int leaguesLength = leagueNodes.getLength(); assertEquals(leaguesLength, 1); The YahooNamespaceContext class I created to map the namespaces looks as follows: public class YahooNamespaceContext implements NamespaceContext { public static final String YAHOO_NS = "http://www.yahooapis.com/v1/base.rng"; public static final String DEFAULT_NS = "http://fantasysports.yahooapis.com/fantasy/v2/b…
has title: how to retrieve XML data using XPath which has a default namespace in Java?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26018285
downvote count: 0
answers question: http://stackoverflow.com/q/26017767
type: Answer
upvote count: 1
score: 1
has body: The method HttpServletRequest.html#getSession(boolean) may return null If create is false and the request has no valid HttpSession, this method returns null. A Filter may be invoked before a resource is requested or after it is requested depending on when you perform chain.doFilter(request, response); In your case it seem that you query the session before the jsp is executed, i.e. doing something like this: HttpServletRequest httpServletRequest = (HttpServletRequest) request; String remoteIP = (String) httpServletRequest.getSession(false).getAttribute("remoteAddr"); // pass the request along the filter chain chain.doFilter(request, response); Changing it to // pass the request along the filter chain chain.doFilter(request, response); HttpServletRequest httpServletRequest = (HttpServletRequest) request; String remoteIP = (String) httpServletRequest.getSession(false).getAttribute("remoteAddr"); Will get it to work, but I doubt this is what you intend to do, since you probably want to check the remote IP and decide whether to allow access or deny it to the requested resource, in which case you may want to do something like this: String remoteIP= request.getRemoteAddr(); if(remoteIP.matches("some pattern")) { ((HttpServletResponse)response).setStatus(HttpServletResponse.SC_FORBIDDEN); } else { // pass the request along the filter chain chain.doFilter(request, response); }

http://stackoverflow.com/comment/40664410
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25969714
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61662/discussion-between-anand-and-dunken).

http://stackoverflow.com/comment/40558770
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25907566
has text: possible duplicate of [Parsing xml that has different namespaces using XPath in JAVA](http://stackoverflow.com/questions/14392200/parsing-xml-that-has-different-namespaces-using-xpath-in-java)

http://stackoverflow.com/comment/40667566
has text: you can also delete the directory of datanode set in the hdfs-site.xml and then format the namenode.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25972503
type: Comment

http://stackoverflow.com/comment/40831998
score: 0
type: Comment
has text: @sksffmsn thanks, i have built using jav 1.6 and ojdbc6 and all is working well now.
type: AnswerComment
comment on: http://stackoverflow.com/a/26049301

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/25983096
tags question: http://stackoverflow.com/q/25881659
tags question: http://stackoverflow.com/q/25892777
type: Tag

http://stackoverflow.com/comment/40645392
type: QuestionComment
has text: With cryptography, you first need a clear understanding what you are doing before you start to implement anything. Use cases, attack vectors and a key management scheme are minimal requirements before you can create or choose a protocol, let alone implementing the protocol.
score: 1
comment on: http://stackoverflow.com/q/25922682
type: Comment

http://stackoverflow.com/a/61034004
has comment: http://stackoverflow.com/comment/108028524
upvote count: 0
has body: You should check logs If you see like below "stacktrace": ["java.lang.IllegalStateException: Received message from unsupported version: [6.4.3] minimal compatible version is: [6.8.0]" You can check this link https://discuss.elastic.co/t/java-client-or-spring-boot-for-elasticsearch-7-3-1/199778 You have to explicit declare es version.
type: Answer
answers question: http://stackoverflow.com/q/25912572
downvote count: 1
has comment: http://stackoverflow.com/comment/107994721
score: -1

http://stackoverflow.com/comment/40767854
comment on: http://stackoverflow.com/a/26026222
score: 0
type: AnswerComment
has text: I just had to change +count to count++ in the code above and it works perfectly. Thank you for your help!
type: Comment

http://stackoverflow.com/comment/40753999
comment on: http://stackoverflow.com/q/26019959
has text: It's not called `RandomMap`.
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/q/26003246
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: metaprogramming
type: Question
downvote count: 0
has body: Main issue: It seems that if I modify a Java class's metaClass then such changes are only honored if my Groovy code is invoking that Java class. However if another Java class is invoking the Java class that I modified, then the metaClass changes are ignored. I guess this behavior seems to be proper (the Java code that was compiled will not check the Groovy meta-class registry) but I was hoping someone can give me some other ideas on how to achieve my goals. Here's some sample code: A.java: public class A { A() { System.out.println("A constructor"); B b = new B(); b.foo(); } } B.java: public class B { B() { System.out.println("B constructor"); } public void foo() { System.out.println("B.foo() invoked"); } } Compilation: javac *.java jar cvfe java.jar Main *.class foo.groovy: println 'Groovy now invoking Java...' new A() println 'Modifying B.metaClass' B.metaClass.foo = { -&gt; println 'modified foo() method!' } println 'Groovy now invoking Java...' new A() // &lt;&lt;===== I would like to see the "modified foo()" here but I don't :( println 'Groovy creating B directly' new B().foo() // "modified foo()" appears here Run: &gt; groovy -cp .:java.jar foo.groovy I have a Grails app that uses some existing Java JARs (bytecode, no access to its source code). I'd like to intercept some calls to certain methods in these Java classes, but those methods are invoked by other Java classes in that same JAR. Spring AOP is out of the question because the objects in question are not managed by Spring. Bigger picture: I'm actually trying to solve the problem I stated in: Why does Grails issue SELECT statements on instance save()? My idea was to write code like the following: import org.codehaus.groovy.grails.orm.hibernate.validation.UniqueConstraint class HibernateEnhancerGrailsPlugin { def loadBefore = ['hibernate'] def doWithSpring = { UniqueConstraint.metaClass.processValidate = { final Object target, final Object propertyValue, Errors errors -&gt; // no-op... } } } Thoughts?
has title: Groovy meta-class to intercept interactions between Java objects
has comment: http://stackoverflow.com/comment/40724142
tagged with: grails
has comment: http://stackoverflow.com/comment/40725598
linked to: http://stackoverflow.com/q/25944080
tagged with: groovy
favorite count: 0
answer count: 0
upvote count: 2

http://stackoverflow.com/a/25907174
upvote count: 2
has comment: http://stackoverflow.com/comment/40550472
type: Answer
has body: Nothing is displayed because the looping code and println doesn't run. The construct used is an instance initialization block. However, an instance of the PrimeSum class is never created - hence the block never executes. The simple fix is to move the code into the main method which is executed. (Note that it is static so it can be called without an instance being created.) Consider: public class PrimeSum { public static void main(String args[]){ System.out.println("Hi, in main!"); // Now create instance, run initialization block.. new PrimeSum(); // .. but really, just put the code in main, or better, // a method called from main .. System.out.println("Sum is " + calculateSum()); } /* private double sum = 0.0; &lt;-- note newlines added here for clarity */ { // This is an instance initialization block, it does NOT run // until/when an instance is created. // (The original never ran code in here, because an instance was // never created.) System.out.println("Hi, in instance initialization block!"); } static double calculateSum() { // Do math, return value return 42; } }
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25907081

nexus
type: Tag
tag name: nexus
tags question: http://stackoverflow.com/q/26003271
tags question: http://stackoverflow.com/q/25983852

http://stackoverflow.com/a/25928996
score: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25928896
has body: Because autounboxing. Java derive common type for defVal and "true".equalsIgnoreCase(val). Type of first is Boolean, but second boolean. For unknown reason it thinks that common type will be boolean (You can find rule in spec).
upvote count: 4

http://stackoverflow.com/comment/40704549
comment on: http://stackoverflow.com/a/25981973
score: 0
type: AnswerComment
type: Comment
has text: @AndyWilkinson Ok, I'll check it out!

http://stackoverflow.com/a/25883191
answers question: http://stackoverflow.com/q/25882660
score: 0
type: Answer
has body: For accomplishing your task try to use dialog Box instead of using Context Menu. Context menu open on long press but dialog box will open on single click and on long click also. and after opening the dialog box you can get the data from dialog also.

http://stackoverflow.com/comment/40605611
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25937487
has text: `${container.user}` will return `Optional<User>`, so after that you will have to use the proper getter from `Optional` to retrieve the data from `User`.

http://stackoverflow.com/a/25902072
answers question: http://stackoverflow.com/q/25901972
type: Answer
upvote count: 1
downvote count: 0
score: 1
has body: You might need to add a support library to your new project. Check this link for downloading the support libraries - http://developer.android.com/tools/support-library/setup.html#download Please notice that you need to import them into your eclipse and then include one (preferably the newest, not sure about this) in your project. EDIT: Before downloading the support libraries you should first check if you have them already. Try this, right click project folder in the eclipse package explorer, Properties>Android>Library>Add>select a library if you have one. There might be an invalid library included in your project already, if that happens then you will see it in the Library>Add> menu, remove it and add a new one.

http://stackoverflow.com/comment/40779941
type: QuestionComment
comment on: http://stackoverflow.com/q/26033729
has text: What you mean "when i deployed my website on server"?
score: 0
type: Comment

http://stackoverflow.com/comment/40618564
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25944583
type: AnswerComment
has text: Try making `name` also `protected`?

http://stackoverflow.com/comment/40770994
comment on: http://stackoverflow.com/q/26028995
type: Comment
type: QuestionComment
has text: Well did you research at all? :) there are so many answers on google within a second. For one solution, look at http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#toLowerCase(). I will let you think about how to solve your other problem. Hint, the solution is probably within the `String` class again.
score: 2

http://stackoverflow.com/comment/40508364
comment on: http://stackoverflow.com/a/25883975
score: 0
type: AnswerComment
type: Comment
has text: go to the logcat tab from ddms and check the error you getting for your app

http://stackoverflow.com/q/25877575
downvote count: 0
tagged with: maven
has title: Debug IncompatibleClassChangeError with Maven, Jersey, Tomcat, @ApplicationPath, no web.xml
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25877987
accepted answer: http://stackoverflow.com/a/25877987
tagged with: java
favorite count: 0
has body: If I try to load any resource urls, I get the following exception: javax.servlet.ServletException: Servlet.init() for servlet com.example.project.Application threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745) root cause java.lang.IncompatibleClassChangeError: org/glassfish/jersey/server/internal/scanning/AnnotationAcceptingListener$AnnotatedClassVisitor org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.<init>(AnnotationAcceptingListener.java:143) org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.newJaxrsResourceAndProviderListener(AnnotationAcceptingListener.java:115) org.glassfish.jersey.server.ResourceConfig.scanClasses(ResourceConfig.java:884) org.glassfish.jersey.server.ResourceConfig._getClasses(ResourceConfig.java:849) org.glassfish.jersey.server.ResourceConfig.getClasses(ResourceConfig.java:755) com.sun.jersey.server.impl.application.DeferredResourceConfig$ApplicationHolder.<init>(DeferredResourceConfig.java:92) com.sun.jersey.server.impl.application.DeferredResourceConfig$ApplicationHolder.<init>(DeferredResourceConfig.java:79) com.sun.jersey.server.impl.application.DeferredResourceConfig.getAppli…
type: Question
upvote count: 2
tagged with: jersey
answer count: 1
tagged with: tomcat
linked to: http://stackoverflow.com/q/9345488
tagged with: jax-rs

http://stackoverflow.com/comment/40656452
type: AnswerComment
has text: I'm thinking now that I might not want to limit each animation to 3 images
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25966190

http://stackoverflow.com/comment/40769646
comment on: http://stackoverflow.com/a/26028027
score: 0
type: AnswerComment
has text: additionally: grails run-app works without any issues and resolves the dependencies correctly from the pom, while: mvn grails:run-app fails with the mentioned error.
type: Comment

http://stackoverflow.com/comment/40540383
type: Comment
type: QuestionComment
score: 2
has text: What is the exception you get?
comment on: http://stackoverflow.com/q/25901407

http://stackoverflow.com/a/27847948
has body: We just encountered a similar problem with Wildfly and a .Net server. We worked around it by changing the WSDL we feed to wsdl2java so that the problem elements were qualified rather than unqualified. So we changed this: &lt;s:schema elementFormDefault="qualified" targetNamespace="http://www.example.com/messageresult/v200"&gt; ---snip--- &lt;s:complexType name="SubmissionResponseType"&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="0" maxOccurs="1" form="unqualified" name="ID" type="s:string"/&gt; &lt;s:element minOccurs="0" maxOccurs="1" form="unqualified" name="StatusText" type="s:string"/&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; ---snip--- &lt;/s:schema&gt; To this: &lt;s:schema elementFormDefault="qualified" targetNamespace="http://www.example.com/messageresult/v200"&gt; ---snip--- &lt;s:complexType name="SubmissionResponseType"&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="0" maxOccurs="1" form="qualified" name="ID" type="s:string"/&gt; &lt;s:element minOccurs="0" maxOccurs="1" form="qualified" name="StatusText" type="s:string"/&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; ---snip--- &lt;/s:schema&gt;
score: 0
answers question: http://stackoverflow.com/q/25948980
type: Answer
has comment: http://stackoverflow.com/comment/44216106

jvm
tags question: http://stackoverflow.com/q/25890436
tags question: http://stackoverflow.com/q/25873593
tags question: http://stackoverflow.com/q/25910498
tags question: http://stackoverflow.com/q/25985295
tags question: http://stackoverflow.com/q/25941348
tags question: http://stackoverflow.com/q/25894499
tags question: http://stackoverflow.com/q/25953475
type: Tag
tags question: http://stackoverflow.com/q/25949145
tags question: http://stackoverflow.com/q/25965595
tags question: http://stackoverflow.com/q/25915485
tags question: http://stackoverflow.com/q/25884028
tags question: http://stackoverflow.com/q/25970804
tags question: http://stackoverflow.com/q/26029764
tags question: http://stackoverflow.com/q/25887715
tags question: http://stackoverflow.com/q/25899431
tag name: jvm
tags question: http://stackoverflow.com/q/25955362
tags question: http://stackoverflow.com/q/25990369
tags question: http://stackoverflow.com/q/25899566
tags question: http://stackoverflow.com/q/25974300
tags question: http://stackoverflow.com/q/25944370
tags question: http://stackoverflow.com/q/26020872
tags question: http://stackoverflow.com/q/25981722
tags question: http://stackoverflow.com/q/26032372
tags question: http://stackoverflow.com/q/26028817
tags question: http://stackoverflow.com/q/25970990
tags question: http://stackoverflow.com/q/25969676
tags question: http://stackoverflow.com/q/25881353
tags question: http://stackoverflow.com/q/25972440
tags question: http://stackoverflow.com/q/25974021
tags question: http://stackoverflow.com/q/25942010

celltable
type: Tag
tags question: http://stackoverflow.com/q/25995199
tag name: celltable
tags question: http://stackoverflow.com/q/25990682

http://stackoverflow.com/a/27510566
answers question: http://stackoverflow.com/q/25983999
has body: Yarn (or MRv1) is killing the container just after your job finish. The CPU Samples can't be wrote on your profiling file. In fact, your traces should be truncated also. You have to add the following option (or the equivalent on your Hadoop version) : yarn.nodemanager.sleep-delay-before-sigkill.ms = 30000 # No. of ms to wait between sending a SIGTERM and SIGKILL to a container yarn.nodemanager.process-kill-wait.ms = 30000 # Max time to wait for a process to come up when trying to cleanup a container mapreduce.tasktracker.tasks.sleeptimebeforesigkill = 30000 # Same en MRv1 ? (30 sec seems to enough)
has comment: http://stackoverflow.com/comment/58081179
downvote count: 0
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/67566445
type: Comment
has text: Upvote for a corrected answer. Believe me, it's frustrating when you're looking for solution, you find it and it occures, that the url is not active.
comment on: http://stackoverflow.com/a/40144272
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40764102
score: 0
has text: @clcto: Yes, but why use a deb packet at all then ... A single jar file won´t have use for anything of the additional stuff Apt provides.
comment on: http://stackoverflow.com/q/26025093
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40720052
score: 0
comment on: http://stackoverflow.com/a/25999673
type: AnswerComment
type: Comment
has text: How java determines the path to resources? What if I put it without any directory, just raw copy paste inside of jar?

http://stackoverflow.com/a/25893023
has comment: http://stackoverflow.com/comment/40533955
has comment: http://stackoverflow.com/comment/40529037
upvote count: 1
has comment: http://stackoverflow.com/comment/40565494
has comment: http://stackoverflow.com/comment/40528084
has comment: http://stackoverflow.com/comment/40525700
has body: Edit: It appears that jsp:useBean is an old school way to collect up a group of parameter values for easier display on a page. It does not add an attribute when the request is posted. Based on that, I see little value in the jsp:useBean tag, since you can use el expressions to access attributes that you set in a servlet. This does not help you get the posted parameter values into a bean in the servlet. You can write a method on the bean to extract the parameter values from the request (visitor pattern). For example: class bean { private String value; public void loadFromHttpServletRequest(final HttpServletRequest request) { value = request.getParameter("value"); } } Consider using a package like spring-mvc.
type: Answer
has comment: http://stackoverflow.com/comment/40527636
answers question: http://stackoverflow.com/q/25892562
has comment: http://stackoverflow.com/comment/40524820
has comment: http://stackoverflow.com/comment/40528783
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40527212
has comment: http://stackoverflow.com/comment/40527459

http://stackoverflow.com/a/25882013
answers question: http://stackoverflow.com/q/25881722
score: 0
accepted answer of: http://stackoverflow.com/q/25881722
type: AcceptedAnswer
has body: Usually eclipse is preferred for java development. You did silly mistakes while coding for e.g 1) There were 2 constructors with the same signature which is not allowed in java. 2) You used variables which were not declared like "in" in the while loop to accept user input for "y/n". 3) your missed in enclosing of brackets. Try writing your code on your own instead of copying it from somewhere. Below is the rectified code. Help your self. import java.util.Scanner; public class TemperatureLab { public TemperatureLab() { } public static void Temperaturelab(String[] args) { Scanner input = new Scanner(System.in); // Enter a temperature between -20 and 110 degrees fahrenheit. System.out.println("Enter temperature:"); int temperature = input.nextInt(); if (temperature &gt;= 75) { System.out.println("You can go swimming"); } else { System.out.println("Try again"); } if (temperature &gt; 60 || temperature &lt;= 85) { System.out.println("You can play tennis"); } else { System.out.println("Try again"); } if (temperature &lt; 10 || temperature &lt;= 32) { System.out.println("You can go skiing"); } else { System.out.println("Try again"); } if (temperature &lt;= 10) { System.out.println("You can play checkers"); } else { System.out.println("Try again"); } if (temperature &lt; 32 || temperature &lt;= 70) { System.out.println("You can play soccer"); } else { System.out.println("Try again"); } String answer; boolean yn; System.out.println("y/n"); while (true) { answer = input.nextLine().trim().toLowerCase(); if (answer.equals("y")) { yn = true; break; } else if (answer.equals("n")) { yn = false; break; } else { System.out .println("Sorry, I didn't catch that. Please answer y/n"); } } } }
type: Answer
has comment: http://stackoverflow.com/comment/40582511

http://stackoverflow.com/q/26024088
has body: I looked a couple of different way to convert binary to integer in JAVA. But I couldn't figure out why this works? int res = 0; res += 1 &lt;&lt; 1; The res turns out to be 2, I know it shifts towards left 1 bit and became 10 in binary. But I'm confusing how it converts from binary to integer, i want to know the mechanism. Thanks
has comment: http://stackoverflow.com/comment/40761870
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26024238
has answer: http://stackoverflow.com/a/26024800
tagged with: java
has answer: http://stackoverflow.com/a/26024238
score: -1
answer count: 2
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40761865
accepted answer: http://stackoverflow.com/a/26024800
has comment: http://stackoverflow.com/comment/40762752
type: AnsweredQuestion
has title: Java Binary to Integer

http://stackoverflow.com/q/25906480
duplicate of: http://stackoverflow.com/q/435553
tagged with: java
has answer: http://stackoverflow.com/a/25906711
type: Question
has body: I know what reflection does, but I want to know in what exact case that we can use it. Like, using reflection we can come to know whether the class contains the specified method or not. I also want to know the actual scenario where this kind of requirements can come in picture? and does the use of reflection have any impact on application performance?
upvote count: 2
score: 0
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/25906555
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/435553
has title: How does reflection in Java affects the application's performance and what are the scenarios that reflection can be used?
tagged with: reflection

http://stackoverflow.com/comment/40772213
type: Comment
comment on: http://stackoverflow.com/a/26029613
score: 1
has text: yes, I understand it in case of some relatively complicated application but using it by Oracle in such simple tutorial class seems to me a bit strange :)
type: AnswerComment

http://stackoverflow.com/a/25890985
answers question: http://stackoverflow.com/q/25889127
score: 0
has body: Short answer: None Long answer: CSV was designed to cater two dimension. To abuse it for your purpose you need to define a fixed dimension JSon (As you probably know JSon can be of arbitrary hierarchy. For example if JSon is three dimension like items:{arr1:[item1, item2, item3], arr2:[item1, item2, item3]} then it will have three delimiters. Let say delimiters are comma, hyphen and plus sign (for sake of explanation) then CSV will be items-arr1+item1,item2,item3-arr2+item1,item2, item3 I would not recommend that for reason said above. I suggest you find a way to save file as sheer JSon or somehow serialize/deserialize it than mess with it that way!
type: Answer

http://stackoverflow.com/comment/40544263
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25903448
type: AnswerComment
has text: Ah.. You shouldn't use 'while(true)' in listen method, cause it'll keep reading from the socket, but once your client finish the sending, it will close the connection

http://stackoverflow.com/q/25912044
type: Question
upvote count: 2
tagged with: gridpane
has answer: http://stackoverflow.com/a/25912773
tagged with: java
tagged with: javafx
answer count: 1
accepted answer: http://stackoverflow.com/a/25912773
has body: I am trying to create a GUI for one of my programs. This is my first time using JavaFX. For starters, I would like to have a GridPane that takes up the entire window. I have tried everything I could find: setMinWidth/Height, setPrefSize, minWidth, etc. Nothing worked. Following is the part of the code that defines the GridPane, with two Text objects: //Grid layout GridPane grid = new GridPane(); grid.setPrefSize(STAGE_WIDTH, STAGE_HEIGHT); grid.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE); grid.setMinSize(STAGE_WIDTH, STAGE_HEIGHT); //grid.minWidth(STAGE_WIDTH); //grid.minHeight(STAGE_HEIGHT); grid.setGridLinesVisible(true); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); //Text final Text count = new Text("Count"); grid.add(count,0,0); final Text total = new Text("Total"); grid.add(total,1,0); Scene scene = new Scene(grid, STAGE_WIDTH, STAGE_HEIGHT); primaryStage.setScene(scene); primaryStage.show(); Does anybody know how to successfully program this simple attribute? A GridPane that takes up the entire window? What am I missing? Thank you LD
type: AnsweredQuestion
score: 2
downvote count: 0
has title: JavaFX - Inflating a GridPane to parent's size
favorite count: 0

http://stackoverflow.com/comment/40662362
comment on: http://stackoverflow.com/a/25969571
type: Comment
has text: means that can I do like this : <c:set var="aVar" value="<dn:account><%= account_username %></dn:account>" scope="request"/>
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40504261
score: 1
comment on: http://stackoverflow.com/a/25879658
type: AnswerComment
has text: java -version says 1.7. Eclipse compiler is set to 1.6. I will have to use 1.6 as server is running on 1.6. thinking of doing substring to exclude offset before converting to date
type: Comment

http://stackoverflow.com/a/26026402
has comment: http://stackoverflow.com/comment/40773961
downvote count: 0
answers question: http://stackoverflow.com/q/26026321
score: 5
accepted answer of: http://stackoverflow.com/q/26026321
has comment: http://stackoverflow.com/comment/40791007
has comment: http://stackoverflow.com/comment/40768198
has comment: http://stackoverflow.com/comment/40766558
has body: You're just printing out the result of calling Date.toString() which happens not to include the milliseconds. If you print out the result of calling getTime() on the date, you'll see that it ends in "456", showing that it has parsed the milliseconds. Also, don't be fooled by the "EDT" part of the output of Date.toString(). It doesn't mean that this is a Date object "in" EDT... a Date doesn't have a time zone at all; it's just a number of milliseconds since the unix epoch. I'd advise you to explicitly set the time zone of your SimpleDateFormat, however - even if you deliberately set it to the system default time zone. By doing it explicitly, you make it clear to the reader that you meant to use that time zone, rather than just that you failed to think about it. You should take the same approach to the locale, too - in this case I'd probably specify Locale.US, which is usually a good bet for formats which are designed more for machine-parsing than humans.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40766448
upvote count: 5
type: Answer

http://stackoverflow.com/comment/40742239
comment on: http://stackoverflow.com/q/25978944
score: 0
type: Comment
type: QuestionComment
has text: Hmmm strange. Might be a bug. Did you try also binary-keyed store? + try to remove expiration settings to see what will happen then. And thanks for info!

http://stackoverflow.com/q/26005483
has comment: http://stackoverflow.com/comment/40767688
upvote count: 5
has answer: http://stackoverflow.com/a/52348673
has comment: http://stackoverflow.com/comment/40729163
has answer: http://stackoverflow.com/a/26006249
has comment: http://stackoverflow.com/comment/40758334
has answer: http://stackoverflow.com/a/52676580
has answer: http://stackoverflow.com/a/72865957
downvote count: 0
has answer: http://stackoverflow.com/a/61859786
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40728222
favorite count: 0
answer count: 12
has answer: http://stackoverflow.com/a/47328731
has answer: http://stackoverflow.com/a/61062507
has comment: http://stackoverflow.com/comment/40746172
score: 5
accepted answer: http://stackoverflow.com/a/26006249
tagged with: spring
has answer: http://stackoverflow.com/a/76434165
has comment: http://stackoverflow.com/comment/40729731
has title: org.springframework.web.servlet.DispatcherServlet noHandlerFound
possible better answer: http://stackoverflow.com/a/59751830
has body: I get this error when accessing http://api:8080/users which 404's and I get this error in my console: Sep 23, 2014 5:57:52 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/users] in DispatcherServlet with name 'dispatcher' When I access http://localhost:8080/api/users I get a 404 in my browser but no error in my console applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.api"/> </beans> dispatcher-servlet.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd "> <context:component-scan base-package="com.api"/> </beans> web.xml: <?xml version="1.0" encoding="UTF-8"?> dispatcher org.spr…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40728354
has answer: http://stackoverflow.com/a/29513853
has answer: http://stackoverflow.com/a/59751830
has comment: http://stackoverflow.com/comment/40730489
has comment: http://stackoverflow.com/comment/40752301
has answer: http://stackoverflow.com/a/63428351
tagged with: java
linked to: http://stackoverflow.com/q/7175509
has answer: http://stackoverflow.com/a/61906271
type: Question

undertow
type: Tag
tags question: http://stackoverflow.com/q/26003216
tag name: undertow

http://stackoverflow.com/q/25893183
tagged with: java
type: Question
has body: I am using Stax. I have to log any current XMLEvent, when something goes wrong. If I use toSting(), I get something like [Stax Event #1]. Is there any way/tool to get readable and clear String representation of XMLEvent?
score: 0
tagged with: xml-parsing
has answer: http://stackoverflow.com/a/25913041
answer count: 1
has title: XMLEvent to String for logging
tagged with: stax
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/40732284
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25989991
type: Comment
has text: @noobcoder it is taking both. It then tries to unify them. If it succeeds, the X is unified with the _same two characters_ that appear at the end of the fourth word. If you want to have both, you need two different variables. See the other answer I wrote to your next question. You should also try and trace to see what is actually going on.

http://stackoverflow.com/a/25895505
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25895461
answers question: http://stackoverflow.com/q/25895461
type: AcceptedAnswer
has body: Context? From where? A webpage? Use the onload event hook from within a webpage to fire a custom javascript function only when the page has completely loaded
has comment: http://stackoverflow.com/comment/40529927

http://stackoverflow.com/comment/40991957
type: QuestionComment
has text: Is UserAddress.updatedUser always in the User.addresses list?
score: 0
comment on: http://stackoverflow.com/q/25896215
type: Comment

http://stackoverflow.com/comment/40700153
has text: @Marko Topolnik: well, you get a syntax check at compile time regarding the Java syntax but whether that syntax can be translated to the database query cannot be checked at compile time. In the end the constructs are a) too trivial to bother or b) a big performance killer if you ignore how the underlying storage really works.
comment on: http://stackoverflow.com/q/25989449
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/40692584
score: 0
comment on: http://stackoverflow.com/q/25982177
type: Comment
type: QuestionComment
has text: I will do that as soon as I get some free time. Thank you.

http://stackoverflow.com/comment/40545141
type: Comment
has text: @VictoriaPotvin Yep, `instanceof` doesn't appear much in the docs, but is vital...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25904133

http://stackoverflow.com/q/25883483
accepted answer: http://stackoverflow.com/a/25885105
score: 0
tagged with: java
type: Question
has body: This is my first question. I created the standalone compiler of Xtend with instructions below. Built with Ant and Ivy Directories are: lib/, build/ "xtend-compiler.jar" will be output on build/ Libraries are downloaded on lib/ the Jar-file contains dependent libraries Main-class is org.eclipse.xtend.core.compiler.batch.Main build.xml: <property name="lib.dir" value="lib" /> <property name="build.dir" value="build" /> <fileset dir="${lib.dir}"/> <mkdir dir="${lib.dir}"/> <ivy:retrieve pattern="${lib.dir}/[artifact].[ext]"/> <delete dir="${build.dir}"/> <copy file="${lib.dir}/org.eclipse.xtend.standalone.jar" tofile="${build.dir}/xtend-compiler.jar"/> <zipgroupfileset dir="${lib.dir}" includes="**/*.jar" excludes="org.eclipse.xtend.standalone.jar"/> <attribute name="Main-Class" value="org.eclipse.xtend.core.compiler.batch.Main"/> ivy.xml: <info organisation="" module="xtend-compiler"/> <conf name="web"/> <dependency org="org.eclipse.xtend" name="org.eclipse.xtend.standalone" rev="2.4.3" conf="web->default"/> After I built Jar-file, I tried to run java -jar build/xtend-compiler.jar this shows: Usage: Main <options> where possible options include: -d <directory> Specify where to place generated xtend files -tp Temp directory to hold generated stubs and classes -cp Specify where to find user class files -encoding <encoding> Specify character encoding used by source files -useCurrentClassLoader Use current classloader as parent classloader Then I want to compile HelloWorld.xtend: class HelloWorld { def static void main(String[] args) { System.out.println("Hello World") } } but I couldn't do that. For example: java -jar build/xtend-compiler.jar HelloWorld.xtend Exception in thread "main" java.lang.NullPointerException at java.io.File.<init>(File.java:277) at org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler.configureWorkspace(XtendBatchCompiler.java:258) at org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler.compile(XtendBatchCompiler.java:273) at org.eclipse.x…
tagged with: xtend
has answer: http://stackoverflow.com/a/25885105
answer count: 1
tagged with: jar
has title: How to compile Xtend sources, with the Standalone Compiler?
type: AnsweredQuestion

http://stackoverflow.com/comment/40519747
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25889568
has text: For the method to execute correctly, a value must have been passed. Without doubting your solutiin I thought that my code had to work. Turns out that it wasnt the problem, the reason that it kicked up an error was due to the fact that my mouselistener was pointed at another button entirely. A clear example of why having so much code in one place is a bad thing, I would have seen that much easier had I not coded so many lines. Thanks for the help anyway.

http://stackoverflow.com/comment/40574926
score: 3
type: Comment
has text: Yes, O(n/2) is exactly the same thing as O(n). Don't believe everything you read on the Internet. ;)
type: QuestionComment
comment on: http://stackoverflow.com/q/25920318

http://stackoverflow.com/comment/40637900
score: 1
comment on: http://stackoverflow.com/q/25956312
type: Comment
type: QuestionComment
has text: 1. Compile it. 2. Experiment with running it. 3. If you can't figure out why it behaves the way it does, use a debugger.

http://stackoverflow.com/comment/40610719
comment on: http://stackoverflow.com/q/25940053
score: 0
type: Comment
has text: You are not declaring type for `empId` and `name`. May be you want `private int empId;` and `private String name;`
type: QuestionComment

http://stackoverflow.com/comment/131491266
type: Comment
comment on: http://stackoverflow.com/a/26024526
type: AnswerComment
has text: How to do the same for request? I want to log request body and its content-type can be anything (json, plain-text, multipart/formdata etc).
score: 0

http://stackoverflow.com/comment/40726948
score: 9
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26004889
has text: Line break is `'\n'`, not `'/n'`.

http://stackoverflow.com/comment/40705974
has text: @sethu yes, I added more details.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25989280
type: Comment

http://stackoverflow.com/comment/40753052
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26019246
has text: Also you should avoid having a new method for each separate report. Try to create a generic service method, which accepts reportName and other needed info, and returns the desired report.

http://stackoverflow.com/a/25941197
score: 0
has comment: http://stackoverflow.com/comment/40616030
answers question: http://stackoverflow.com/q/25940975
has comment: http://stackoverflow.com/comment/40615802
type: Answer
has body: Choose File > New Project and select Enterprise Application Client in the Java EE category you need Remote interface, not ejb code in client client uses rmi (socket) to talk to server and runs ejb in the server side client containers are treated like step children for vendors, most soa architectures have full java ee server on both sides i.e. a java ee web app is the client of java ee ejb/webservice app I hate all those netbeans files, I would rather use maven, it may be harder at times but you ll get better support on the web for remote calls i would use jax-rs or jax-ws
has comment: http://stackoverflow.com/comment/40614283
has comment: http://stackoverflow.com/comment/40615624
has comment: http://stackoverflow.com/comment/40613338
has comment: http://stackoverflow.com/comment/40613289
has comment: http://stackoverflow.com/comment/40614379

http://stackoverflow.com/comment/40517394
has text: getDate() doesn't work with Mysql.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25889131
type: Comment

http://stackoverflow.com/comment/40719190
comment on: http://stackoverflow.com/q/26000695
type: Comment
type: QuestionComment
has text: The person in question is using a Note 3, and I don't think its a phone related issues because he is able to install new application over previous one quite easily, and do not have to manually uninstall the previous one to be able to install the new one. I don't know if there a function or a line I can write in the manifest that would automatically override the previous application installed so that user do not have to do it manually.
score: 0

deadbolt-2
tag name: deadbolt-2
type: Tag
tags question: http://stackoverflow.com/q/25890118

http://stackoverflow.com/comment/92224764
comment on: http://stackoverflow.com/q/25909201
type: QuestionComment
has text: Did you found solution?
type: Comment
score: 0

http://stackoverflow.com/comment/40751357
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26017835
has text: *"The code given is for MIDI files only,.."* How could you think `"http://pscode.org/media/leftright.wav"` is a ***ing MIDI?!? But for pity's sake, try it with one of your own Wavs if you don't believe me. And as an aside, I'm the [top answer provider for Java Sound](http://stackoverflow.com/tags/javasound/topusers) as well as the author of the [info. page](http://stackoverflow.com/tags/javasound/info) that contains both code samples.

http://stackoverflow.com/comment/82251071
comment on: http://stackoverflow.com/a/25900095
has text: @user2602807 You set a socket read timeout. But you will lose any data that had already been read if the timeout triggers, or rather you won't know how much data was read if any. Best to use `read()` in association with timeouts.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40531880
has text: this one apply to your Views : views.setViewPadding(R.id.widget_item_news_publishedDate_text, 30, 0, 0, 0);
comment on: http://stackoverflow.com/a/25896610
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25981973
answers question: http://stackoverflow.com/q/25981660
score: 2
accepted answer of: http://stackoverflow.com/q/25981660
has comment: http://stackoverflow.com/comment/40699206
has comment: http://stackoverflow.com/comment/40699308
has comment: http://stackoverflow.com/comment/40699081
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40702433
downvote count: 0
has body: All you need to do is provide a bean of type javax.jms.ConnectionFactory and instruct Spring Boot to not provide a default one. The code would look like: @Configuration class YourActiveMQConnectionFactoryConfiguration { @Bean public ConnectionFactory jmsConnectionFactory() { return createFactory(); //do whatever you need to here } } In you main Application configuration class add the exclude property to @EnableAutoConfiguration. @Configuration @EnableAutoConfiguration(exclude=ActiveMQConnectionFactoryConfiguration.class) //the rest of your annotations public class AppConfig { //declare whatever other beans you need }
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40704549

http://stackoverflow.com/q/25967177
has answer: http://stackoverflow.com/a/25987567
has answer: http://stackoverflow.com/a/25967333
has comment: http://stackoverflow.com/comment/40658868
has comment: http://stackoverflow.com/comment/40660695
has comment: http://stackoverflow.com/comment/40658128
has comment: http://stackoverflow.com/comment/40659006
has comment: http://stackoverflow.com/comment/40658184
has comment: http://stackoverflow.com/comment/40658929
has answer: http://stackoverflow.com/a/29867571
has comment: http://stackoverflow.com/comment/40658812
has comment: http://stackoverflow.com/comment/40664911
has comment: http://stackoverflow.com/comment/40658183
has title: Determine whether or not can an array of numbers can be divided into two arrays, with each array holding the same sum of numbers
accepted answer: http://stackoverflow.com/a/25968359
has comment: http://stackoverflow.com/comment/40661088
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40659009
score: 7
tagged with: iteration
favorite count: 0
has comment: http://stackoverflow.com/comment/40658913
has comment: http://stackoverflow.com/comment/40658248
has answer: http://stackoverflow.com/a/41405614
has comment: http://stackoverflow.com/comment/40658502
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/40671559
has body: Below is a code to determine whether or not can an array of numbers can be divided into two arrays, with each array holding the same sum of numbers. for example: {1, 3 ,2, 6} can be divided into {6} and {1,2,3}, therefore return true while {1,5,7} can't be divided into two, balanced array, therefore return false public boolean canBalance(int[] nums) { for (int i = 0; i &lt; nums.length; i++) { int sum = 0; for (int j = 0; j &lt; i; j++) sum += nums[j]; for (int j = i; j &lt; nums.length; j++) sum -= nums[j]; if (sum == 0) return true; } return false; } it's an accepted answer for an exercise in codingbat, I don't understand this piece in particular: for (int j = 0; j &lt; i; j++) sum += nums[j]; for (int j = i; j &lt; nums.length; j++) sum -= nums[j]; doesn't for iteration usually starts with { and ends with } ? and how come if sum == 0 means it can be balanced? I have tried noting it down on piece of paper with array of {1,3,2,6} and had sum of 26, which returns false, where it's obvious that {1,3,2,6} should return true. I think I misread the code, I don't know which, though. Or maybe the algorithm is false, but it was accepted in codingbat
has comment: http://stackoverflow.com/comment/40664495
has comment: http://stackoverflow.com/comment/40658822
has comment: http://stackoverflow.com/comment/40658139
possible better answer: http://stackoverflow.com/a/25970585
has comment: http://stackoverflow.com/comment/40659271
has answer: http://stackoverflow.com/a/25968359
has answer: http://stackoverflow.com/a/25970585
tagged with: java
has answer: http://stackoverflow.com/a/25981406
has answer: http://stackoverflow.com/a/25968152
tagged with: loops
upvote count: 7

http://stackoverflow.com/comment/40658450
type: QuestionComment
has text: What buttons? Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
score: 2
comment on: http://stackoverflow.com/q/25967295
type: Comment

http://stackoverflow.com/a/25919020
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40572853
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25918994
score: 3
answers question: http://stackoverflow.com/q/25918994
has comment: http://stackoverflow.com/comment/40573530
has body: Here &amp; is bitwise operator which performs AND operation on provided value while | is bitwise OR operator which is performing OR operation on the values. &amp; Bitwise AND | Bitwise OR As explained in the link int a = 60; /* 60 = 0011 1100 */ /*Binary*/ int b = 13; /* 13 = 0000 1101 */ int c = 0; c = a &amp; b; /* 12 = 0000 1100 */ c = a | b; /* 61 = 0011 1101 */

http://stackoverflow.com/comment/40698109
comment on: http://stackoverflow.com/a/25982754
score: 0
type: AnswerComment
has text: Hi @Chandra Prakash, thank you for your suggestion. I already looked at the code of the job and this query records set is stored in `rs_tMysqlInput_1` variable which is in scope of `tMysqlInput_1Process` method, so I don't know/see the way how I can put it in the some other object using tJava or tJavaFlex (but I was thinking in that direction also). **If you know how we can do it, could you please send me some small example how this can be done?**
type: Comment

http://stackoverflow.com/a/49104842
answers question: http://stackoverflow.com/q/25997556
type: Answer
has body: For me it was enought to add the following lines at the beginning of the main-class (direct after starting) Properties log4jProp = new Properties(); log4jProp.setProperty("log4j.rootLogger", "WARN"); PropertyConfigurator.configure(log4jProp);
score: 0

http://stackoverflow.com/a/26079934
answers question: http://stackoverflow.com/q/25941348
has body: Use SIGAR API by Hyperic. It provides Memory, CPU, Disk, Load-Average, Network Interface info and metrics, Process Table information, Route info, etc. And all this staff under Apache License, Version 2.0.
type: Answer
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/40586886
has text: It was a simple test to see if it worked, which is why I wasn't too worried about convention. Secondly, I have a controller specified as Gui.Controller which is the path and is working because the rest of the objects on the scene are interacting with the controller fine. I shall try the suggested FMLLoader.getController.
comment on: http://stackoverflow.com/a/25925318
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40664537
type: AnswerComment
has text: how it is impossible, i will hit my server from my mobile which is connected to wifi of different network.after hitting server will send data at my port 1619. it is working fine on wifi.but when i am connect to my mobile network it is not working i think there is an issue of permission or sockets connection.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25970755

http://stackoverflow.com/q/25992918
accepted answer: http://stackoverflow.com/a/26191612
type: Question
downvote count: 0
tagged with: erp
has title: Deployment of Openbravo in GoDaddy Server
tagged with: linux
has body: I have successfully installed Openbravo ERP 3.0 with PostgreSQL in local linux system. But I want to deploy this ERP in GoDaddy server. Can anyone suggest me the procedure to migrate from local server to hosting server with PostgreSQL database?
answer count: 1
score: 1
has answer: http://stackoverflow.com/a/26191612
favorite count: 0
upvote count: 1
tagged with: openbravo
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25981230
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40685629
tagged with: swing
has title: How to return the new value of a public String from a private void JButton?
has comment: http://stackoverflow.com/comment/40683848
has comment: http://stackoverflow.com/comment/40686019
has comment: http://stackoverflow.com/comment/40685699
tagged with: java
has comment: http://stackoverflow.com/comment/40685466
type: Question
has comment: http://stackoverflow.com/comment/40685566
has comment: http://stackoverflow.com/comment/40686365
has comment: http://stackoverflow.com/comment/40685592
score: 0
has answer: http://stackoverflow.com/a/25981386
answer count: 1
has body: I have a public String in one class and is to be used by other classes. The value of this String can only be acquired with the use of a JButton. My code seems right but still I only get null returned from the button. Below is my class containing the public String variable and the code for the JButton: public class Seminar_Menu extends javax.swing.JFrame { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; // Public String mentioned in quesiton public String Seminar_Choosen; ...... //Button Code private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { Conduct_Seminar consem = new Conduct_Seminar(); Seminar_Menu semen = new Seminar_Menu(); String message = "Conduct this seminar?"; String title = "Conduct"; int reply = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.YES_OPTION) { Seminar_Choosen = Title_Field.getText(); consem.setVisible(true); semen.setVisible(false); } } ...... } I'm using JFrame Form by the way in Netbeans. Is there any other way of returning the value of Seminar_Choosen?
has comment: http://stackoverflow.com/comment/40685493
has comment: http://stackoverflow.com/comment/40683960
has comment: http://stackoverflow.com/comment/40685848

http://stackoverflow.com/q/25952371
tagged with: java
has answer: http://stackoverflow.com/a/25952372
accepted answer: http://stackoverflow.com/a/25952372
type: Question
has body: I am using c3p0 to handle database connection pooling in a multithreaded environment. The question might pertain to other pooling libs, but this is what I have. Recently I've needed to implement interruption handling on such threads using directly or indirectly c3p0, and have noticed that if interrupt() is called right when c3p0Datasource.getConnection() is trying to fetch me a Connection from the pool, it throws an InterruptedException. Obviously, this happens because of the wait() at java.lang.Object.wait(Native Method) at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1414) Cool. The question is how do you handle this properly - both is case a) you want to continue with the transaction before your thread terminates, and b) you want to abort. I've tried a solution that seems to be working fine (posted as answer) - actually, I think this subject is closed. Feel free to chip in otherwise, thanks!
tagged with: c3p0
tagged with: interrupt-handling
upvote count: 3
answer count: 1
favorite count: 0
type: AnsweredQuestion
score: 3
tagged with: connection-pooling
tagged with: interrupted-exception
downvote count: 0
has title: Connection pooling and Thread.interrupt()

http://stackoverflow.com/comment/40636771
comment on: http://stackoverflow.com/q/25955669
score: 0
has text: You can run your string through a scanner.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25992231
has title: Tomcat shuts down on closing jar
score: -1
tagged with: tomcat
has body: I made a java web application that calls a main method from a jar file i included as a WebAppLibraries and when this main calls system.exit to terminate it shuts down also the web app closing tomcat. How can avoid to shut down the web app closing only the execution of that main method?
has comment: http://stackoverflow.com/comment/40703365
has answer: http://stackoverflow.com/a/25992568
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: exit
upvote count: 0
tagged with: java
tagged with: system.exit
type: Question
tagged with: shutdown

http://stackoverflow.com/comment/40690570
comment on: http://stackoverflow.com/a/25965564
score: 0
type: Comment
has text: N.B. Your original code worked here, that code above just does the same using best practices. I think something is awry in your Java set-up.
type: AnswerComment

http://stackoverflow.com/a/26003123
answers question: http://stackoverflow.com/q/26003074
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You haven't specified the second parameter for the PreparedStatement. You are repeating the value for first parameter twice ps.setObject(1, sku); ps.setObject(1, cross, java.sql.Types.VARCHAR, cross.length); should be ps.setObject(1, sku); ps.setObject(2, cross, java.sql.Types.VARCHAR, cross.length);

http://stackoverflow.com/comment/40591617
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25929719
has text: Thanks for your response. But why the threads are not get killed?
type: AnswerComment

http://stackoverflow.com/comment/40639324
has text: Edited. Boris, I think you're right about decimal places. I was confused with only 2 digits after last comma. Looks like typo. OP wants to format integer number.
type: Comment
comment on: http://stackoverflow.com/a/25956913
score: 0
type: AnswerComment

http://stackoverflow.com/q/25966025
answer count: 1
has answer: http://stackoverflow.com/a/25966062
has body: I have some issues with the following piece of client code. private FlightSchedule loadFlightSchedule() throws ServiceException { if (flightSchedule == null) { logger.debug("flightSchedule is null in loadFlightSchedule"); String endPoint = null; String userId = null; String password = null; try { endPoint = getProperty("schedule_url") + "?wsdl"; logger.debug("In loadFlightSchedule, flightSchedule endPoint is " + endPoint); userId = getProperty("schedule_username"); password = getProperty("schedule_password"); } catch( Exception ex ) { logger.error("Exception in loadFlightSchedule getting properties from configProps..."); throw new ServiceException("Unable to get endpoint for FlightSchedule from Config..."); } URL url = null; try { url = new URL (endPoint); } catch( MalformedURLException e ) { logger.error("Exception in loadFlightSchedule creating URL..."); throw new ServiceException("Unable to build FlightSchedule url from the endpoint.", e ); } try { flightSchedule = new FlightScheduleService(url, flightScheduleName).getFlightSchedulePort(); //((BindingProvider)flightSchedulePort).getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, new Integer(300000)); ((BindingProvider)flightSchedule).getRequestContext().put("javax.xml.ws.client.connectionTimeout", new Integer (300000)); ((BindingProvider)flightSchedule).getResponseContext().put("javax.xml.ws.client.receiveTimeout", new Integer (100000)); ((BindingProvider)flightSchedule).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, userId ); ((BindingProvider)flightSchedule).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password ); } catch( Exception ex ) { logger.error("Exception in loadFlightSchedule getting FlightSchedulePort..."); ex.printStackTrace(); throw new ServiceException("Unable to get FlightSchedule service.", ex ); } } return flightSchedule; } I have been receiving the following error message. 04:31:05,085 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (EJB default - 7) Interce…
has title: web service failing. java.net.SocketTimeoutException: Read timed out - Using Jboss 7.1
has comment: http://stackoverflow.com/comment/40657165
favorite count: 0
tagged with: sockets
accepted answer: http://stackoverflow.com/a/25966062
downvote count: 1
has comment: http://stackoverflow.com/comment/40659772
type: AnsweredQuestion
score: 3
tagged with: cxf-client
tagged with: java
type: Question
upvote count: 4
tagged with: ejb

http://stackoverflow.com/a/26027510
answers question: http://stackoverflow.com/q/25998180
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/25998180
has comment: http://stackoverflow.com/comment/40780578
has comment: http://stackoverflow.com/comment/40793005
type: AcceptedAnswer
downvote count: 0
has body: Instantiate to SelectSeekStep1 With aliases it's more convenient: Box b = BOX.as("b"); Support s = SUPPORT.as("s"); SelectSeekStep1&lt;Integer, Integer&gt; sql = query.select(b.ID, s.ID /* other columns */) .from(b) .join(s) .on(s.ID.eq(b.SUPPORT_ID)) .where(s.ID.eq("XXXX")) .orderBy(b.ID) ; Then just fetch what/as you need: List&lt;BoxRecord&gt; boxes = sql.fetchInto(BOX); SupportRecord support = sql.limit(1).fetchOneInto(SUPPORT);
score: 8

http://stackoverflow.com/a/26006452
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40757045
accepted answer of: http://stackoverflow.com/q/26006360
upvote count: 7
has comment: http://stackoverflow.com/comment/40760263
answers question: http://stackoverflow.com/q/26006360
score: 7
has body: You're almost there. You just need to tell your POJO about the callback instance. First, I would strongly recommend that you move the interface definition into the POJO (since conceptually it has to do more with that object than with your activity) or make the interface an independent type. The POJO should not know about types defined in the client class(es). Then you have a choice: use a listener pattern: in your POJO add a field to store an instance of the callback (or something more complicated if you want to support calling back to multiple listeners) and a method for setting the listener. Call the method from your activity (or wherever is appropriate) when you create or are setting up the POJO. use a callback pattern: enhance the relevant API methods with a callback argument. In either case, when the bitmap is ready you have the wiring to get the bitmap back to the activity. EDIT Here's an example of how this might be structured. You haven't provided any information about how you create your POJO or invoke the processing, so I invented something just as an example. It assumes that the processing is taking place in a separate thread, which will call back to the activity when done. You can modify this as needed. (In particular, this can be much simpler if the POJO is doing the work synchronously. Also, it would be better to use an AsyncTaskLoader rather than a plain vanilla thread so that it interacts properly with the Activity lifecycle.) BitmapCallback.java public interface BitmapCallback { public void onBitmapReady(Bitmap processedBitmap); } MyActivity.java public class MyActivity extends Activity implements BitmapCallback { Handler mHandler; // initialize this in onCreate . . . public void onRequestImage() { ProcessImage processor = new ProcessImage(); getImage(this /* , other actual args */); } @Override public void onBitmapReady(final Bitmap processedBitmap) { // since this may be called from a non-UI thread, we can't update // the UI directly. mHandler.pos…

http://stackoverflow.com/q/25946620
has answer: http://stackoverflow.com/a/25946773
possible better answer: http://stackoverflow.com/a/25946862
downvote count: 0
has answer: http://stackoverflow.com/a/25946862
favorite count: 0
has answer: http://stackoverflow.com/a/25946926
has comment: http://stackoverflow.com/comment/40621518
answer count: 4
score: 2
has comment: http://stackoverflow.com/comment/40621603
accepted answer: http://stackoverflow.com/a/25946773
tagged with: biginteger
upvote count: 2
type: AnsweredQuestion
has body: Is that theoretically possible? Even BigIntegers should fail, AFAIK, since they are internally based on an Array, and these have a limited size. Is it possible to directly calculate with the exponential form of googolplexes in Java? for example: ((10^10^100)/2)-5 How do I prepare an application, which has googol-sized numbers as genuine results? (For those who don't know: a googol == 10^100, a googolplex == 10^10^100)
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/40621580
type: Question
has title: How to calculate with googol or even larger numbers in java?
has answer: http://stackoverflow.com/a/79153758

http://stackoverflow.com/comment/40533530
has text: Thanks, that is what I wanted to know. As said in the other comment, Iterables.list() does not state anything about whether it is a view or not.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25897839

http://stackoverflow.com/comment/40742000
has text: and this gets picked-up at runtime by what ... ?
type: Comment
comment on: http://stackoverflow.com/a/26013473
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40506609
has text: Hi @AvinashRaj : I have added example
type: Comment
comment on: http://stackoverflow.com/q/25882689
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40576076
comment on: http://stackoverflow.com/q/25920748
score: 0
has text: Any particular reason you don't just use `queue.waitInQueueBlocking` ?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/121817850
type: AnswerComment
has text: Sorry, but your code sample doesn't explain anything by itself. Please update to a more meaningful answer
type: Comment
comment on: http://stackoverflow.com/a/25911563
score: 1

http://stackoverflow.com/a/26022283
has comment: http://stackoverflow.com/comment/40758443
answers question: http://stackoverflow.com/q/26022054
has body: If you know the exact number of your threads you can use CountDownLatch from java.util.concurrent. // First initialize latch with your number of threads CountDownLatch latch = new CountDownLatch(N); // Then give this instance of latch to each of your threads // and finally at your checkpoint do latch.countDown(); latch.await(); That's all.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26022054

http://stackoverflow.com/a/26016984
has body: The easiest way to do this would be as below: package fi.iki.elonen; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.util.List; import java.util.Map; public class Stackoverflowtest extends NanoHTTPD{ static boolean isDoingAJob=false; public Stackoverflowtest() { super(8080); } @Override public Response serve(IHTTPSession session) { Method method = session.getMethod(); Map<String,String> params = session.getParms(); String uri = session.getUri(); System.out.println(method + " '" + uri + "' "); String msg = " Remote Test Service "; try { List<String> lines= FileUtils.readLines(new File("<fileloc>")); for(String line: lines){ msg+=" "+line+" "; } } catch (Exception e) { e.printStackTrace(); } msg += " "; return new NanoHTTPD.Response(msg); } public static void main(String[] args) { try { new Stackoverflowtest().start(); } catch (IOException e) { e.printStackTrace(); } } } Notice the script at the bottom. It just makes the browser reload every 5s. You don't need ajax or anything, for a simplistic solution. If you want to build something more sophisticated like getting only the newly added lines to the browser, then the solution will need to change a bit. Note: For this to work, in the NanoHTTPD class, in the run() method, I changed the myThread.setDeamon(true) to false. Otherwise you will need to make your main thread sleep for a long time. Else the program will just exit.
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40753953
answers question: http://stackoverflow.com/q/25989280
upvote count: 1
has comment: http://stackoverflow.com/comment/40753579

http://stackoverflow.com/comment/40705425
score: 0
type: QuestionComment
type: Comment
has text: I don't know how it works internally, but at least some of Selenium's drivers can dump the entire DOM as HTML.
comment on: http://stackoverflow.com/q/25993057

http://stackoverflow.com/q/26030886
score: 0
has title: How to clean up plotted chart and restart the graph plotting from left end
has body: I am trying to plot a real time graph using the data from serial port which arrives approx 1 sample/5 msec. So it is basically a Integer_Value Vs Time graph. Below is code to draw graph using JFreeChar (ScatterChart). In receive event handler of serial port listener I call method xySeries.add(x, y); with appropriate x and y co-ordinates. Now plot appearance as expected is like 1. start from left end point of chart 2. Plot till right end 3. Restart from left end point of char 4. keep repeating this refresh cycles as I keep receiving continuous data over serial port. However, I am stuck with problem #3 and #4. How to clean off the chart and restart from left end point? Also in #1 and #2 I am able to plot the points but it starts somewhere in right bottom end of chart. But I have used xyPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); xyPlot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT); which should ideally start from bottom left end of chart, but it does not. Would appreciate some pointers in this direction Thank you in advance. public void addPoint(Number x, Number y) { Comment:This function is called from Serial Port receive event handler that supplies X,Y values XYItemRenderer renderer = xyPlot.getRenderer(); //System.out.println("addPoint y = " + y.doubleValue() + " minThresholdMarker" + minThresholdMarker); if(y.doubleValue() &gt; minThresholdMarker) { GradientPaint gPaint = new GradientPaint(2.0f, 6.0f, Color.lightGray, 2.0f, 6.0f, Color.green); xyPlot.setBackgroundPaint(gPaint); renderer.setSeriesPaint(0, Color.green); if(!countDownTimerRunning /*&amp;&amp; !bTimeOver */) { timerCountDown = new Timer(1000, countDownTimeListener); timerCountDown.setInitialDelay(0); countDown = TREATMENT_DURATION; countElapsed = 0; timerCountDown.start(); countDownTimerRunning = true; timerDispPanel.setBackground(new Color(240, 230, 140)); } } else { GradientPaint gPaint = new GradientPaint(4.0f, 6.0f, Color.lightGray, 3.0f, 6.0f, Color.lightGray); xyPlot.setBackgrou…
has comment: http://stackoverflow.com/comment/40809744
has comment: http://stackoverflow.com/comment/40810482
has comment: http://stackoverflow.com/comment/40811812
answer count: 0
type: UnansweredQuestion
tagged with: serial-port
has comment: http://stackoverflow.com/comment/40802759
tagged with: swing
has comment: http://stackoverflow.com/comment/41213152
has comment: http://stackoverflow.com/comment/40813817
tagged with: java
has comment: http://stackoverflow.com/comment/40807301
tagged with: jfreechart
type: Question
linked to: http://stackoverflow.com/q/5048852

http://stackoverflow.com/comment/40681348
comment on: http://stackoverflow.com/q/25979914
score: 0
type: Comment
type: QuestionComment
has text: Your `Controller` class doesn't extend a `Context` of any kind. Why would you expect to be able to cast the application `Context` to it?

http://stackoverflow.com/comment/40987621
score: 0
comment on: http://stackoverflow.com/q/25957879
type: QuestionComment
type: Comment
has text: @DaveSyer, I tried, no difference

http://stackoverflow.com/q/26008008
tagged with: swing
type: Question
possible better answer: http://stackoverflow.com/a/26008031
has answer: http://stackoverflow.com/a/26008066
score: 0
linked to: http://stackoverflow.com/q/7229226
answer count: 2
has title: JList not displaying any objects?
accepted answer: http://stackoverflow.com/a/26008066
has body: I've been trying to figure out how to use JList and I cant seem to get it to display an object into my GUI. there's a class called Drawing that I'm trying to add to the JList and it just doesnt seem to show.. Any help would be greatly appreciated here's my code: public class DrawingDisplayer extends JPanel implements ActionListener, ListSelectionListener { JLabel title; JButton draw,pause,clear, open,close, lines,background; JSlider speedSlider; JProgressBar progress; Drawing drawing; JFileChooser chooser; JList fileList; DefaultListModel listModel; JPanel drawPanel; JScrollPane scrollPane; public DrawingDisplayer(){ title = new JLabel("The Drawing Displayer"); title.setHorizontalAlignment(JLabel.CENTER); title.setFont(new Font("Serif", Font.BOLD, 24)); draw = new JButton("Draw"); pause = new JButton("Pause"); clear = new JButton("Clear"); speedSlider = new JSlider(); progress = new JProgressBar(); open = new JButton("Open Drawing"); close = new JButton("Close Drawing"); listModel = new DefaultListModel(); fileList = new JList(listModel); fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fileList.addListSelectionListener(this); fileList.setVisibleRowCount(10); scrollPane = new JScrollPane(fileList); scrollPane.setPreferredSize(new Dimension(200,250)); lines = new JButton("Lines"); background = new JButton("Background"); setLayout(new BorderLayout()); //Draw Panel drawPanel = new JPanel(); drawPanel.setBorder(BorderFactory.createTitledBorder("Drawing Area")); //Drawing Speed JPanel drawSpeed = new JPanel(); drawSpeed.setPreferredSize(new Dimension(300,200)); drawSpeed.setBorder(BorderFactory.createTitledBorder("Drawing Speed")); drawSpeed.add(draw); drawSpeed.add(pause); drawSpeed.add(clear); drawSpeed.add(speedSlider); drawSpeed.add(progress); //File Options JPanel fileOptions = new JPanel(); fileOptions.setPreferredSize(new Dimension(300,350)); fileOptions.setBorder(BorderFactory.createTitledBorder("File Options")); open.addActionListener(this); close…
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26008031

http://stackoverflow.com/a/25909634
has comment: http://stackoverflow.com/comment/40600678
has body: There are a few extra gotchas but it's not hard to make your own build. It's really just 3-4 Eclipse commands away. Since there is so much demand I will make a proper script to do it, but I will aim for end of the month unless it's super urgent.
answers question: http://stackoverflow.com/q/25908817
score: 0
type: Answer

http://stackoverflow.com/comment/40588030
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25927579
has text: When you say that the error is shown partially is because it gets out of the screen?, or just it does not appear completely
score: 0

http://stackoverflow.com/comment/40607591
comment on: http://stackoverflow.com/q/25938573
type: Comment
type: QuestionComment
has text: Which part of this code is not clear for you?
score: 3

http://stackoverflow.com/q/25964698
type: Question
tagged with: configuration
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25982686
upvote count: 2
type: UnansweredQuestion
has body: I want my Logger with a FileHandler to use the settings defined in my config file. Do I have to use Logger.getLogger or Logger.addHandler(new FileHandler()) after I have used LogManager.readConfiguration(InputStream) or is there more to it? In other words, what is the order that I am supposed to do the following 3 things (getLogger, addHandler, readConfigurations) assuming it has to do with the order and isn't something else? I wasn't able to find many examples of this and the ones I found had the LogManager.readConfiguration after Logger.getLogger, but that doesn't seem to work. Here is the config file: handlers = java.util.logging.FileHandler .level = ALL # Default java.util.logging.FileHandler.limit = 10000000 java.util.logging.FileHandler.count = 10 java.util.logging.FileHandler.append = true java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter java.util.logging.FileHandler.level = FINE EDIT: Here is the part of the code relating to the configuration. String configFilename = "C:\\Users\\dalawh\\Documents\\config.properties"; LogManager manager = LogManager.getLogManager(); String property = manager.getProperty(this.getClass().getPackage().getName()); //DEBUGGING LogManager.getLogManager().readConfiguration(new FileInputStream(configFilename)); String property2 = manager.getProperty(this.getClass().getPackage().getName()); //DEBUGGING Logger logger = java.util.logging.Logger.getLogger(this.getClass().getPackage().getName()); String property3 = manager.getProperty(this.getClass().getPackage().getName()); //DEBUGGING String filename = "C:\\Users\\dalawh\\Documents\\log.log"; this.fileHandler = new FileHandler(filename); this.logger.addHandler(this.fileHandler);
tagged with: logging
linked to: http://stackoverflow.com/q/24909522
score: 2
has title: How to get Logger to use configurations from LogManager.readConfigurations?
tagged with: java

http://stackoverflow.com/comment/42439111
type: Comment
type: QuestionComment
score: 1
has text: Using BOM fixed the similar problem with Spring 4.1.2 and Apache Camel 2.14.0.
comment on: http://stackoverflow.com/q/25991831

http://stackoverflow.com/q/26026433
has comment: http://stackoverflow.com/comment/40767059
score: 1
has comment: http://stackoverflow.com/comment/40766955
tagged with: java
has comment: http://stackoverflow.com/comment/40938070
has comment: http://stackoverflow.com/comment/40766357
has comment: http://stackoverflow.com/comment/40941528
type: Question
has comment: http://stackoverflow.com/comment/40767323
has title: Brief Explanation of my Binary Converter
has answer: http://stackoverflow.com/a/26026923
tagged with: converters
has comment: http://stackoverflow.com/comment/40766416
answer count: 1
has comment: http://stackoverflow.com/comment/40766478
favorite count: 0
has comment: http://stackoverflow.com/comment/40947388
tagged with: binary
upvote count: 2
has comment: http://stackoverflow.com/comment/40942611
has body: I'm still newbie in java I have code but I'm still confused how does it works so Anyone could explain to me how my code works in converting binary to hexadecimal? I'm a little bit confuse on the nested for loop part so please help me to understand the logic here heres my code: import java.io.*; public class arrays { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader( System.in)); // Binary Storage String[] hex = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" }; String[] binary = { "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" }; // For User!, input a value: System.out.print("Input your Hex Number here : "); String userInput = input.readLine(); String result = ""; for (int i = 0; i &lt; userInput.length(); i++) { /* used for separating the value */ char temp = userInput.charAt(i); String temp2 = "" + temp + ""; for (int j = 0; j &lt; hex.length; j++) { if (temp2.equalsIgnoreCase(hex[j])) { result = result + "\n" + temp + "- " + binary[j]; } } } //Main output System.out.println("THE BINARY OF " + userInput + ":" + result); } }
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11408427
downvote count: 1
has comment: http://stackoverflow.com/comment/40767191

http://stackoverflow.com/q/25876679
has comment: http://stackoverflow.com/comment/40502246
has comment: http://stackoverflow.com/comment/40495424
type: Question
has comment: http://stackoverflow.com/comment/40496754
tagged with: distributed
score: -1
has comment: http://stackoverflow.com/comment/40497642
has answer: http://stackoverflow.com/a/25892309
has comment: http://stackoverflow.com/comment/40496120
has title: Making a Tasks Tree
has comment: http://stackoverflow.com/comment/40495623
answer count: 1
tagged with: scheduled-tasks
favorite count: 0
has comment: http://stackoverflow.com/comment/40497089
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/40495857
has comment: http://stackoverflow.com/comment/40497032
tagged with: tree
has comment: http://stackoverflow.com/comment/40495475
has body: Is it possible for me to create a tree of objects in which it's holding Strings. For instance, as shown below T1 | T2 /\ T3 T4 \ / T5 What's the syntax to creating such tree? I'm trying to make it so that each run on sequence,parallel, and nesting order. this is what I've written thus far: public class Tasks { public Node node; public String put(String value, int[] path){ Node current = node; for(int i=0;i&lt;path.length;i++){ if(current.children.get(i)==null){ current.children.add(i, new Node()); } current = current.children.get(i); } String ret = current.value; current.value = value; Tasks myTask = new Tasks(); myTask.node = new Node(); int[] path1 = {0, 0, 0}; myTask.put("T1", path1); System.out.println(myTask.get(path1)); } } public class Node{ public ArrayList&lt;Node&gt; children; public Node parent; public String value; }
tagged with: java

http://stackoverflow.com/a/25991341
type: Answer
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/25990452
downvote count: 1
has body: From the javadoc for create-session. I think your application is creating a sessions and that session is being used. Attribute : create-session Controls the eagerness with which an HTTP session is created by Spring Security classes. If not set, defaults to "ifRequired". If "stateless" is used, this implies that the application guarantees that it will not create a session. This differs from the use of "never" which mans that Spring Security will not create a session, but will make use of one if the application does. Data Type : string Enumerated Values : - ifRequired - always - never - stateless You should try using "stateless" instead of never

http://stackoverflow.com/comment/40737551
has text: @SunilKhokhar - 3 String objects. "sunil" and "khokhar" will be in *String constants pool* and "sunilkhokhar" will be on heap. So, totally 3.
comment on: http://stackoverflow.com/a/26010612
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40692446
comment on: http://stackoverflow.com/q/25985711
score: 1
type: Comment
type: QuestionComment
has text: Well, since painting occurs through `paintComponent`, `paintComponent`... ;)

http://stackoverflow.com/q/26027046
has answer: http://stackoverflow.com/a/26049846
score: -2
has title: Java printing out statement from right to left
answer count: 3
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40767523
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26027204
upvote count: 1
has answer: http://stackoverflow.com/a/26027149
tagged with: eclipse
type: Question
has body: so I've been trying to figure this out but reached no success. So, I am suppose to create a program that prints out following triangle. ********** ********* ******** ******* ****** ***** **** *** ** * And here's my current code. public class PatternC { public static void main(String[] args) { int len = 1; int k; System.out.println("**********"); for (int row = 9; row > len; row--) { for(int i=0; i<row; i++) System.out.print("*"); System.out.println(""); } for (int end = 0; end<1; end++) { System.out.format("%10s", "*"); } } } But the program is printing out this! ********** ********* ******** ******* ****** ***** **** *** ** * I did everything correctly, except I just need to align the middle stars to initially start from right to left. I've already tried print format, but it doesn't work.

http://stackoverflow.com/q/26022116
answer count: 2
has title: Java Tax program help appreciated - sentinel while loop
score: -2
has comment: http://stackoverflow.com/comment/40758174
linked to: http://stackoverflow.com/q/3730019
has body: I am writing a program where I need to input the following: customer Id, their income, federal withholding,state withholding and deductions. However, when I run my program it asks for my customerID and that is it... I am not sure what is incorrect here. // Get first Customer ID { while(customerID != -1) { System.out.print("Enter Customer ID: "); customerID = input.nextInt(); // Get income and withholding information System.out.print("Enter Income: "); income = input.nextDouble(); System.out.print("Enter Federal Taxes Withheld: "); federalwh = input.nextDouble(); System.out.print("Enter State Taxes Withheld: "); statewh = input.nextDouble(); System.out.print("Enter Deductions: "); deduction = input.nextDouble(); } // Get next Customer ID System.out.println("Enter Customer ID: "); customerID = input.nextInt();
favorite count: 0
has comment: http://stackoverflow.com/comment/40759501
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26022191
linked to: http://stackoverflow.com/q/12999899
upvote count: 1
has comment: http://stackoverflow.com/comment/40758036
has answer: http://stackoverflow.com/a/26022202
tagged with: java
downvote count: 3
type: Question

http://stackoverflow.com/comment/40676291
has text: These is the point i want to show some data from an activity to an fragment that will placed on an activity with others fragments so I’m more or less forced to do like that thanks any way !
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25976894

http://stackoverflow.com/comment/40700520
has text: CaretTextArea is sub class of JTextArea.So,no need to write textComponent.getCaret().getBlinkRate().Because I create textArea reference Through the following statement...textArea=new CaretTextArea(); When add your suggested statement it throws an Nullpointer Exception.I didn't understand the Second solution.Please check it once.Thank you for reply.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25989317
score: 0

http://stackoverflow.com/comment/41022471
type: QuestionComment
has text: Also, weirdest almost-`[a-z0-9]` regex ever; h, l, and r are missing. I don't get it. This still bothers me.
comment on: http://stackoverflow.com/q/25997876
score: 0
type: Comment

http://stackoverflow.com/q/25902794
type: UnansweredQuestion
has body: I'm trying to execute the iwlist command using Java's ProcessBuilder but for some reason it would return an empty output, instead of the output I get when I run it in the command line. This is my code so far: ProcessBuilder builder = new ProcessBuilder ("iwlist", "wlan0 scan"); builder.redirectError(); Process process = builder.start(); InputStream stdout = process.getInputStream (); BufferedReader reader = new BufferedReader (new InputStreamReader(stdout)); String line; while ((line = reader.readLine()) != null) { System.out.println ("&gt;&gt; " + line); } But when I run the command in the terminal I get: pi@naath ~ $ sudo iwlist wlan0 scan wlan0 Scan completed : Cell 01 - Address: ... ESSID:"ASDQWE" Protocol:IEEE 802.11bgn Mode:Master Frequency:2.412 GHz (Channel 1) ... UPDATE Oddly, using Runtime I can obtain the expected output as follows: Process p = Runtime.getRuntime().exec("sudo iwlist wlan0 scan"); BufferedReader in = new BufferedReader( new InputStreamReader(p.getInputStream())); String line = null; while ((line = in.readLine()) != null) { System.out.println(line); }
score: 2
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40542577
has comment: http://stackoverflow.com/comment/40542574
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40542714
tagged with: raspberry-pi
has comment: http://stackoverflow.com/comment/40542704
downvote count: 0
has title: Empty output with ProcessBuilder
favorite count: 0
tagged with: processbuilder

http://stackoverflow.com/q/25992567
type: Question
has answer: http://stackoverflow.com/a/25993651
accepted answer: http://stackoverflow.com/a/25993651
score: 0
has body: so I checked out this URL: svn checkout http://android-jhlabs.googlecode.com/svn/trunk/ that has some image filters I would like to use in my project. I made a jar file out of the checked out folder(libs folder, copy/paste the jar, add as library, etc...) However, I cannot access the java files from the inside, just the folder structures EDIT: I use Android Studio :)
tagged with: jar
has title: Importing a .jar into project structure
has answer: http://stackoverflow.com/a/25992612
has answer: http://stackoverflow.com/a/25993147
tagged with: android
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25993147
linked to: http://stackoverflow.com/q/16608135
tagged with: java
has answer: http://stackoverflow.com/a/25992750

http://stackoverflow.com/q/25928123
downvote count: 1
has answer: http://stackoverflow.com/a/25928163
tagged with: java
tagged with: indexoutofboundsexception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25928141
tagged with: arrays
tagged with: initialization
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25928154
tagged with: android
has body: I have a custom class and I create an array from it in a classic fashion. but when I try to access and initialize its individual elements I get the ArrayIndexOutOfBoundsException. In a nutshell the following simple lines create trouble for me in android: Coordinate[] test; test = new Coordinate[]{}; // I still get the error without having this line test[0]= new Coordinate(4,5); I need to initialize my objects in the array in a dynamic way in a for loop. so test = new Coordinate[]{cord1,cord2}; , although it works, will not solve my problem. P.S. I know how to use ArrayList object and I use it in my other parts of the code. But I am somewhat forced to create Coordinates in a classic way. thanks in advance.
has title: java.lang.ArrayIndexOutOfBoundsException when initializing array objects
answer count: 6
has answer: http://stackoverflow.com/a/25928296
has answer: http://stackoverflow.com/a/25928193
score: 0
has answer: http://stackoverflow.com/a/25928203
upvote count: 1

http://stackoverflow.com/q/25894866
upvote count: 0
accepted answer: http://stackoverflow.com/a/25895241
has comment: http://stackoverflow.com/comment/40531542
type: AnsweredQuestion
tagged with: time-complexity
has comment: http://stackoverflow.com/comment/40568693
has title: Time Complexity of this code with BigO Notation
score: -1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25895241
answer count: 1
has body: Can someone help me with time complexity of each section of the below code with for loops and if loops and all together. public class GaleShapley { private int N, engagedCount; private int[][] menPref; private int[][] womenPref; private int[] men; private int[] women; private int[] womenPartner; private boolean[] menEngaged; /** Constructor **/ public GaleShapley(int[] m, int[] w, int[][] mp, int[][] wp) { N = mp.length; engagedCount = 0; men = m; women = w; menPref = mp; womenPref = wp; menEngaged = new boolean[N]; womenPartner = new int[N]; calcMatches(); } /** function to calculate all matches **/ private void calcMatches() { while (engagedCount &lt; N) { int free; for (free = 0; free &lt; N; free++) if (!menEngaged[free]) break; for (int i = 0; i &lt; N &amp;&amp; !menEngaged[free]; i++) { int index = womenIndexOf(menPref[free][i]); if (womenPartner[index] == 0) { womenPartner[index] = men[free]; menEngaged[free] = true; engagedCount++; } else { int currentPartner = womenPartner[index]; if (morePreference(currentPartner, men[free], index)) { womenPartner[index] = men[free]; menEngaged[free] = true; menEngaged[menIndexOf(currentPartner)] = false; } } } } printCouples(); } /** function to check if women prefers new partner over old assigned partner **/ private boolean morePreference(int curPartner, int newPartner, int index) { for (int i = 0; i &lt; N; i++) { if (womenPref[index][i] == newPartner) return true; if (womenPref[index][i] == curPartner) return false; } return false; } /** get men index **/ private int menIndexOf(int str) { for (int i = 0; i &lt; N; i++) if (men[i] == str) return i; return -1; } /** get women index **/ private int womenIndexOf(int str) { for (int i = 0; i &lt; N; i++) if (women[i] == str) return i; return -1; } /** print couples **/ public void printCouples() { System.out.println("Couples are : "); for (int i = 0; i &lt; N; i++) { System.out.println(women[i] + " " + womenPartner[i]); } } /** main function **/ public static void main(Str…
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/40528332

http://stackoverflow.com/q/25956875
answer count: 1
has title: AppWarpS2 WP8 Quiz Tutorial demo connection fail
tagged with: appwarp
score: 0
has answer: http://stackoverflow.com/a/25970065
accepted answer: http://stackoverflow.com/a/25970065
type: AnsweredQuestion
has body: Hi I have several WP8 apps that I want to add turn based functionality as a quiz like app similar to QuizUp using AppWarps2. As a first step I sucessfully installed and setup the chat server app from the tutorial here: http://appwarps2.shephertz.com/dev-center/ All worked O.K. I then downloaded the QuizUp like trivia game from the samples page and have been having trouble getting it started. http://appwarps2.shephertz.com/downloads/download-onpremwarp.php 1) I ran the server as in the previous chat server sample using the server files providec with the quiz game sample using windows_start.bat. (just like the previous sample) 2) Created a java project and imported the file system for the java server folder provided with the trivia game sample and added the .jar file to the build path and ran the program. 3) Logged in to the AppWarp Dashboard and created a zone and room (just like the previous sample) also added room properties IsPrivateRoom = false. (server command window &amp; Eclipse console now displays the zone and room just created) 4) I ran the trivia game sample in VS2013 having changed the global context variables API_KEY = "app key given when created zone in step 3 above", HOST_NAME = "127.0.0.1" and GameRoomId = "id given when I created room in step 3 above" I am always getting connection failed while trying to connect in the game! I'm running the app on the emulator! In onConnectionDone eventObj result type returns 6 (connection error)? I'm obviously new with this and the sample details stop at anything to do with windows phone so I've pieced together bits &amp; pieces I could find! I not sure what I'm doing wrong or not at all here? Am I on the right track? How do I get a connection? Many thanks P.S. I'm also getting the following error in the debugger: System.Windows.Data Error: BindingExpression path error: 'm_FbFriendList' property not found on 'QuizMania.MainPage' 'QuizMania.MainPage' (HashCode=1166200). BindingExpression: Path='m_FbFriendList' DataIt…
tagged with: java
tagged with: windows-phone-8
type: Question
tagged with: c#

http://stackoverflow.com/q/25879313
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/25884923
answer count: 1
type: UnansweredQuestion
has body: I have this code: import java.util.*; import java.io.*; public class LetterPattern{ // value for letter when there is no match public static final char UNRECOGNIZED_LETTER = ' '; // size of pattern array public static final int PATTERN_SIZE = 10; // size of grid array public static final int GRID_SIZE = PATTERN_SIZE + 2; /* To hold the pattern, its features, and the letter it represents. If the pattern does not match any of the letter specifications, then the letter char is a blank. */ int[][] grid; int massbottom, corners, tees; char letter; // default constructor // grid will be created as a 12x12 array of 0's // the integer data members are initialized to 0 // by default already; letter is set to ' ' public LetterPattern() { grid = new int[GRID_SIZE][GRID_SIZE]; letter = UNRECOGNIZED_LETTER; } /* precondition: assumes sc is not null and has a least one more line of text in it. postcondition: grid is loaded with 0's and 1's according to the discussion in the project description based on what remains in the input Scanner sc. YOU HAVE TO CODE THIS. */ public void loadPattern(Scanner sc) { int r = 1; //row number while(sc.hasNextLine()) { //read in line String gridFill = sc.nextLine(); for(int i = 0; i &lt; GRID_SIZE; i++) { if(gridFill.charAt(i) == '*') { grid[r][i] = 1; } else if(gridFill.charAt(i) == '$') { //ignore rest of the line, fill it with 0s for(int k = i; k &lt; GRID_SIZE; k++) { grid[r][k] = 0; } } else { grid[r][i] = 0; } } r++; if( r == 12) { break; } } sc.close(); } /* precondition: assumes the grid array is not null and is a 12x12 array with 0's and 1's. postcondition: the instance specific data members, massbottom, corners, and tees are calculated from the current contents of grid according to the project specification. YOU HAVE TO CODE THIS. */ public void extractFeatures() { //read in row by row, looking for corners and tees, if it is last row, then do massbottom. for(int row = 1; row &lt; PATTERN_SIZE + 1; row++) { for(int column = 1; column &lt;…
has title: How do I get my text file to be read in as a command line argument in Eclipse?
tagged with: text-files
tagged with: command-line
type: Question
tagged with: java

http://stackoverflow.com/comment/40696853
type: AnswerComment
type: Comment
has text: Because this way you are forcing a Chooser no matter what, if you want to hace "always" and "just once" you will need to clean your mobile preferences
comment on: http://stackoverflow.com/a/25987593
score: 0

http://stackoverflow.com/comment/40637782
has text: There are just too many things that can go wrong. Looks like we have removed only some of them. Without your current code, including the code that does the setting and saving, I cannot guess what is going wrong. Please update the question accordingly or create a new one.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25928652
type: Comment

http://stackoverflow.com/q/25886216
type: UnansweredQuestion
has body: I have following row in jsp: &lt;jsp:include page="file.jsp"/&gt; but the file.jsp doesn't exist. In localhost development environment (using jetty) this error is ignored. jsp is displayed correctly displaying whitespace instead of file.jsp. In test server (using jboss) following exception is thrown and the jsp is not displayed at all: Caused by: javax.servlet.ServletException: File &amp;quot;/WEB-INF/file.jsp&amp;quot; not found at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:304) ~[jbossweb-7.0.17.Final-redhat-1.jar!/:?] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) ~[jbossweb-7.0.17.Final-redhat-1.jar!/:?] I guess there's some setting which controls if exception is thrown or not? But where can I set this? I would like to see this exception in dev environment already.
tagged with: java
has title: Setting to display jsp:include error
type: Question
score: 0
has answer: http://stackoverflow.com/a/25886280
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/25918281
has answer: http://stackoverflow.com/a/25918471
tagged with: generics
has answer: http://stackoverflow.com/a/25918488
type: UnansweredQuestion
has body: I have a generic class in my Java program, and the type can either be Double or Integer. I need to write a function that first needs to sort an array of values of the generic type. I am getting the following exception, and I am unsure how to fix it. I would appreciate any help. Exception in thread "main" java.lang.NullPointerException at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:290) at java.util.ComparableTimSort.sort(ComparableTimSort.java:157) at java.util.ComparableTimSort.sort(ComparableTimSort.java:146) at java.util.Arrays.sort(Arrays.java:472) at datastructures.CircularBuffer.getMedian(CircularBuffer.java:98) at test.CircularBufferTests.test4(CircularBufferTests.java:67) at test.CircularBufferTests.main(CircularBufferTests.java:13) Here is my code: public class CircularBuffer&lt;T extends Number&gt; { private T[] array; public CircularBuffer(int n){ array = (T[])new Number[n]; } public double getMedian(int size){ ... Arrays.sort(array); ... } } Thanks!
has comment: http://stackoverflow.com/comment/40589399
tagged with: java
has comment: http://stackoverflow.com/comment/40571071
has title: Sorting a generic array of elements in Java
type: Question
has comment: http://stackoverflow.com/comment/40571256
has comment: http://stackoverflow.com/comment/40571037
tagged with: sorting
has comment: http://stackoverflow.com/comment/40589269
has answer: http://stackoverflow.com/a/25919896
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40571045

named-query
type: Tag
tag name: named-query
tags question: http://stackoverflow.com/q/25905151

http://stackoverflow.com/q/25939710
has title: Java design issues with enums
score: 0
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25940188
has body: I have a class which has different variables , and User defined Enum is also one of them. This Class basially represents the data in a table. eg) Class A { private String x; private String y; private UserEnum z; .... .. private UserEnum getField() { .... } private void addRow() { // uses the UserEnum here .... } } I have an other class (CLASS B) which does the same functionality as the class A(has the same methods and fields) except that I have a different user defined enum (eg. UserEnum2). Both these Enums has different set of constants. What would be the good design to avoid the duplicate code which exists in both these classes. I am new to Enums and I am not sure how we can really generalize the above mentioned two classes(CLASS A and CLASS B) which has different Enums.
has answer: http://stackoverflow.com/a/25939797
tagged with: java
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/25939790

spring-jdbc
tags question: http://stackoverflow.com/q/25988396
tags question: http://stackoverflow.com/q/25944644
type: Tag
tag name: spring-jdbc

http://stackoverflow.com/comment/40732108
has text: hows that not correct?
comment on: http://stackoverflow.com/q/26007635
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40930402
type: Comment
type: QuestionComment
has text: Are there any exceptions or does it just 'not work'?
comment on: http://stackoverflow.com/q/26021336
score: 0

http://stackoverflow.com/comment/40609026
score: 0
has text: You would have to define them in the ActivationGroup in your setup program.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25906942

http://stackoverflow.com/a/25894449
score: 0
has body: Yeah, I am following the conversation. I am just a bit frustrated, because I can't really write any interesting or practical java programs (yet), because my knowledge isn't that big yet. First I tried to find out, if there was a way to add elements to array, because arrays seemed to me very useful, because each element of an array already has an address. I googled, and it seems that is not possible. I might be able to use the idea with the list, but it seems to be that the length of the list has to have a limit and actually I wanted to avoid that.
type: Answer
answers question: http://stackoverflow.com/q/25893705

http://stackoverflow.com/q/26005340
has comment: http://stackoverflow.com/comment/40727988
has comment: http://stackoverflow.com/comment/40865480
tagged with: inetaddress
tagged with: multicastsocket
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40880378
type: Question
tagged with: multicast
score: 0
tagged with: network-programming
tagged with: java
has title: Multicast Chating, to get sender's login/pc name in host/listener's GUI
has comment: http://stackoverflow.com/comment/40865508
has body: Help me guys, i was able to get the IP addres of sender in host/listener system, how to get sender's name, i think it should be "packet.getHostName(string ip-address)", where packet is reference of the packet received by the listener from sender. I was able to get sender's IP by "packet.getAddress()". below is the code: al=new ArrayList(); al1=new ArrayList(); try{ InetAddress nn = InetAddress.getByName("ALL-SYSTEMS.MCAST.NET"); int pn = Integer.parseInt( "4000" ); MulticastSocket socket = new MulticastSocket(pn); DatagramPacket packet = new DatagramPacket(new byte[128], 128); socket.joinGroup(nn); System.out.println( "waiting for a packet from "+nn+"..."); socket.receive(packet); GUI.setTextArea(new String(packet.getData())); if(!al.contains(packet.getAddress())) { al.add(packet.getAddress()); al1.add(packet.getAllByName(new String(packet.getAddress))); } else if("EXIT".equals(new String(packet.getData()))) { al.remove(packet.getAddress()); al1.remove(packet.getAllByName(new String(packet.getAddress))); } GUI.clearLoginArea(); //for(int j=0;j&lt;al1.size();j++){ for(int i=0;i&lt;al.size();i++){ GUI.setLoginArea(al.get(i)+""); } // GUI.setLoginArea(al1.get(j)+""); //} socket.leaveGroup(nn); socket.close(); } catch (IOException e) { System.err.println(e.getMessage()); }

http://stackoverflow.com/comment/40551995
type: Comment
comment on: http://stackoverflow.com/a/25907644
type: AnswerComment
score: 0
has text: What do you mean by **Class.forName("com.mysql.jdbc.Driver").newInstance(); will at runtime try to load the class** The new operator in java will also load classes at runtime. So whats the basic difference ,, Sorry i didn't get this properly, please elaborate this point.

http://stackoverflow.com/comment/40524080
has text: this `for(int i = 0; i < 12; i++)` a little inconvenient :(, anyway I will do this for now
type: Comment
comment on: http://stackoverflow.com/a/25892162
score: 1
type: AnswerComment

http://stackoverflow.com/a/25954556
has comment: http://stackoverflow.com/comment/40634600
has comment: http://stackoverflow.com/comment/40634789
score: 1
has comment: http://stackoverflow.com/comment/40634821
has comment: http://stackoverflow.com/comment/40634699
downvote count: 0
has comment: http://stackoverflow.com/comment/40634761
has body: public class Alternator{ public static String alternate(String a, String b){ String s = ""; int i = 0; while (i &lt; a.length() &amp;&amp; i &lt; b.length()){ s += a.charAt(i) +""+ b.charAt(i); i++; } while (i &lt; a.length() ){ s += a.charAt(i); i++; } while (i &lt; b.length()){ s += b.charAt(i); i++; } return s; } public static void main(String[] args){ String a = "two", b = "one"; String s = Alternator.alternate(a,b); System.out.println(s); } } To use for loop instead of while loop, simply remove all while lines with for lines like the following, then remove the i++ line from each while loop for(; i &lt; a.length() &amp;&amp; i &lt; b.length(); i++){ //the inside of the loop MINUS THE LINE i++ } for(; i &lt; a.length(); i++){ //the inside of the loop MINUS THE LINE i++ } for(; i &lt; b.length(); i++){ //the inside of the loop MINUS THE LINE i++ }
answers question: http://stackoverflow.com/q/25954495
has comment: http://stackoverflow.com/comment/40634710
has comment: http://stackoverflow.com/comment/40634646
type: Answer
has comment: http://stackoverflow.com/comment/40634652
has comment: http://stackoverflow.com/comment/40634713
has comment: http://stackoverflow.com/comment/40634832
upvote count: 1
has comment: http://stackoverflow.com/comment/40634751
has comment: http://stackoverflow.com/comment/40634621
has comment: http://stackoverflow.com/comment/40634800
has comment: http://stackoverflow.com/comment/40634847

http://stackoverflow.com/comment/40570679
has text: @2h2h2h: No, it doesn't -- read up on overriding and overloading.
comment on: http://stackoverflow.com/q/25918067
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25919108
type: Question
has title: JMS 1.1: Load sharing client side for Point-to-Point mode
answer count: 1
downvote count: 0
tagged with: jms
favorite count: 0
has answer: http://stackoverflow.com/a/25957917
tagged with: tibco-ems
has body: The legacy system with JMS 1.1 (TibcoJms 4.4.1) I am working on has a JMS queue (not topic) established on the server side, which is meant for PTP mode of communication. Message item will be constantly put onto the queue by the server. What I want to achieve on the is to poll these data by multiple threads on the client side. Each thread should deal with Messages with a particular attribute value. One way I could do this I guess is to implement a MessageListener listening on that queue which acts as a 'switch' to distribute (PUSH) the message received to each thread on the client side to process. OR I can implement a MessageListener listening on that queue on the server and put received msg on a new queue on the client and each thread will POLL against the client side queue. Either way, I think I will need to use an extra set of data structure on the client side shared among the threads. My question is about whether there is a more direct approach involving direct communication between the client side processor thread and that queue on the server, kind of similar to multiple subscribers to a topic (although each subscriber does not actually 'share the load' but rather gets the same load. it is acceptable for my purpose). Is there some good common practise anyone can suggest in this situation?
upvote count: 1
accepted answer: http://stackoverflow.com/a/25957917
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: concurrency

http://stackoverflow.com/q/25948604
favorite count: 0
tagged with: spring
has body: Getting error while trying to test while running RestAssuredMockMvc and Spring: INFO - Mapped "{[/mysql/hello],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String ee.t.mysql.controllers.testController.printHello() INFO - HV000001: Hibernate Validator 5.1.2.Final INFO - Looking for @ControllerAdvice: org.springframework.test.web.servlet.setup.StubWebApplicationContext@4d7cca20 INFO - Initializing Spring FrameworkServlet '' INFO - FrameworkServlet '': initialization started INFO - FrameworkServlet '': initialization completed in 6 ms java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1066) UPDATE: fixed by changing version to 3.x: javax.servlet javax.servlet-api 3.1.0
has answer: http://stackoverflow.com/a/25949010
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25949010
tagged with: unit-testing
type: Question
tagged with: testing
has title: Spring Mock mvc rest-assured test fails to get status
score: 4
upvote count: 4
tagged with: rest-assured
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/54915760
score: 0
type: Comment
has text: In case it's helpful to anyone else finding this like I have - at the time of writing, the Javadocs linked above include an 8th option: "Model as an alternative to returning a model map from the handler method. Note that the provided model is not pre-populated with regular model attributes and therefore always empty, as a convenience for preparing the model for an exception-specific view". This fairly obviously conflicts with the blog post linked in freakman's answer, which as far as I can tell from experimenting, is correct, and the Javadocs are wrong. Thanks Spring :)
type: AnswerComment
comment on: http://stackoverflow.com/a/25967752

http://stackoverflow.com/comment/40618936
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25944816
has text: what do you have in bin ? what do you have in parent folder? as @Pshemo said you may have installed jre and not jdk,

http://stackoverflow.com/comment/40652203
score: 1
has text: Converting decimal degrees coords to kilometers is not constant, I suggest using JTS to perform a buffer operation, or store your data in something like PostGIS so you can store it as geometry and perform spatial queries... depending on your goal
type: QuestionComment
comment on: http://stackoverflow.com/q/25964019
type: Comment

http://stackoverflow.com/comment/40736391
type: QuestionComment
has text: What do you think would happen? How do you think the compiler and the string pool would be different? Have you considered what difference using `final` might make?
score: 1
comment on: http://stackoverflow.com/q/26010216
type: Comment

http://stackoverflow.com/q/25928628
favorite count: 0
possible better answer: http://stackoverflow.com/a/26003961
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25928864
has title: Liquibase - checksum differs with different database vendors
upvote count: 3
tagged with: java
tagged with: mysql
tagged with: liquibase
tagged with: sql-server
has answer: http://stackoverflow.com/a/25928864
has answer: http://stackoverflow.com/a/26003961
type: AnsweredQuestion
tagged with: sql
score: 3
downvote count: 0
has body: I have a problem with Liquibase checksum when I try to run it on MSSQL and MySQL. In my MSSQL-base I have a changelog-entry with this checksum: 3:cf2f5de7a1dcc738bbc185e25fbcf6c9 When I run my liquibase against this database, it works just fine. Then, I copy the changelog-entry to my MySQL-database and try to run, and get this error: myLiquibase.xml::1::Tobb is now: 3:cedf7a8ba54ea3f83141f79 I have tried setting the checksum to null in my MSSQL in order to regenerate the checksum, and the checksum reverts back to 3:cf2f5de7a1dcc738bbc185e25fbcf6c9 When doing the same in MySQL, i get this checksum: 3:cedf7a8ba54ea3f83141f7987007deb7 So, from what I can see, depending on whether it's run in MSSQL or MySQL, Liquibase generates a different checksum. How can this happen? I thought the checksum was only dependant on the actual content of the liquibase-script?

http://stackoverflow.com/a/25881674
has body: You can reload it again by setting the listener: mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, newDrawable, R.string.app_name, newDrawable) { public void onDrawerClosed(View drawerView) { }; public void onDrawerOpened(View drawerView) { }; }; mDrawerLayout.setDrawerListener(mDrawerToggle); mDrawerToggle.syncState();
accepted answer of: http://stackoverflow.com/q/25881555
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25881555
has comment: http://stackoverflow.com/comment/40504633
downvote count: 0
has comment: http://stackoverflow.com/comment/42381773
score: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/40690345
score: 0
type: Comment
has text: The `x` and `y` attribute of one class does not affect the other, and that example s doing animation wrongly. If that is what the book is teaching, it's time to find a new book.
type: QuestionComment
comment on: http://stackoverflow.com/q/25984671

http://stackoverflow.com/comment/40751869
comment on: http://stackoverflow.com/q/26016116
has text: what kind of cascade did you load to `face_cascade1`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25973919
accepted answer: http://stackoverflow.com/a/26039897
tagged with: java
linked to: http://stackoverflow.com/q/18667061
type: Question
upvote count: 4
has body: Where should i drop my custom configured WIX installer configuration file and how to configured javafx packger tool in maven based java fx project using antrun plugin? I successfully have made basic MSI installer using default package resource and it is working fine. Now i have configured installers WXS files as fxpackager underlying is using wix toolset when creating MSI. using this Customizing MSI installer and this How to set custom icon for javafx native package icon on Windows i have manages to add Icon. but deploy task is not picking custom configuration file i.e WXS I had also read official guide http://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html my project structure looks like this You can see i have added on both locations i.e under java-client/package/windows/. and i also added in src/main/deploy/package/windows/. as mentioned on linked questions. but both ways are not working with my maven ant plugin. my mind is exploding. From Oracle documentation they states " Packaging tools look for customized resources on the class path before reverting to built-in resources. The Java Packager has "." (the current working directory) added to the class path by default. Therefore, to replace the application icon, copy your custom icon to ./package/macosx/DemoApp.icns in the directory from which javapackager is run (typically, the root project directory)." i also tried to add ${basedir} to ant class-path look at My build part of pom org.apache.maven.plugins maven-compiler-plugin 3.1 ${maven.compiler.source} ${maven.compiler.target} maven-surefire-plugin 2.9 **/*Test.class maven-jar-plugin 2.3.1 default-jar none maven-antrun-plugin 1.7 create-temp-jar prepare-package run <taskdef uri="javafx:com.sun.javafx.tools.ant" resource="com/sun/javafx/tools/ant/antlib.xml" classpath="maven.plugin.classpath" /> <fx:jar destfile="${project.build.directory}/${project.build.finalName}-temp"> <fx:application id="fxApp" name="${project.name}" main…
tagged with: ant
linked to: http://stackoverflow.com/q/15880102
downvote count: 0
score: 4
tagged with: oracle-database
answer count: 1
favorite count: 0
tagged with: javafx-2
tagged with: maven
has title: where should i put installer resources (wxs file,dmg-script,icon) and how to configure maven antrun when deploying self contained app
has answer: http://stackoverflow.com/a/26039897
type: AnsweredQuestion

http://stackoverflow.com/a/26032567
has body: The best way to get out of a while loop (other than using the control conditions carefully), is to use a break statement. System.exit(0) will shut down the Java Virtual Machine and return the status code 0 back to the operating system. That's a little drastic. And status code 0 is conventionally used to indicate success: so your return value is idiosyncratic. That all said, your immediate problem is a typographical one, drop ! from the if: if (line.equals("0")){
downvote count: 0
answers question: http://stackoverflow.com/q/26032461
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/25992718
has title: Having Trouble Fetching String & Int from Textbox, using Java Swing methods
has body: I am trying to create a panel for input of the details (student#,student name, unit #, and price per unit) to be put into .txt file with the student # as the filename. My current issue is that I cannot seem to fetch the values using getText() and parseInt as seen below. It is reaching the methods when tried with System.out lines edit managed to get the values to reach the variables, now the writer is my current issue, as it doesn't seem to want to write.. Here is what I've done so far: package javaSwing; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class StudentRegistration extends JFrame{ static String studentName; static String studentNumber ; static int units ; static int unitcost; static int total; public StudentRegistration(){ initUI(); } private void initUI(){ setTitle("Student Registration"); setSize(500,400); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setLayout(null); add(panel); JLabel titleLabel = new JLabel("Register Student"); titleLabel.setFont(new Font("Calibri",Font.BOLD,30)); JLabel numberLabel = new JLabel("Student No."); numberLabel.setFont(new Font("Calibri",Font.BOLD,20)); JLabel nameLabel = new JLabel("Student Name."); nameLabel.setFont(new Font("Calibri",Font.BOLD,20)); JLabel unitsEn = new JLabel("Units Enrolled:"); unitsEn.setFont(new Font("Calibri",Font.BOLD,20)); JLabel unitCost = new JLabel("Per Unit Fee"); unitCost.setFont(new Font("Calibri",Font.BOLD,20)); JTextField numberText = new JTextField(30); numberText.setFont(new Font("Calibri",Font.BOLD,20)); JTextField nameText = new JTextField(30); nameText.setFont(new Font("Calibri",Font.BOLD,20)); JTextField unitsText = new JTe…
tagged with: swing
has comment: http://stackoverflow.com/comment/40706887
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25993596
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25993596
score: 0
has answer: http://stackoverflow.com/a/25992868
possible better answer: http://stackoverflow.com/a/25992868

http://stackoverflow.com/comment/40553905
type: Comment
type: QuestionComment
has text: Surely..I will keep that in mind.
comment on: http://stackoverflow.com/q/25907932
score: 0

http://stackoverflow.com/comment/41345254
score: 0
type: QuestionComment
type: Comment
has text: have you solved this issue? if yes, how did you solve it?
comment on: http://stackoverflow.com/q/25886641

http://stackoverflow.com/comment/40571367
type: AnswerComment
comment on: http://stackoverflow.com/a/25918262
has text: Okay, reading the code took a while for me to process it. Let me change my code now
type: Comment
score: 0

http://stackoverflow.com/a/25987409
has comment: http://stackoverflow.com/comment/40717641
score: 1
has body: The answer by Chris Bregg provides correct information, that OutOfMemoryError is thrown when you ask for some memory to get allocated but JVM doesn't have that much memory available thus it throws OutOfMemoryError. Moreover the OutOfMemoryError occurs due to request of block memory allocation by application that cannot be fulfilled with the remaining memory in the heap. The only one thing that comes in my mind, where it can come handy is when you want to close the application gracefully while logging the information (that can come handy when such thing occurs at client side and helps the developer to get the information to fix such issues) and releasing all the resources nicely. EDIT A small example to demonstrate OutOfMemoryError exception due to request by app asking for the block of memory that can be satisfied due to heap size, package deepakTest; public class App { public static void main( String[] args ) { int arrySize = Integer.MAX_VALUE; int[] intArray; while (true) { try { intArray = new int[arrySize]; break; } catch (OutOfMemoryError e) { System.out.println("OutOfMemoryError while trying to allocate the array with size " + arrySize); arrySize--; } } System.out.println("Sucessfully allocated the array with size " + arrySize); } }
answers question: http://stackoverflow.com/q/25986750
downvote count: 0
has comment: http://stackoverflow.com/comment/40701113
type: Answer
has comment: http://stackoverflow.com/comment/40703679
upvote count: 1

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/25994424

http://stackoverflow.com/q/25955979
has answer: http://stackoverflow.com/a/25971558
has title: Many JIDs to one user on XMPP
downvote count: 1
accepted answer: http://stackoverflow.com/a/25971558
type: AnsweredQuestion
tagged with: java
tagged with: openfire
score: -1
tagged with: chat
type: Question
upvote count: 0
favorite count: 0
has body: Is it possible to have many JIDs associated with one user. For example application installed on many devices which opened by the same user. When message is to be sent to the user all of the devices will receive it.
tagged with: xmpp
answer count: 1

http://stackoverflow.com/comment/40549755
comment on: http://stackoverflow.com/a/25906884
type: AnswerComment
has text: There are a lot of mechanisms for creating primary keys: part of them are implemented in db itself
score: 0
type: Comment

http://stackoverflow.com/comment/40810185
has text: You don't need the `.toString()` part. That will happen automatically.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26023694

http://stackoverflow.com/comment/40641475
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25958255
has text: And how do you obtain these array of ints? I thought you start with a number and not with an array of numbers ranging vom 0 to 61.

http://stackoverflow.com/comment/40721869
type: QuestionComment
comment on: http://stackoverflow.com/q/26000153
has text: you could try to `mark` the entity inputstream, and then reset it, but I am not sure it is actually markable
score: 0
type: Comment

http://stackoverflow.com/q/25932730
has body: Consider the following Code : import java.util.*; class Employee { String name; public Employee(String nm) { this.name=nm; } } public class HashMapKeyNullValue { Employee e1; public void display(){ Employee e2=null; Map map=new HashMap(); map.put(e2, "25"); System.out.println("Getting the Value When e2 is set as KEY"); System.out.println("e2 : "+map.get(e2)); System.out.println("e1 : "+map.get(e1)); System.out.println("null : "+map.get(null)); map.put(e1, ""); System.out.println("Getting the Value when e1 is set as KEY"); System.out.println("e2 : "+map.get(e2)); System.out.println("e1 : "+map.get(e1)); System.out.println("null : "+map.get(null)); map.put(null, null); // null as key and null as value System.out.println("Getting the Value when setting null as KEY and null as value"); System.out.println("e2 : "+map.get(e2)); System.out.println("e1 : "+map.get(e1)); System.out.println("null : "+map.get(null)); map.put(null, "30"); System.out.println("Getting the Value when setting only null as KEY"); System.out.println("e2 : "+map.get(e2)); System.out.println("e1 : "+map.get(e1)); System.out.println("null : "+map.get(null)); } public static void main(String[] args) { new HashMapKeyNullValue().display(); } } The Output of program is : Getting the Value When e2 is set as KEY e2 : 25 e1 : 25 null : 25 Getting the Value when e1 is set as KEY e2 : e1 : null : Getting the Value when setting null as KEY and null as value e2 : null e1 : null null : null Getting the Value when setting only null as KEY e2 : 30 e1 : 30 null : 30 Here how e1, e2, and null as keys are related to each other. Are all three assigned to same hashcode? If yes, WHY? Since all three look different, the change in one value changes the other. Does it mean, only one entry for key is being made into HashMap either e1, e2 or null? Because all are treated to be same key.
has answer: http://stackoverflow.com/a/25932827
tagged with: collections
type: AnsweredQuestion
tagged with: hashmap
has comment: http://stackoverflow.com/comment/40596984
tagged with: hashcode
has title: HashMap with Null Key and Null Value
tagged with: java
downvote count: 3
score: 44
has answer: http://stackoverflow.com/a/25933619
type: Question
has answer: http://stackoverflow.com/a/41980258
tagged with: null
has answer: http://stackoverflow.com/a/25932793
linked to: http://stackoverflow.com/q/25697609
answer count: 6
has comment: http://stackoverflow.com/comment/40597060
has answer: http://stackoverflow.com/a/77816235
upvote count: 47
possible better answer: http://stackoverflow.com/a/25932862
accepted answer: http://stackoverflow.com/a/25933619
has answer: http://stackoverflow.com/a/25932862
favorite count: 0

http://stackoverflow.com/comment/40713781
score: 0
comment on: http://stackoverflow.com/a/25997612
type: AnswerComment
has text: I can't make the radio button is selected
type: Comment

http://stackoverflow.com/comment/40693450
has text: I think the reason of the exceptions appeared maybe comes from the mongodb itself.
comment on: http://stackoverflow.com/a/25986398
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25983775
has body: I created a HashMap where each key contains an ArrayList as a value. I'm having trouble understanding how to fetch the ArrayList associated with a key and get all the values stored in it. See below the error I am getting when running the program. import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Scanner; public class Flights { private HashMap&lt;String, ArrayList&lt;String&gt;&gt; flights = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;(); private void readFlights(String filename) { try { BufferedReader bf = new BufferedReader(new FileReader(filename)); while (true) { String line = bf.readLine(); if (line == null) { break; } if (!line.isEmpty()) { String fromCity = line.substring(0, line.indexOf("-")); String toCity = line.substring(line.indexOf("&gt;") + 2); ArrayList&lt;String&gt; city = flights.get(fromCity); if (city != null) { city.add(toCity); } else { ArrayList&lt;String&gt; destinations = new ArrayList&lt;String&gt;(); destinations.add(toCity); flights.put(fromCity, destinations); } } } bf.close(); } catch (IOException e) { e.printStackTrace(); } } private void printCities() { Iterator&lt;String&gt; fi = flights.keySet().iterator(); while (fi.hasNext()) { String next = fi.next(); System.out.println(next + "-&gt; "+ flights.get(next)); } } @SuppressWarnings("resource") private void printWelcome() { System.out .println("Welcome to the flight planner.\nHere is a list of all of our cities:"); printCities(); System.out.print("Enter the starting city."); Scanner in = new Scanner(System.in); String input = in.nextLine(); System.out.println("from " + input + " you can fly directly to:"); printAvailableFlights(input); } private void printAvailableFlights(String city) { ArrayList&lt;String&gt; origin = flights.get(city); for (String cities: origin) { System.out.println(cities); } } public static void main(String[] args) { Flights f …
has comment: http://stackoverflow.com/comment/40689239
accepted answer: http://stackoverflow.com/a/25984190
has comment: http://stackoverflow.com/comment/40688655
has title: HashMap - getting all the values associated with a key
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40689067
has comment: http://stackoverflow.com/comment/40688719
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40688619
downvote count: 2
has comment: http://stackoverflow.com/comment/40688572
has comment: http://stackoverflow.com/comment/40688612
type: Question
has comment: http://stackoverflow.com/comment/40688927
has comment: http://stackoverflow.com/comment/40688734
tagged with: hashmap
has comment: http://stackoverflow.com/comment/40688614
has comment: http://stackoverflow.com/comment/40688597
has comment: http://stackoverflow.com/comment/40688550
has answer: http://stackoverflow.com/a/25984190
has comment: http://stackoverflow.com/comment/40688633
score: 0
has comment: http://stackoverflow.com/comment/40688897
has comment: http://stackoverflow.com/comment/40688580
answer count: 1
has comment: http://stackoverflow.com/comment/40688566
has comment: http://stackoverflow.com/comment/40688630
favorite count: 0
has comment: http://stackoverflow.com/comment/40688852

http://stackoverflow.com/comment/40551727
type: Comment
has text: it should go in code.stackexchange
comment on: http://stackoverflow.com/q/25907932
score: 0
type: QuestionComment

http://stackoverflow.com/a/33732500
has body: In my case , I added to login page. setInterval(function(){ location.reload(true); //reload each 5 minutes },5*60*1000); Hope this help.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25933560
answers question: http://stackoverflow.com/q/25933560
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/55276316

http://stackoverflow.com/q/26011148
linked to: http://stackoverflow.com/q/15787245
upvote count: 2
has comment: http://stackoverflow.com/comment/40739812
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/40739552
duplicate of: http://stackoverflow.com/q/15787245
tagged with: java
tagged with: javafx
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/40742514
has comment: http://stackoverflow.com/comment/40739164
has body: I have created application in JavaFX which interact with smartcards (via class sun.security.pkcs11.SunPKCS11 located at jre/lib/ext/sunpkcs11.jar). The program runs and works well when maven jfx:run goal (of javafx-maven-plugin plugin) is executed. Unfortunately after creating jar archive (using jfx:jar goal) and running the result jar. Application throws an exception at startup: Caused by: java.lang.ClassNotFoundException: sun.security.pkcs11.SunPKCS11 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:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 12 more I have found simple workaround for this problem by installing sunpkcs11.jar locally to maven and adding dependency in project pom file. Such solution is, as I mentioned, "workaround" and looks ugly. Why application cannot find library which is one of the "standard" ones? Is JavaFX jar using custom classloader which does not see this library? Even when I create native bundle (.exe in my case) with its own JRE it cannot see that class. update The is not a duplicate of question linked in comment, I have 32 bit JDK and JRE. JAVA_HOME also points to 32bit JRE.
has comment: http://stackoverflow.com/comment/40738637
has comment: http://stackoverflow.com/comment/40738281
has comment: http://stackoverflow.com/comment/40738508
has comment: http://stackoverflow.com/comment/40740965
has answer: http://stackoverflow.com/a/26013314
score: 2
has title: Library from jre\lib\ext not found on the classpath
answer count: 1
downvote count: 0
tagged with: shared-libraries
favorite count: 0
has comment: http://stackoverflow.com/comment/40738545

http://stackoverflow.com/a/25934059
has body: Your Strings will be sorted as Strings in natural order, and not as numbers. So, "11" comes after "10" and "2" will come after "11111111110". What to do?. Use Integer.parseInt() to parse each String value in the set as integer, then add them to a set and call Collections.sort().
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25933919

http://stackoverflow.com/comment/40555971
comment on: http://stackoverflow.com/q/25909606
score: 0
has text: @HareshChhelana i checked it and even i cannot get the age_range which included in public_profile
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40546822
type: AnswerComment
type: Comment
has text: how would profiles help with getting a deploy menu item in eclipse?
comment on: http://stackoverflow.com/a/25905116
score: 0

http://stackoverflow.com/comment/86345344
score: 0
comment on: http://stackoverflow.com/q/25973463
has text: The book mainly said that JavaBeans is not thread-safe while you create the instance. It also suggested that you put optional (not primary) properties' initialization process to Builder. The other thing is, you should test your code before put it here.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40589399
score: 0
comment on: http://stackoverflow.com/q/25918281
has text: You are right Boris, sorry for the misleading comment
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25904053
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25903972
upvote count: 2
has comment: http://stackoverflow.com/comment/40546503
has comment: http://stackoverflow.com/comment/40546237
answers question: http://stackoverflow.com/q/25903972
has comment: http://stackoverflow.com/comment/40559082
type: AcceptedAnswer
downvote count: 0
has body: Lisp uses prefix notation because things that are usually operators (ie +, -, >) in other languages are considered functions in Lisp. (+ 1 1) in Lisp is equivalent to 1 + 1; in Java. You could think of it as calling an add function with 1 and 1 as arguments: add(1, 1) It just takes some getting used to. So (&gt; 2 (length l)) is equivalent to to 2 &gt; length(l) The ' in '(1) tells Lisp to treat what follows as a literal. So instead of Lisp looking for a function called 1 (which is what would happen without the backtick) it returns a list containing 1 as an element. An equivalent way of saying that in Lisp is (quote (1)) which returns the literal list containing 1.

http://stackoverflow.com/comment/40718261
comment on: http://stackoverflow.com/q/26000017
has text: @Holger sorry, I'm new to Java 8's way of doing lambdas and all this jargon is foreign to me. I couldn't make heads or tails of the other question's answer and I couldn't think of another way to get a direct solution/explanation of my problem than to just make another question
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40536606
has text: Do you have documents in the product collection whose id type is integer? `db.product.find({"_id" : {$type : 16}})`
score: 0
comment on: http://stackoverflow.com/q/25897722
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40634562
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25954521
has text: Are you telling me it's bad because I use Thread.sleep() IN an infinite loop, or because I shouldn't use infinite loops and Thread.sleep() in any context?

http://stackoverflow.com/comment/40577348
type: QuestionComment
comment on: http://stackoverflow.com/q/25921475
has text: Because your BadRequestException has been wrapped inside another exception maybe ?
score: 0
type: Comment

http://stackoverflow.com/a/25992338
has comment: http://stackoverflow.com/comment/40704136
has body: You just need to change your point cut to something like this : @Pointcut("within(com.abc.*)") Further reading - https://docs.spring.io/spring/docs/2.0.x/reference/aop.html
type: Answer
answers question: http://stackoverflow.com/q/25992277
score: 11
downvote count: 0
has comment: http://stackoverflow.com/comment/40703760
upvote count: 11
has comment: http://stackoverflow.com/comment/40707336
has comment: http://stackoverflow.com/comment/40704259

http://stackoverflow.com/a/25898925
answers question: http://stackoverflow.com/q/25898841
upvote count: 1
has comment: http://stackoverflow.com/comment/40536973
downvote count: 0
has body: The tokens need to be trimmed, i.e. whitespace after the comma should be removed when a token is read by the scanner: while(lineScanner.hasNext()){ String currentToken = lineScanner.next(); currentToken = currentToken.trim(); // line to add if (this.wordToReplace.contains(currentToken)){ bufferedFileWriter.write("xxx, "); } else { bufferedFileWriter.write(currentToken + ", "); } } You can also do this by updating the delimiter pattern of the Scanner as suggested by Marko Topolnik in the comments. lineScanner = new Scanner(currentLine); lineScanner.useDelimiter("\\s*,\\s*"); \\s* means zero or more whitespace characters.
has comment: http://stackoverflow.com/comment/40536775
has comment: http://stackoverflow.com/comment/40536485
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40536858
type: Answer
has comment: http://stackoverflow.com/comment/40536988
accepted answer of: http://stackoverflow.com/q/25898841
score: 1

http://stackoverflow.com/q/25978597
type: AnsweredQuestion
tagged with: java
tagged with: matlab-java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25993954
favorite count: 0
has title: MATLAB : access uigetdir's internal java methods
tagged with: matlab
upvote count: 2
score: 1
accepted answer: http://stackoverflow.com/a/25993954
downvote count: 1
has body: When using the standard dir dialog box from MATLAB uigetdir, double-clicking on a directory leads to the dialog box entering it and displaying its contents. To actually select it, you have to click on the "select directory" button. What I would like is a way to add specific rules on what to do when double-clicking on a directory : basically, I would like to change/override the internal 'method/callback' associated to this action. Problem is, said dialog box is NOT your usual Matlab figure - that I would know how to do easily (retrieve the handle, look at properties and edit/modify the corresponding callback). This looks like a raw Java object and I find no way to access this information from Matlab. Thanks for your help.

http://stackoverflow.com/comment/40765862
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26019770
type: Comment
has text: Mostly, I was just looking to see if there were 'known' issues I hadn't heard of, but I'll edit in some code. Unfortunately, it won't be verifiable, since I don't have access to the client's laptop. Thanks also for the re-direct - I'll post there as well.

http://stackoverflow.com/q/25944608
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40618542
tagged with: java
accepted answer: http://stackoverflow.com/a/25944615
type: Question
has title: Array NullPointerException?
has comment: http://stackoverflow.com/comment/61322814
has body: Ok. I don't get why my code is reporting a NullPointerException, but I've been here for quite a while trying to figure it out. And no, files is not null. Edit: That was a mistake on my part, it was null (I didn't see the order I was running the functions. Here is my code: public String[] files; private void updateRefs(String filepath) { try { scr++; files[scr] = filepath; //NullPointerException??? } catch ( Exception e ) { e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/25944615
tagged with: arrays
has comment: http://stackoverflow.com/comment/40618546
has comment: http://stackoverflow.com/comment/40618593
has comment: http://stackoverflow.com/comment/40618544
has comment: http://stackoverflow.com/comment/40618547
score: 0
tagged with: nullpointerexception
tagged with: exception
upvote count: 1
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/218384
favorite count: 0
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/40618569

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/25977149

http://stackoverflow.com/a/26009394
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40759913
downvote count: 1
has comment: http://stackoverflow.com/comment/40783840
has body: try Clean operation on your project and then build your project. replay whether it solves the issue or not.
answers question: http://stackoverflow.com/q/26009284
upvote count: 2

http://stackoverflow.com/q/25926718
answer count: 1
score: -1
has body: I'm hoping someone could help me understand my code probs. I'm trying to create a Reversi board game in Java but my game board will only stick to white pieces and refuse to do anything. Any suggestions would be great. This is the part I have to do (hence marked TO DO). Honestly it should be 1 or 2 lines for each of them but I'm just not catching on. I'm definitely having trouble with my get() and flip() methods. public class Simple2DArray implements Simple2DInterface { // TO DO: Your instance variables private int[][] simpleArray = new int[8][8]; private int row = simpleArray.length; private int column = simpleArray[0].length; private int none = -1, white = 1, black = 0, value; /** * Constructor: Once a two dimensional array is constructed * set all elements in the array to -1. * @param aRow the number of rows of this Simple2DArray. * @param aColumn the number of columns of this Simple2DArray. */ public Simple2DArray(int aRow, int aColumn) { // TO DO: Constructor this.row = aRow; this.column = aColumn; for (int i = 1; i &lt; simpleArray.length; i++) { for (int j = 1; j &lt; simpleArray[i].length; j++) { simpleArray[i][j] = none; } } } /** * Gets the number of rows of this Simple 2D Array. * @return the number of rows of this Simple 2D array. */ public int getNumberOfRows() { // TO DO return simpleArray.length; } /** * Gets the number of columns of this Simple 2D Array. * @return the number of columns of this Simple 2D array. */ public int getNumberOfColumns() { // TO DO return simpleArray[1].length; } /** * Reset every element to -1 */ public void clear() { // TO DO for (int i = 1; i &lt; simpleArray.length; i++) { for (int j = 1; j &lt; simpleArray[i].length; j++) { simpleArray[i][j] = none; } } } /** * Sets the value at location row and column to 1. * @param row the row number (start at 1). * @param column the column number (start at 1). */ public void setToOne(int row, int column) { // TO DO for (int i = 1; i &lt; simpleArray.length; i++) { for (int j = 1; j &lt;…
has comment: http://stackoverflow.com/comment/40586453
has answer: http://stackoverflow.com/a/25928457
has title: Java Reversi/Othello Program 2D array flip/get methods?
favorite count: 0
tagged with: multidimensional-array
type: UnansweredQuestion
downvote count: 1
tagged with: java
tagged with: methods
type: Question
upvote count: 0

http://stackoverflow.com/comment/40625015
has text: @Hot Licks- so what's the benefit?
comment on: http://stackoverflow.com/a/25948816
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25957916
has answer: http://stackoverflow.com/a/25958358
tagged with: encoding
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/25958358
tagged with: string
has answer: http://stackoverflow.com/a/25958255
favorite count: 0
tagged with: int
type: Question
has title: Create String from double (62^16="ZZZZZZZZZZZZZZZZ")
has comment: http://stackoverflow.com/comment/40640866
score: -2
has comment: http://stackoverflow.com/comment/40641061
has comment: http://stackoverflow.com/comment/40641048
answer count: 2
downvote count: 2
accepted answer: http://stackoverflow.com/a/25958255
has comment: http://stackoverflow.com/comment/40640979
has body: I need to create a String (kinda like an encryption) from a double, so if it is 16 characters long there are 62^16 (26 capital letters, 26 small letters, 10 numbers, ^16 characters) possibilities. I have no idea how to do that. So the last one should be "ZZZZZZZZZZZZZZZZ" and the first one "0000000000000001" the second one "0000000000000002" the 62th one "000000000000000Z" and the 63th one "0000000000000010". I hope you get the idea.
has comment: http://stackoverflow.com/comment/40640775
tagged with: java

http://stackoverflow.com/comment/40562332
type: Comment
type: QuestionComment
has text: The error information is clear that field name can't start with **$** because it's a meta character in MongoDB.
comment on: http://stackoverflow.com/q/25913281
score: 0

http://stackoverflow.com/a/26027480
upvote count: 251
accepted answer of: http://stackoverflow.com/q/26027396
type: Answer
answers question: http://stackoverflow.com/q/26027396
has comment: http://stackoverflow.com/comment/112255890
score: 251
has body: Collections.singletonList(something) is immutable whereas Arrays.asList(something) is a fixed size List representation of an Array where the List and Array gets joined in the heap. Arrays.asList(something) allows non-structural changes made to it, which gets reflected to both the List and the conjoined array. It throws UnsupportedOperationException for adding, removing elements although you can set an element for a particular index. Any changes made to the List returned by Collections.singletonList(something) will result in UnsupportedOperationException. Also, the capacity of the List returned by Collections.singletonList(something) will always be 1 unlike Arrays.asList(something) whose capacity will be the size of the backed array.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40633839
type: QuestionComment
comment on: http://stackoverflow.com/q/25953311
score: 0
has text: @5gon12eder fortunately Im not really on a deadline ;) I also have found a really good website about [recursive descent parsers](http://www.cs.engr.uky.edu/~lewis/essays/compilers/rec-des.html)
type: Comment

http://stackoverflow.com/a/25922140
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25921902
has body: Here is the code translated from here to Java and adjusted to your problem. int[][] convertToDiagonal(int[][] input) { int[][] output = new int[input.length][input.length]; int i = 0, j = 0; // i counts rows, j counts columns int n = input.length; for (int slice = 0; slice &lt; 2 * n - 1; slice++) { int z = slice &lt; n ? 0 : slice - n + 1; for (int k = z; k &lt;= slice - z; ++k) { // store slice value in current row output[i][j++] = input[k][slice - k]; } // if we reached end of row, reset column counter, update row counter if(j == n) { j = 0; i++; } } return output; } Input: | 1 2 3 | | 4 5 6 | | 7 8 9 | Output: | 1 2 4 | | 3 5 7 | | 6 8 9 | Click here for running test code

http://stackoverflow.com/comment/40680750
comment on: http://stackoverflow.com/q/25979664
type: Comment
type: QuestionComment
score: 1
has text: What do you want to achieve with "using the answer"?

http://stackoverflow.com/comment/40616187
comment on: http://stackoverflow.com/q/25942592
has text: Don't add improvements to your question as comments, edit your question and add them there. In this case, we would like to see how you think the ruler should look like.
score: 0
type: Comment
type: QuestionComment

rest-assured
tags question: http://stackoverflow.com/q/25948604
type: Tag
tag name: rest-assured

http://stackoverflow.com/comment/40505283
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25882094
score: 0
has text: Doesn't work, incomparable types, Number and int. I'm really confused.

http://stackoverflow.com/comment/40551294
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25906092
type: QuestionComment
has text: According to your own text *This XML file is build on several XSD schemas*. To allow JAXB to do marshalling/unmarshalling you need those XSD to generate the classes to do the binding. If you don't have them you will need to create the JAXB mapping classes yourself or use something like `XmlBeans` or another XML mapping framework.

http://stackoverflow.com/comment/40579416
has text: great till now, where i will use the index of that column ?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25922632
type: Comment

http://stackoverflow.com/comment/40660756
score: 0
type: QuestionComment
type: Comment
has text: @Dunken , I did all that my friend ! , even I make new var with simple value , all that does nothing !
comment on: http://stackoverflow.com/q/25968386

http://stackoverflow.com/a/26041071
upvote count: 6
answers question: http://stackoverflow.com/q/26033408
has body: Coincidence is that I just encountered this problem right now - while googling it, I found your question - Google is indeed amazingly fast a indexing, just 6 hours . Here's how to fix it: import lucene-core-4.9.0.jar (using maven, gradle or dropping it in your classpath) the version (probably 4.10) you are using has a different method signature. ES however is linked against 4.9.
downvote count: 0
type: Answer
score: 6

http://stackoverflow.com/q/25984836
answer count: 1
has comment: http://stackoverflow.com/comment/40690665
has body: I want to be able to 'round' up any double value to the closest higher integer, even if the value itself is already an integer value. Math.ceil(2) returns 2, since 2 is already equal to an integer value. I need a function that would return 3 in this case. I can easily code this myself but am curious whether this already exists in the JDK. EDIT: In the likely case that I will just code this myself given how trivial I think this is, please tell me if the following code looks okay to you: public static double convertToNearestLargerIntValue(double value){ return Math.floor(value + 1.0); }
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25984899
has comment: http://stackoverflow.com/comment/40690649
type: Question
tagged with: math
tagged with: java
has title: Is there a JDK method for changing a double to the nearest larger int, even if it's already an integer value?
accepted answer: http://stackoverflow.com/a/25984899

http://stackoverflow.com/q/25937669
favorite count: 0
has answer: http://stackoverflow.com/a/25937923
tagged with: datetime
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25937923
has body: I use org.joda.time. I have a DateTime and a DateTimeFieldType given. What I want is to round my DateTime (up) to the nearest DateTime which is after mine, but with an integer number of the given field. For example: for (DateTime = 20/10/2013 14:20:31.200, DateTimeFiledType = DateTimeFieldType.dayOfMonth()) I will get: 21/10/2013 00:00:00.000. Did somebody do something similar?
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jodatime
has title: Round DateTime by a given DateTimeFieldType
answer count: 1
downvote count: 0

http://stackoverflow.com/a/37001203
has body: This is a late reply to the original post. But should be good as a reference for other folks. I met the same problem. Here is what worked for me after going through much of the same struggles trying to rebuild JAXB 1.0 scheme/binding using later JDKs (8 and 7). My goal is to build with latest JDKs without the hassle of upgrading JAXB, if possible. JDK 7&amp;8 failed building with JAXB 1.0 due to ClassCastException thrown from &lt;xjc&gt; possibly due to incompatible language features. JDK 5&amp;6 work, however. I went through several attempts trying to upgrade to the latest JAXB 2.11.12, Update ant build file &lt;xjc&gt; task to replace target attribute with deskdir Change binding files syntax - bindingStyle attribute was removed in &lt;jxb:globalBindings&gt; in the latest JAXB - we use modelGroupBinding Adjust binding class files suffix to avoid name conflicts. Update sources for the new type names generated. There were still remaining name conflicts and source upgrades required. I decided to stop going further down the rabbit hole making all these changes and focus on finding just one version of JAXB that generates JDK 7&amp;8 compatible sources but still support JAXB 1.0 schema and binding. Newer &lt;xjc&gt; task supports version specification by source attribute. However, as the original poster found out, support of "1.0" was removed in later JAXB distributions The "Illgal version 1.0" error message when using &lt;xjc&gt; is due to support for version 1.0 was removed in since JAXB 2.2.7 (https://jaxb.java.net/nonav/2.2.11/docs/ch02.html#a-2-2-7) However, JAXB 2.2.6 doesn't work either. There seems to be a bug in that "jaxb-xjc.jar" version not generating sources correctly based on the attribute, resulting in the certain ClassNotFoundException during build. I read reports on JAXB 2.1.18 failing to respect "1.0" source as well Eventually I found JAXB 2.0.5 is to be one version that can generate JDK 7&amp;8 compatible sources using JAXB 1.0 source schema and bindin…
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25987635
upvote count: 1
score: 1

http://stackoverflow.com/comment/40577944
score: 1
has text: I don't get it. Please give an example
comment on: http://stackoverflow.com/q/25921821
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40620314
comment on: http://stackoverflow.com/q/25945906
type: QuestionComment
has text: Can you plz paste the stacktrace..
score: 0
type: Comment

http://stackoverflow.com/a/25991424
downvote count: 0
answers question: http://stackoverflow.com/q/25991373
has body: it's working just fine. Just remember 2 things: you're using integers, the result of the calculation will be an integer rounding errors
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/25965212
tagged with: java-stream
linked to: http://stackoverflow.com/q/14039995
answer count: 0
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40687704
has comment: http://stackoverflow.com/comment/40780098
type: Question
has comment: http://stackoverflow.com/comment/86891673
duplicate of: http://stackoverflow.com/q/19757300
has comment: http://stackoverflow.com/comment/40695042
score: 4
has body: New to Java 8 and practicing Streams and Lambdas. I am trying to create a Stream&lt;String&gt; out of a folder files content. This is something that I tried unsuccessfully: Stream&lt;String&gt; lineStream = Files.walk(Paths.get("resources")).flatMap(Files::lines); The compiler yells that I am not catching an IOException even if I have a throws clause. Can anyone explain this to me? I managed to print all the files that I am interested in with the following: Files.walk(Paths.get("resources")) .map(Path::toFile) .filter(File::isFile) .forEach(System.out::println); How do I get a Stream&lt;String&gt; with each String being a line of the files printed by the code above?
has title: Single Java 8 Stream<String> from a folder content
duplicate of: http://stackoverflow.com/q/14039995
favorite count: 0
linked to: http://stackoverflow.com/q/19757300
type: UnansweredQuestion
tagged with: lambda
upvote count: 4
tagged with: java-8
has comment: http://stackoverflow.com/comment/40657928

http://stackoverflow.com/q/25948386
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/10075453
has answer: http://stackoverflow.com/a/26130499
has title: Error when using AWS Android S3 SDK: Source not found - The JAR of this class file belongs to container 'Android private libraries'
tagged with: amazon-web-services
accepted answer: http://stackoverflow.com/a/25977343
possible better answer: http://stackoverflow.com/a/26130499
score: 0
tagged with: android
has body: I'm working on an Android App with AWS Android SDK, especifically using S3, and I started receiving the following error: Source not found - The JAR of this class file belongs to container 'Android private libraries' which does not allow modifications to source attachments on its entries. that happens on the line s3Client = new AmazonS3Client(credentials); when I try to create a new client to connect to S3. I had to replace an old version of the SDK (1.7.1.1) with a newer version (2.1.0) in order to use PersistableDownload class to pause/resume downloads. I don't understand why is this happening since I'm not trying to change the library. What I remember doing: - Removed the old library - Added the new one - Removed and added again several imports on the start of .java files - Using an older device for the weekend (android API level 8) Here is a extend part of the code. That might help. AWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_KEY); Region region = Region.getRegion(regions); AmazonS3Client s3Client = null; try { s3Client = new AmazonS3Client(credentials); s3Client.setRegion(region); } catch (Exception e) { e.printStackTrace(); } return s3Client; Any help is aprpreciated to solve this. Thanks! Edit: I forgot to say that I tried rolling back the old library and that gives me the same error. Most annoying part is that it was working before.
has comment: http://stackoverflow.com/comment/40691322
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25977343
tagged with: amazon-s3
has comment: http://stackoverflow.com/comment/40704055

http://stackoverflow.com/a/25927666
type: Answer
upvote count: 1
has body: You cannot use a variable as an annotation value because the annotation is already evaluated at compile time. Therefore only compile time constants (static final) can be used as values in annotations.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25927450
has comment: http://stackoverflow.com/comment/40589734

http://stackoverflow.com/a/25944118
has comment: http://stackoverflow.com/comment/40617966
answers question: http://stackoverflow.com/q/25944063
type: Answer
has body: I think the easiest way to do this would be to keep track of the number of questions asked and the number of correct answers. Declare the following variables at the top of your code: int questions = 0; int correctAnswers = 0; Each time you print out a question, increase the question count. For each correct answer, increase the correctAnswer count. Finally after all questions are answered: int percent = (correctAnswers * 100)/questions For example if they got 5 correct answers out of 10 then percent would contain the integer value 50. Then simply output it to the user: System.out.println("Your percent correct is:" + percent);
score: 0

http://stackoverflow.com/comment/40694112
comment on: http://stackoverflow.com/q/25974526
score: 0
type: Comment
type: QuestionComment
has text: My confusion is that, if draw() method of class B is ovrerriding the draw() method of class A or implementing the draw() method of the Interface.

http://stackoverflow.com/comment/40575957
comment on: http://stackoverflow.com/q/25920826
type: Comment
type: QuestionComment
has text: Don't construct your sql like that. Use a [`PreparedStatement`](http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html).
score: 5

tabs
type: Tag
tags question: http://stackoverflow.com/q/25977146
tag name: tabs

http://stackoverflow.com/q/25886196
type: Question
downvote count: 0
favorite count: 0
answer count: 0
upvote count: 2
has body: We are providing software for an embedded JavaME device. Besides standard JavaME APIs, this device provides some proprietary API's which were in packages like com.somecompany.icm.io for example. Because of legal issues, the packages were renamed in later firmware revisions to com.othercompany.io e.g. but with the same class names, interfaces and functionality. Now, what I could do is running sed or similar over our code base and rename every required package and then commit it to our VCS as "the new" version. Unfortunately, we need to provide updates for both firmware revisions so bug fixes or even features then needs to be merged back into the old version. I was thinking about having a special ANT build task that first copies all sources to another directory, runs the sed script and then compiles it again. This is not very elegant but may work (haven't done this yet). I know this might be a very special case, but maybe someone can come up with a smarter solution. [UPDATE] I've been thinking about this for a while and came up with the following idea: I wrote a small application that contains the following line: try { System.out.println("[somecompany] File 'foo' exists: " + com.somecompany.icm.io.File.exists("foo")); } catch(NoClassDefFoundError ex) { System.out.println("[othercompany] File 'foo' exists: " + com.othercompany.io.File.exists("foo")); } I've compiled this providing both the libraries of somecompany and othercompany as classpath. File.exists is just some arbitrary static method to test this idea. And it actually does work on both target devices: Old firmware: [somecompany] File 'foo' exists: false New firmware: [othercompany] File 'foo' exists: false However, this does only work for static methods and class initialization. However, this won't work on class instances and instance method access. Now, one thing that could be done is writing two versions of a factory classes for each firmware version. Then, I could use the code above to determine at runtime …
type: UnansweredQuestion
tagged with: package
score: 2
has title: How to maintain different SW versions with different package names
tagged with: java

http://stackoverflow.com/a/25947446
answers question: http://stackoverflow.com/q/25947357
has body: No, there is no language feature in Java that allows you to selectively delete a specific object ahead of time (like del in Python). You'll need to trust that the garbage collector will do its job. (And usually, it does so very well.) Java's garbage collector is based on object reachability (not on reference counting like in CPython, not on memory scanning like in Boehm GC). This mans that any object for which there is no live reference is subject to garbage collection. The reference can be indirect but references from dead objects and dead cycles will not irritate the garage collector. Some examples: class Dummy { String name; Dummy other; Dummy(String name) { this.name = name; } } void f1() { Dummy peter = new Dummy("Peter"); peter.other = new Dummy("Fred"); peter.other.other = new Dummy("Megan"); // None of the objects is eligible for garbage collection since // "Peter" is live and "Fred" can be reached via "Peter" (therefore // "Fred" is alive) and "Megan" can be reached via "Fred". peter.other = null; // Now the reference to "Fred" is lost which makes him a candidate // for garbage collection. "Megan" is dead too because the // reference from the dead object "Fred" does not count. // As the method returns, all three objects are dead and can be // collected. } void f2() { Dummy clementine = new Dummy("Clementine"); clementine.other = new Dummy("Charles"); clementine.other.other = new Dummy("Caroline"); clementine.other.other.other = clementine; // Here we have a cycle of // // +--&gt; "Clementine" --&gt; "Charles" --&gt; "Caroline" --+ // | | // +------------------------------------------------+ // // and since "Clementine" is live, all three are. clementine = null; // Once we loose the reference to "Clementine", the cycle still // exists (every object is referenced by at least one other object) // but the cycle is dead. Hence, all three are subject to garbage // collection. } The key to using the Java garbage collection effectively is to not keep any references…
score: 2
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/139907515
has text: Representing the date as an object is a good idea. Don’t roll your own date class, though. Use the built-in [`LocalDate`](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/time/LocalDate.html).
score: 0
comment on: http://stackoverflow.com/a/25901388
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25946557
tagged with: java
has title: Java - Trigger swing timer with a mouseEvent?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40621454
tagged with: mouseevent
score: 0
has body: I'm trying to turn on the timer using mouseEntered event with MouseListener it doesn't seem to work. Am i doing somthing wrong? I'm new to Java. Thanks in advance! int counter = 0; Timer timer = new Timer(1000,this); public void mouseEntered(e MouseEvent) { if(e.getComponent == mouseEnteredArea) { timer.start() counter++; if(counter == 10) { timer.stop(); } } }
tagged with: timer
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/25946816
has answer: http://stackoverflow.com/a/25946639

http://stackoverflow.com/comment/40657843
has text: `e.printStackTrace()` should show you more detail than the error occurring when you call work(). it is probably in your call `ds.getConnection()`. Your code doesn't show how you initialise `ds`, so the issue may be here.
score: 0
comment on: http://stackoverflow.com/q/25966839
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40498692
type: QuestionComment
type: Comment
has text: Sorry, I'm a bit of a noob. Here's an image of what I mean. Is there a setting I need to change to show the actual error? [link](http://snag.gy/GHhGr.jpg)
comment on: http://stackoverflow.com/q/25878210
score: 0

http://stackoverflow.com/comment/40675913
has text: i suggest you to learn fragments clearly. if you want to use independent screen then just use activity.
type: AnswerComment
comment on: http://stackoverflow.com/a/25976894
score: 0
type: Comment

http://stackoverflow.com/comment/40682833
comment on: http://stackoverflow.com/q/25980299
has text: "I think it has something to do with the highlighted code" Could you specify what the highlighted code is?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25962311
tagged with: android-actionbar
tagged with: android-intent
possible better answer: http://stackoverflow.com/a/25963240
type: Question
has answer: http://stackoverflow.com/a/25963240
score: 3
linked to: http://stackoverflow.com/q/18337536
has answer: http://stackoverflow.com/a/26026217
accepted answer: http://stackoverflow.com/a/26026217
answer count: 3
downvote count: 0
favorite count: 0
tagged with: android
tagged with: android-activity
linked to: http://stackoverflow.com/q/10407159
has title: Going back to previous activity using ActionBar navigation
type: AnsweredQuestion
has body: In my app, I model Lists of items. In MainActivity, I see ListView containing Lists. I can click on each list to see its items (DisplayListActivity). On DisplayListActivity, I have button in the ActionBar to display the list properties. This launches the third activity (EditListPropertiesActivity). Main | ^ V | DisplayListActivity (listId is passed with Intent, default=1) | ^ V | EditListPropertiesActivity (listId is passed with Intent, default=1) The problem appears, when I select List id=2 on the MainActivity, and then I select the properties button on the DisplayListActivity. Once I am done with the EditListPropertiesActivity, i click '&lt;' (back) on the ActionBar: . I return to the DisplayListActivity, but instead of going back to the list id=2, I see the list with id=1 (which is default). How to pass the ListId back form EditListPropertiesActivity to the DisplayListActivity? startActivityForResult and return the id - would work, but I see it ugly use the SharedPreferences and store sth like lastVisitedList - ugly store the lastVisitedList information in the db - even uglier What is the usual solution for that problem? Code snippets below. MainActivity public class MainActivity extends Activity { ... listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { MetaList mlist = (MetaList) listView.getItemAtPosition(i); final Intent intent; intent = new Intent(getApplicationContext(), DisplayListActivity.class); intent.putExtra(META_LIST_SELECTED, mlist.getId()); startActivity(intent); } } ); ... DisplayListActivity @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.single_list); intent = getIntent(); metaListId = intent.getLongExtra(MainActivity.META_LIST_SELECTED, 1); //read the data or take 1 as default ... //start the third activity final Intent intent; intent = new Intent(getApplicati…
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26025417

http://stackoverflow.com/comment/40556056
score: 0
has text: Eclipse problems tabs says errors. I can't find how to specify the versions. DN 3.1.3 is specified in Properties -> java build path -> Libraries -> App Engine SDK, but I can't edit the version from eclipse. Changing the files from explorer may work, but I don't know if this is the straightforward way to change the version.
comment on: http://stackoverflow.com/q/25909994
type: Comment
type: QuestionComment

selenium
tags question: http://stackoverflow.com/q/25995754
tags question: http://stackoverflow.com/q/25906393
tags question: http://stackoverflow.com/q/25939579
tags question: http://stackoverflow.com/q/25924721
tags question: http://stackoverflow.com/q/26030657
tags question: http://stackoverflow.com/q/25928623
tags question: http://stackoverflow.com/q/25997365
tags question: http://stackoverflow.com/q/25913989
tags question: http://stackoverflow.com/q/26032149
tags question: http://stackoverflow.com/q/25999016
tags question: http://stackoverflow.com/q/25940929
tags question: http://stackoverflow.com/q/26018790
tags question: http://stackoverflow.com/q/25910027
tags question: http://stackoverflow.com/q/25956767
tags question: http://stackoverflow.com/q/25887663
tags question: http://stackoverflow.com/q/25986357
tags question: http://stackoverflow.com/q/26014807
tags question: http://stackoverflow.com/q/25987788
tags question: http://stackoverflow.com/q/25997556
tags question: http://stackoverflow.com/q/26001643
tag name: selenium
tags question: http://stackoverflow.com/q/26018704
tags question: http://stackoverflow.com/q/25988884
tags question: http://stackoverflow.com/q/25917132
tags question: http://stackoverflow.com/q/25887564
tags question: http://stackoverflow.com/q/25950339
tags question: http://stackoverflow.com/q/25993500
tags question: http://stackoverflow.com/q/25913944
tags question: http://stackoverflow.com/q/25886300
tags question: http://stackoverflow.com/q/25975301
tags question: http://stackoverflow.com/q/25988017
tags question: http://stackoverflow.com/q/25973997
tags question: http://stackoverflow.com/q/25988569
tags question: http://stackoverflow.com/q/25923726
type: Tag
tags question: http://stackoverflow.com/q/25944605
tags question: http://stackoverflow.com/q/25994767
tags question: http://stackoverflow.com/q/25918300
tags question: http://stackoverflow.com/q/25994772
tags question: http://stackoverflow.com/q/25885017

http://stackoverflow.com/comment/41008044
comment on: http://stackoverflow.com/q/25912574
score: 0
has text: If u dont know then don't waste mine & ur time bro ....
type: Comment
type: QuestionComment

http://stackoverflow.com/a/54295122
answers question: http://stackoverflow.com/q/26005626
has body: The easiest way to reverse the single linked list is as follows. private void reverse(Node node) { Node current = Node; Node prev = null; Node next = null; if(node == null || node.next == null) { return node; } while(current != null) { next = current.next; //swap current.next = prev; prev = current; current = next; } node.next = current; }
score: 0
type: Answer

http://stackoverflow.com/a/26046517
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25997365
has body: import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class answer { public static void main(String[] args) throws InterruptedException { WebDriver driver = new FirefoxDriver(); driver.get("http://www.example.com/"); //If u want to know the number of radio buttons then use List List&lt;WebElement&gt;radioButton = driver.findElements(By.tagName("example")); System.out.println(radioButton.size()); //If u want to select the radio button driver.findElement(By.id("example")).click(); Thread.sleep(3000); //If u want the Text in U R console for(int i=0;i&lt;radioButton.size();i++) { System.out.println(radioButton.get(i).getText()); } //If u want to check whether the radio button is selected or not if(driver.findElement(By.id("example")).isSelected()) { System.out.println("True"); } else { System.out.println("False"); } } }
answers question: http://stackoverflow.com/q/25997365
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25996943
type: Answer
has comment: http://stackoverflow.com/comment/40713424
score: 3
upvote count: 3
has body: Nope. But you can use the SpoolFileOpenList method along with your own UI... http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzahh/javadoc/com/ibm/as400/access/list/SpooledFileOpenList.html
answers question: http://stackoverflow.com/q/25991722
downvote count: 0

http://stackoverflow.com/a/25925018
has body: I think your input to intersects is null. When you check your if condition, check r1 and r2 first: if(r1.isAlive==true &amp;&amp; r2.isAlive==true &amp;&amp; r1.rec.intersects(r2.rec)) { ... }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25924997

http://stackoverflow.com/comment/40580708
type: AnswerComment
comment on: http://stackoverflow.com/a/25923442
score: 0
type: Comment
has text: @JhaezzJohn: `int cm = Math.abs(a-b);`?

opendocument
tags question: http://stackoverflow.com/q/25989317
tag name: opendocument
type: Tag

http://stackoverflow.com/q/26033109
score: 0
tagged with: aspectj
has answer: http://stackoverflow.com/a/26157759
answer count: 3
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26033336
tagged with: obfuscation
tagged with: java
has title: Can we obfuscate annotations in java using dex2jar tool or any other way?
type: Question
has body: I am building a project with the help of AspectJ to intercept the method in Android. When I build the jar file of code i created it creates compiled syntax of each pointcut i applied on the methods as like bellow: Code before obfuscation: @After(value="(execution(* android.app.Activity.onCreate(..)) &amp;&amp; (target(obj) &amp;&amp; within(com.snapdeal.ui.activity.MainActivity)))", argNames="obj") public void ajc$after$demo_Common_Aspects$1$dcc8d2c5(Object obj) { . . . } When I obfuscate this method using dex2jar tool it only changes the name of method from ajc$after$demo_Common_Aspects$19$a6eef354 to the string I used to obfuscate pkt1 but Anotation i.e. line above the method definition does not change which shows details of method interception. Code after obfuscation: @After(value="(execution(* android.app.Activity.onCreate(..)) &amp;&amp; (target(obj) &amp;&amp; within(com.snapdeal.ui.activity.MainActivity)))", argNames="obj") public void pkt1(Object obj) { . . . } Uptil now what i know is that we can obfuscate the names of Classes,methods and variables. But I want to obfuscate this line : @After(value="(execution(* android.app.Activity.onCreate(..)) &amp;&amp; (target(obj) &amp;&amp; within(com.snapdeal.ui.activity.MainActivity)))", argNames="obj") So my Quitions are : Can we obfuscate annotations ? If yes how? How can we obfuscate the local variables of some method?
has answer: http://stackoverflow.com/a/26063096

http://stackoverflow.com/a/25910905
type: Answer
has comment: http://stackoverflow.com/comment/40557134
score: 3
has comment: http://stackoverflow.com/comment/40557082
accepted answer of: http://stackoverflow.com/q/25910215
answers question: http://stackoverflow.com/q/25910215
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40557675
upvote count: 3
has comment: http://stackoverflow.com/comment/40556933
has comment: http://stackoverflow.com/comment/40557475
downvote count: 0
has body: That is the GUI behaviour of the Enter key versus the Space key. You could use OK_CANCEL_OPTION, as OK is more associated with Enter, and might deter using Enter for "Cancel".

http://stackoverflow.com/q/26005150
has answer: http://stackoverflow.com/a/26005221
has title: Regex to match a number or nothing
has answer: http://stackoverflow.com/a/26005232
possible better answer: http://stackoverflow.com/a/26005221
tagged with: regex
favorite count: 0
has answer: http://stackoverflow.com/a/26005866
answer count: 5
accepted answer: http://stackoverflow.com/a/26005232
upvote count: 1
tagged with: capturing-group
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26005960
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26005362
type: Question
has comment: http://stackoverflow.com/comment/40728894
has body: i need to get a regex that can match something like this : 1234 &lt;CIRCLE&gt; 12 12 12 &lt;/CIRCLE&gt; 1234 &lt;RECTANGLE&gt; 12 12 12 12 &lt;/RECTANGLE&gt; i've come around to write this regex : (\\d+?) &lt;([A-Z]+?)&gt; (\\d+?) (\\d+?) (\\d+?) (\\d*)? (&lt;/[A-Z]+?&gt;) It works fine for when i'm trying to match the rectangle, but it doesn't work for the circle the problem is my fifth group is not capturing though it should be ??
downvote count: 0

http://stackoverflow.com/comment/40703979
comment on: http://stackoverflow.com/q/25992635
type: QuestionComment
type: Comment
has text: Drag and drop :D. Give me a Chocolate now :P
score: 3

http://stackoverflow.com/q/25937487
favorite count: 0
has title: How to access an object via a method `get()` in jsp?
score: 2
type: AnsweredQuestion
tagged with: guava
tagged with: java
has comment: http://stackoverflow.com/comment/40605611
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40607380
has answer: http://stackoverflow.com/a/25938504
downvote count: 0
accepted answer: http://stackoverflow.com/a/25938504
answer count: 1
has comment: http://stackoverflow.com/comment/40605833
tagged with: jsp
has comment: http://stackoverflow.com/comment/40607337
tagged with: tomcat
linked to: http://stackoverflow.com/q/10121166
has body: I have an container object that contains a google/Guava Optional and I want to access the content of this Optinal in jsp. import com.google.common.base.Optional; public class Container { private Optional&lt;User&gt; user; public Optional&lt;User&gt; getUser(){return this.user;} } public class User{ private String name; public String getName() {return this.name;} } A Optional has a method get() to obtain the inner object. http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Optional.html#get%28%29 I have already tried (${container} ins an instance of Container): &lt;c:out value="${container.user.name}" /&gt; &lt;c:out value="${container.user.get.name}" /&gt; &lt;c:out value="${container.user..name}" /&gt; none of them work (Tomcat 7.42). Does anybody has an idea how to solve this, without adding a new property to the container (getUser2(){return this.user.get();})?

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/25997870
tags question: http://stackoverflow.com/q/25908446
tags question: http://stackoverflow.com/q/26005568
tags question: http://stackoverflow.com/q/25956597
type: Tag
tags question: http://stackoverflow.com/q/25928349
tags question: http://stackoverflow.com/q/25948426

http://stackoverflow.com/q/25928463
tagged with: jcr
has comment: http://stackoverflow.com/comment/58922987
has comment: http://stackoverflow.com/comment/40868890
tagged with: jackrabbit
has comment: http://stackoverflow.com/comment/40818800
has comment: http://stackoverflow.com/comment/40783283
type: Question
has comment: http://stackoverflow.com/comment/40778765
has comment: http://stackoverflow.com/comment/40800634
score: 0
has body: I have created which is not part of admin group. Wanted to retrieve user object from logged-in user session. Using admin created user: org.apache.jackrabbit.api.security.user.User applicationUser = accessController.createUser(user.getUsername(), user.getPassword()); Login with newly created user: Session session = repository.login( new SimpleCredentials(userInstance.getUsername(), userInstance.getPassword().toCharArray())); Trying to retrieve user object: UserManager userManager = ((JackrabbitSession)adminSession).getUserManager(); User repoUser = (User) userManager.getAuthorizable(userName); But userManager is null, since session created from user is not part of admin group. Only way I find is to impersonate user session to admin and retrieve user object. But is there any other way to retrieve User object without impersonation? Using Jackrabbit 2.6.0 and JCR 2.0. Thanks.
answer count: 1
has comment: http://stackoverflow.com/comment/40754924
has answer: http://stackoverflow.com/a/35620314
tagged with: java
has title: Get user from User session jackrabbit
type: UnansweredQuestion

terminal
tags question: http://stackoverflow.com/q/25971455
tags question: http://stackoverflow.com/q/25877337
tag name: terminal
type: Tag

http://stackoverflow.com/a/25945197
answers question: http://stackoverflow.com/q/25945185
has comment: http://stackoverflow.com/comment/40620262
type: AcceptedAnswer
score: 0
type: Answer
has body: A ThreadFactory has a single method, newThread(Runnable), which Constructs a new Thread. It does not manage the lifecycle of the thread, so, no, it doesn't shutdown any thread.
has comment: http://stackoverflow.com/comment/40626389
has comment: http://stackoverflow.com/comment/40646847
has comment: http://stackoverflow.com/comment/40626459
accepted answer of: http://stackoverflow.com/q/25945185
has comment: http://stackoverflow.com/comment/40652091

http://stackoverflow.com/q/25988571
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40697000
tagged with: java
has answer: http://stackoverflow.com/a/25997121
tagged with: playframework
tagged with: jpa
answer count: 1
has title: Create a new object if current field is null in database
has body: I have a database model class Project, and it has two embedded object fields: @Embedded public ContacterInfo contacter = new ContacterInfo(); @Embedded public CompanyInfo company = new CompanyInfo(); 'cause I don't want to check is null every time I use company and contacter, so I decided to create them anyway. What I expected is, when there's nothing for contacter in database, Java would create a new ContacterInfo for me, and then I can just use it for new data. But in fact, I found contacter still could be set to null. I suspect that JPA load null from database and override my new create object with it. How can I fix this ?
score: 0
accepted answer: http://stackoverflow.com/a/25997121
type: Question

http://stackoverflow.com/comment/40659149
has text: ObjectMapper mapper = new ObjectMapper(); JSONObject jsonObject = new JSONObject(args[0].toString()); // getting the first argument JSONObject object = jsonObject.getJSONObject("entity"); // getting a node inside the previous json Entity entity = mapper.readValue(json, Entity.class); in your "on" method
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25935099

http://stackoverflow.com/a/25923133
has body: Your switch statement in your onClick method has no break statements ending cases. With no breaks, execution continues through cases below the case that was intended to run. In this case, the last case, DIV, overwrites the results of any other case in all cases. Place breaks at the end of all cases. switch (o){ case NO: finalText.setText(onScreenNumber); break; case ADD: finalResult=actualNumber+Float.parseFloat(onScreenNumber); finalText.setText(String.valueOf(finalResult)); break; case SUB: finalResult=actualNumber-Float.parseFloat(onScreenNumber); finalText.setText(String.valueOf(finalResult)); break; case MUL: finalResult=actualNumber*Float.parseFloat(onScreenNumber); finalText.setText(String.valueOf(finalResult)); break; case DIV: finalResult=actualNumber/Float.parseFloat(onScreenNumber); finalText.setText(String.valueOf(finalResult)); break; }
type: Answer
answers question: http://stackoverflow.com/q/25923107
has comment: http://stackoverflow.com/comment/40580055
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/40537438
has text: @evanwong - No I am not overriding equals or hashCode
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25899269

multicast
tags question: http://stackoverflow.com/q/26005340
tag name: multicast
type: Tag

http://stackoverflow.com/q/25873971
has answer: http://stackoverflow.com/a/37442191
has answer: http://stackoverflow.com/a/26214051
has answer: http://stackoverflow.com/a/40474052
has answer: http://stackoverflow.com/a/50467205
tagged with: gradlew
linked to: http://stackoverflow.com/q/41704184
has body: I'm trying to deploy our java web application to aws elastic beanstalk using docker, the idea is to be able to run the container locally for development and testing and eventually push it up to production using git. I've created a base image that has tomcat8 and java8 installed, the image that performs the gradle builds inherit from this base image, speeding up build process. All works well, except for the fact that the inheriting application container that gets built using docker doesn't seem to cache the gradle dependencies, it downloads it every time, including gradlew. We build our web application using the following command: ./gradlew war Is there some way that i can cache the files in ~/.gradle this would speed my build up dramatically. This isn't so much of an issue on beanstalk but is a big problem for devs trying to build and run locally as this does take a lot of time, as you can imagine. The base image dockerfile: FROM phusion/baseimage EXPOSE 8080 RUN apt-get update RUN add-apt-repository ppa:webupd8team/java RUN apt-get update RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections RUN apt-get -y install oracle-java8-installer RUN java -version ENV TOMCAT_VERSION 8.0.9 RUN wget --quiet --no-cookies http://archive.apache.org/dist/tomcat/tomcat-8/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz -O /tmp/catalina.tar.gz # Unpack RUN tar xzf /tmp/catalina.tar.gz -C /opt RUN mv /opt/apache-tomcat-${TOMCAT_VERSION} /opt/tomcat RUN ln -s /opt/tomcat/logs /var/log/tomcat RUN rm /tmp/catalina.tar.gz # Remove unneeded apps RUN rm -rf /opt/tomcat/webapps/examples RUN rm -rf /opt/tomcat/webapps/docs RUN rm -rf /opt/tomcat/webapps/ROOT ENV CATALINA_HOME /opt/tomcat ENV PATH $PATH:$CATALINA_HOME/bin ENV CATALINA_OPTS $PARAM1 # Start Tomcat CMD ["/opt/tomcat/bin/catalina.sh", "run"] The application dockerfile: FROM &lt;tag name here for base image&gt; RUN mkdir ~/.gradle # run some extra stuff …
tagged with: java
type: Question
downvote count: 0
score: 54
has comment: http://stackoverflow.com/comment/41109208
favorite count: 0
tagged with: docker
has answer: http://stackoverflow.com/a/73372544
upvote count: 54
tagged with: amazon-elastic-beanstalk
has comment: http://stackoverflow.com/comment/40493992
has comment: http://stackoverflow.com/comment/40522130
has title: Docker cache gradle dependencies
answer count: 5
type: UnansweredQuestion

http://stackoverflow.com/q/25904674
tagged with: java
has comment: http://stackoverflow.com/comment/40548101
has comment: http://stackoverflow.com/comment/40548452
has body: I got an error when querying to the entity extended by mappedsuperclass on GAE/J. MappedSuperClass import java.sql.Timestamp; import javax.persistence.MappedSuperclass; @MappedSuperclass public abstract class AbstractModel { private String lastModifiedBy; private Timestamp createTimestamp; private Timestamp modifyTimestamp; private Integer version; // setters &amp; getters } Entity import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "EMPLOYEE") public class EmployeeModel extends AbstractModel { @Id private Integer id; private String address; private String name; private String position; // setters &amp; getters } JPA query is like below. Query q = em.createNativeQuery("SELECT * FROM EMPLOYEE", EmployeeModel.class); @SuppressWarnings("unchecked") List&lt;EmployeeModel&gt; list = q.getResultList(); And I got the error javax.persistence.PersistenceException: Result Class query field names are not case sensitive. It does not allow fields with same name, but in a different case. For instance, the field "jdoFieldFlags" is conflicting. at org.datanucleus.api.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException(NucleusJPAHelper.java:302) at org.datanucleus.api.jpa.JPAQuery.getResultList(JPAQuery.java:202) at test20140919.EmployeeDao.list(EmployeeDao.java:21) at test20140919.EmployeeLogic.list(EmployeeLogic.java:34) at test20140919.EmployeeAction.list(EmployeeAction.java:45) 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 com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:359) at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java…
has answer: http://stackoverflow.com/a/25946599
type: Question
has comment: http://stackoverflow.com/comment/40548013
tagged with: datanucleus
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/40986494
score: 0
tagged with: mappedsuperclass
tagged with: google-app-engine
accepted answer: http://stackoverflow.com/a/25946599
has comment: http://stackoverflow.com/comment/40553742
has title: "field jdoFieldFlags is conflicting" when using @MappedSuperclass on GAE/J & JPA
has comment: http://stackoverflow.com/comment/40547626
has comment: http://stackoverflow.com/comment/40548913
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40548372

http://stackoverflow.com/a/25973803
has comment: http://stackoverflow.com/comment/40669570
downvote count: 0
type: Answer
score: 1
has body: Following on from my comments your project must have a valid JDK and JRE defined If these are missing from your project, go to Window &gt; Preferences&gt; Java Installed JREs and click Add.. If you make any changes select Project &gt; Clean... again
upvote count: 1
answers question: http://stackoverflow.com/q/25973242

http://stackoverflow.com/comment/40746446
score: 0
type: Comment
has text: @StephaneM : as per my understanding, i see the code as , `IF starts with IF and has GOTO THEN ONLY CHECK if it contains ":"`...logically its fine!!
type: QuestionComment
comment on: http://stackoverflow.com/q/26015827

http://stackoverflow.com/comment/40737365
comment on: http://stackoverflow.com/a/25990159
type: AnswerComment
score: 0
type: Comment
has text: http://www.quickserver.org/ can take a look at this open source prodution ready (its actively used in 7 production systems that i know of since 2008)

http://stackoverflow.com/comment/40729434
has text: It looks like the Jira for Spring Integration contains some information on how to do this. It looks ugly though. I wonder if there is a better way to do this: [HttpRequestExecutingMessageHandler loses generics as it executes the expectedResponseTypeExpression](https://jira.spring.io/browse/INT-3052?jql=text%20~%20%22Generic%20Type%20and%20expected-response-type%22)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26005981

http://stackoverflow.com/comment/40567232
score: 2
has text: @RichardDavy No, it wouldn't if you call `.getLoginId()` on `null`.
type: Comment
comment on: http://stackoverflow.com/q/25916265
type: QuestionComment

http://stackoverflow.com/q/25948029
tagged with: java
has title: How to run Heroku Spring MVC, Hibernate project on local machine
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40637001
downvote count: 0
has body: I am trying to run Heroku Spring MVC on my local machine(Ubuntu) using postgres, applicationContaxt.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:annotation-config /> <context:component-scan base-package="basicsInJavaBlogspot" /> <jpa:repositories base-package="basicsInJavaBlogspot.repository"></jpa:repositories> <mvc:annotation-driven/> <entry key="json" value="application/json" /> <entry key="xml" value="application/xml" /> <tx:annotation-driven /> <jdbc:embedded-database id="dataSource"/> org.hibernate.dialect.HSQLDialect create org.hibernate.dialect.PostgreSQLDialect true update pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.example spring-hibernate-template war 0.0.1-SNAPSHOT <org.springframework.version>3.2.0.RELEASE</org.springframework.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> javax.servlet javax.servlet-api 3.0.1 provided javax.servlet…
has comment: http://stackoverflow.com/comment/40644811
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: heroku
score: 2
has comment: http://stackoverflow.com/comment/40636769

http://stackoverflow.com/q/25933684
score: 0
tagged with: udp
has body: Port 161 is used by SNMP. I wrote a small peice of code to check if a device is running SNMP on this port. public boolean isPortOpen(String ip, int port, int timeout) { try { Socket socket = new Socket(); socket.connect(new InetSocketAddress(ip, port), timeout); socket.close(); logger.info(threadId, "Port is Open : " + ip + ":" + port ); return true; } catch (IOException ex) { logger.error(threadId, "isPortOpen : " + ip + ":" + port + "\t"+ ex.getMessage()); return false; } } However to my surprise the code always returns false for port 161 even though the box is running SNMP and other tools such as PortQryV2 return true for port 161. Can someone please help!! TIA
tagged with: sockets
tagged with: port
has comment: http://stackoverflow.com/comment/40598883
has comment: http://stackoverflow.com/comment/40609110
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java
has title: Java UDP Port 161 scan
has comment: http://stackoverflow.com/comment/40617008

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/25932594
tags question: http://stackoverflow.com/q/25893985
tags question: http://stackoverflow.com/q/26032602
tags question: http://stackoverflow.com/q/25973062
tags question: http://stackoverflow.com/q/25951633
tags question: http://stackoverflow.com/q/25899974
tags question: http://stackoverflow.com/q/26032158
tags question: http://stackoverflow.com/q/25900899
tags question: http://stackoverflow.com/q/25894123
tags question: http://stackoverflow.com/q/25874250
tags question: http://stackoverflow.com/q/25908733
tags question: http://stackoverflow.com/q/25886663
tags question: http://stackoverflow.com/q/25984576
tags question: http://stackoverflow.com/q/25945044
tags question: http://stackoverflow.com/q/25998192
tags question: http://stackoverflow.com/q/26031924
tags question: http://stackoverflow.com/q/26020602
tags question: http://stackoverflow.com/q/25910472
tags question: http://stackoverflow.com/q/25932706
tags question: http://stackoverflow.com/q/25892463
tags question: http://stackoverflow.com/q/25876177
tags question: http://stackoverflow.com/q/25889479
tags question: http://stackoverflow.com/q/25945046
tags question: http://stackoverflow.com/q/25993922
tags question: http://stackoverflow.com/q/25932613
tags question: http://stackoverflow.com/q/25926507
tags question: http://stackoverflow.com/q/25918232
type: Tag
tags question: http://stackoverflow.com/q/25885634
tags question: http://stackoverflow.com/q/25996562
tags question: http://stackoverflow.com/q/25909198
tags question: http://stackoverflow.com/q/25924943
tags question: http://stackoverflow.com/q/25939906
tags question: http://stackoverflow.com/q/25877215
tags question: http://stackoverflow.com/q/25953933
tags question: http://stackoverflow.com/q/25930174
tags question: http://stackoverflow.com/q/25951124
tags question: http://stackoverflow.com/q/25875124
tags question: http://stackoverflow.com/q/26022178
tags question: http://stackoverflow.com/q/26013582
tags question: http://stackoverflow.com/q/26030534
tags question: http://stackoverflow.com/q/25881699
tags question: http://stackoverflow.com/q/26019086
tags question: http://stackoverflow.com/q/26003171
tags question: http://stackoverflow.com/q/25983128
tags question: http://stackoverflow.com/q/25902974
tags question: http://stackoverflow.com/q/25948000
tags question: http://stackoverflow.com/q/25886711
tags question: http://stackoverflow.com/q/25952535
tags question: http://stackoverflow.com/q/25891618
tags question: http://stackoverflow.com/q/25938601
tags question: http://stackoverflow.com/q/25950526
tags question: http://stackoverflow.com/q/25970634
tags question: http://stackoverflow.com/q/25887486
tag name: json
tags question: http://stackoverflow.com/q/25937513
tags question: http://stackoverflow.com/q/26022654
tags question: http://stackoverflow.com/q/25896360
tags question: http://stackoverflow.com/q/25895202
tags question: http://stackoverflow.com/q/25991192
tags question: http://stackoverflow.com/q/26034097
tags question: http://stackoverflow.com/q/25894559
tags question: http://stackoverflow.com/q/25990920
tags question: http://stackoverflow.com/q/25904787
tags question: http://stackoverflow.com/q/25941137
tags question: http://stackoverflow.com/q/25894363
tags question: http://stackoverflow.com/q/25957933
tags question: http://stackoverflow.com/q/25957818
tags question: http://stackoverflow.com/q/25992944
tags question: http://stackoverflow.com/q/25953056
tags question: http://stackoverflow.com/q/26014972
tags question: http://stackoverflow.com/q/26000836
tags question: http://stackoverflow.com/q/25885186
tags question: http://stackoverflow.com/q/25951070
tags question: http://stackoverflow.com/q/26027275
tags question: http://stackoverflow.com/q/25877741
tags question: http://stackoverflow.com/q/25881024
tags question: http://stackoverflow.com/q/25970291
tags question: http://stackoverflow.com/q/25881010
tags question: http://stackoverflow.com/q/25927427

http://stackoverflow.com/q/25986719
has title: Four Color Theorem java solution
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40694537
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40694681
type: Question
linked to: http://stackoverflow.com/q/20306116
tagged with: algorithm
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/40694289
has comment: http://stackoverflow.com/comment/40694130
tagged with: matrix
score: 1
has body: I'm trying to implement the four color theorem. The four‐color theorem states that any map in a plane can be colored using four‐colors in such a way that regions sharing a common boundary (other than a single point) do not share the same color. There is a map separated into regions and the regions are put into an adjacency matrix and by using four colors I'm trying to color the map so that no two contiguous regions share the same color. The adjacency matrix is used to encode which region borders on another region. The columns and rows of the matrix are the regions while the cells contain a 0 if the two regions are not adjacent and a 1 if they border. EDIT It has to be recursive The adjacency matrix I am using is: A B C D A 0 1 1 1 B 1 0 1 0 C 1 1 0 1 D 1 0 1 0 I am stuck on where to go from here. Thanks for help in advance. Heres my code: public class FourColorTheorem { public static int[][] nums = {{0,1,1,1},{1,0,1,0},{1,1,0,1},{1,0,1,0}}; public static int[] states; public static int[][] border; public static int[] setNeighs; public static int[][] neighbors; public static void main(String[] args) { createStatesArray(); printArray(); if(tryColor(0)) System.out.println("Works"); else System.out.println("Did not color all"); } public static int[][] checkNeighbors(int r) { border = new int[4][4]; for(int i=0;i&lt;4;i++) { if(nums[r][i] == 0) border[r][i] = -1; else border[r][i] = 1; } return border; } public static void setNeighbors(int r) { for(int x = r;x&lt;4;x++) { setNeighs[x] = states[x+1]; } } public static boolean tryColor(int row) { int p=0; boolean q = false; if(row&gt;4) return true; if(states[row] == 0) { states[row] = 1; setNeighbors(row); } if(row&gt;1) if(setNeighs[row] == setNeighs[row-1]) return false; int[][] temp = checkNeighbors(row); return false; } public static void printArray() { for(int i=0;i&lt;4;i++) { for(int j=0;j&lt;4;j++) { System.out.print(nums[i][j]); } System.out.println(); } addBorder(); } public static void createStatesArray() { sta…
has comment: http://stackoverflow.com/comment/40694055
tagged with: theorem
favorite count: 0
has comment: http://stackoverflow.com/comment/40694517
has comment: http://stackoverflow.com/comment/40694471

http://stackoverflow.com/comment/40642220
has text: The mortennobel library uses a box filter and as such is not what you ask for -- nearest neighbor. Have you considered writing the code yourself? Iterating over raw image pixels, without any filtering, is not that hard.
comment on: http://stackoverflow.com/q/25958699
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25997211
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40712505
has body: MessageFormat uses an localized representation, with thousands separators, maybe decimal comma and so on. In your usage it uses the default locale of your platform. Something one should keep separate from the universal programmer's notation, valueOf/toString. Using double and precision is a bit of an oxymoron, as the decimal representation is an approximation of the sum of powers of 2 that a double is internally. To keep the full information you could store the raw bits in a textual form, using Double.doubleToRawLongBits and on the way back longBitsToDouble. double x = Math.PI; String repr = String.format("%016x", Double.doubleToRawLongBits(x)); x = Double.longBitsToDouble(Long.valueOf(repr, 16));
answers question: http://stackoverflow.com/q/25986568
has comment: http://stackoverflow.com/comment/40712961

http://stackoverflow.com/a/25929026
has comment: http://stackoverflow.com/comment/40591842
upvote count: 1
has comment: http://stackoverflow.com/comment/40590649
has comment: http://stackoverflow.com/comment/40591166
has comment: http://stackoverflow.com/comment/40591713
has comment: http://stackoverflow.com/comment/40592517
has comment: http://stackoverflow.com/comment/40591589
has comment: http://stackoverflow.com/comment/40592052
has comment: http://stackoverflow.com/comment/40591797
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40592235
type: Answer
has body: Try the following steps, maybe you missed some: Copy google play service lib into your lib folder Copy android supported v4 lib in your lib folder Add google play service lib and android supported v4 to your build path import google play service project into your workspace select your project and right click>properties>android>add project lib(the google play service) and do not tick "is library" Select the google play service project and right click and go to properties>android>tick "is lib" Use FragmentActivity and use Support to use supported libs. Clean and rebuild, exit eclipse, uninstall app previously on your device, load eclipse and do another clean and rebuild.
has comment: http://stackoverflow.com/comment/40591859
answers question: http://stackoverflow.com/q/25928681

http://stackoverflow.com/q/25954791
tagged with: pixel
tagged with: java
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40687027
tagged with: canvas
tagged with: arrays
type: UnansweredQuestion
has title: Java BufferedImage pixel[] getting the right pixel
upvote count: 0
has body: Hello im trying to draw a rectangle using the pixel array that I got from pixels = ((DataBufferInt)image.getRaster().getDataBuffer()).getData(); But I cant seem to get the right pixel. Im trying to use public void p_fillRect(int color, int x, int y, int width, int height) { for (int xpos = x; xpos &lt; width; xpos++) { for (int ypos = y; ypos &lt; height; ypos++) { pixels[xpos + ypos * em.getGame().getWidth()] = color; } } } but its not working as I expected please help! Here is a link to the current state of the loop : https://i.sstatic.net/7wrCD.jpg Here is a link for the result of the program : https://i.sstatic.net/D9sbL.jpg
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/25954946
type: Question

http://stackoverflow.com/q/25956435
type: Question
upvote count: 4
answer count: 2
has body: I have tried over and over to find a solution to this problem, but I seem to can't understand how to solve it. I'm trying to write a simple program to draw a circle with these specifications in the program: Ask the user for the radius of a circle using an input box (JOptionPane). Ask the user for the x and y coordinates of the circle in an input box (JOptionPane). Calculate circumference of the circle. Calculate area of the circle. Display area and circumference below drawing of circle. Somehow, it won't draw the circle, and calculate the circumference and area. Can you please help me find a solution to this problem? Here are my codes: ------- main ------- package circleSquarePackage; import circleSquarePackage.Circle; import javax.swing.JOptionPane; import javax.swing.JFrame; public class CircleTester { public static void main(String[] args) { JFrame frame = new JFrame(); // Display Circle in the frame frame.setSize(600, 500); frame.setTitle("CircleSquare"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Create Circle Components Circle round = new Circle(); frame.add(round); frame.setVisible(true); } } -------- other class --------- package circleSquarePackage; import javax.swing.JComponent; import java.awt.geom.Ellipse2D; import java.awt.geom.Ellipse2D.Double; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Color; import javax.swing.JOptionPane; public class Circle extends JComponent { // Member instance field private Ellipse2D.Double sphere; private int radius; double circumference, area; String x1; // starting x co-ordinate String y1; // starting y co-ordinate String r1; // radius for circle String draw; int x = 0; int y = 0; int r = 0; // Default constructor public Circle() { sphere = new Ellipse2D.Double(); } // User defined constructor public Circle(int xAxis, int yAxis, int rad) { rad = r; xAxis = x; yAxis = y; sphere = new Ellipse2D.Double(xAxis, yAxis, rad, rad); } // Accessor methods public double calcCircumference() { retu…
downvote count: 0
has answer: http://stackoverflow.com/a/25956523
tagged with: paintcomponent
has title: Drawing a circle based from user input in Java
favorite count: 0
score: 4
tagged with: joptionpane
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25956478
tagged with: swing
tagged with: java

http://stackoverflow.com/a/25943715
downvote count: 0
answers question: http://stackoverflow.com/q/25943597
type: Answer
score: 3
upvote count: 3
has body: You could use String.format String.format("Hello: %s%n Weight in kilograms: %d%n Height in meters: %d%n BMI: %d", name, weightKilograms, heightMeters, (int)bmi) This will also give you a platform independent line separator (as opposed to "\n"), see How do I get a platform-dependent new line character?

http://stackoverflow.com/q/25875560
score: 0
has title: Center popUpView in the middle of the view
tagged with: android
has comment: http://stackoverflow.com/comment/40493677
answer count: 0
has comment: http://stackoverflow.com/comment/40493084
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40649817
tagged with: java
type: Question
tagged with: layout
has body: I want to center my created popUpView in the center of the view. I want it horizontally and vertically centered. I've tried a lot of things, but I keep stuck with it. Here's my java code: public class Gevaar extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); final Button btnOpenPopup = (Button)findViewById(R.id.button1); btnOpenPopup.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View arg0) { LayoutInflater layoutInflater = (LayoutInflater)getBaseContext() .getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.popup, null); final PopupWindow popupWindow = new PopupWindow( popupView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); Button btnDismiss = (Button)popupView.findViewById(R.id.dismiss); btnDismiss.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub popupWindow.dismiss(); }}); popupWindow.showAsDropDown(btnOpenPopup, 100, 100); }}); } } Here the .xml: <?xml version="1.0" encoding="utf-8"?> <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/blaar" />

http://stackoverflow.com/comment/40595046
comment on: http://stackoverflow.com/a/25930594
score: 0
type: AnswerComment
has text: @HArdik I've modified my example
type: Comment

http://stackoverflow.com/a/25949735
accepted answer of: http://stackoverflow.com/q/25947892
answers question: http://stackoverflow.com/q/25947892
has body: public class MyFrame(){ SpinnerModel spinnerModel = new SpinnerNumberModel(0,0,999,1); JSpinner anlist = new JSpinner(spinnerModel); JPanel panel1 = new JPanel(); public MyFrame(){ panel1.add(anlist); } }
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/25874588
type: Answer
has comment: http://stackoverflow.com/comment/40518212
downvote count: 0
has body: Here is another way. Make an object wrapper around JPanel and JLabel and use that as the value. class JWrapper { JPanel panel; JLabel label; // Constructor, getters, setters ... } // ... HashMap&lt;String, JWrapper&gt; map = new HashMap&lt;String, JWrapper&gt;(); // ...
has comment: http://stackoverflow.com/comment/40512002
score: 3
answers question: http://stackoverflow.com/q/25874457
has comment: http://stackoverflow.com/comment/40552789
upvote count: 3

http://stackoverflow.com/q/25996718
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/25996783
duplicate of: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/25996781
type: UnansweredQuestion
has title: HashMap reference not changing
type: Question
answer count: 2
has body: I have created a new HashMap Object say. Now I pass this object to a method where I change the reference of the variable to some other hashmap object .The reference to this new object is not reflected once the method is completed Example : Map&lt;String, Boolean&gt; map = new HashMap&lt;String, Boolean&gt;(); changerefofMap(HashMap&lt;String, Boolean&gt;() map) { map=methodwhichreturnSomeMap(); System.out.println(map.size()); //returns 2 } System.out.println(map.size()); //returns 0 I don't understand why the reference is not getting changed.

http://stackoverflow.com/comment/40710338
has text: That's because you are printing the return value which is the last value of answer. Hence twice.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25994700
type: Comment

http://stackoverflow.com/a/25955521
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25944566
answers question: http://stackoverflow.com/q/25944566
type: Answer
has comment: http://stackoverflow.com/comment/40651715
has body: This may not be because of your code or Libgdx, it may be an issue with your keyboard. Sometimes, in most average keyboards, 3 (or more) keys being pushed at once will not work if they are close together. This phenomenon is known as keyboard ghosting. I've noticed that the keys not working for you are relatively closer to each other (in physical distance) compared to the other combinations. Try using that same combinations in the link provided, and maybe try using another keyboard/machine to test that code. If the problem lies in your keyboard, you might want to consider letting your code support variable key definitions instead of hard-coded ones for anyone using a similar keyboard.
upvote count: 1
score: 1

http://stackoverflow.com/q/26026274
upvote count: 1
tagged with: swing
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40766873
has comment: http://stackoverflow.com/comment/40767539
tagged with: swingworker
has comment: http://stackoverflow.com/comment/40767210
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/25963481
has comment: http://stackoverflow.com/comment/40767105
has answer: http://stackoverflow.com/a/26026898
linked to: http://stackoverflow.com/q/25694806
has comment: http://stackoverflow.com/comment/40766770
has comment: http://stackoverflow.com/comment/40766154
favorite count: 0
type: Question
has body: I'm doing a program that creates some Excel files (.xlsx) in an specific folder and I've got a problem with GUI because it's freeze when I call to the method that creates this files. I want that in the GUI there was a progress bar indeterminate that doesn't stot except there was an exception and a JLabel to show the excel file that it's in creation. MailPanel class: it's the interface, when I click in a button called "Generate" calls to the method "generateExcel" of the class GenerateExcel() public class MainPanel extends JPanel { ..... ..... btnGenerate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jsonFileIssues = ..... ; jsonFileProject = ..... ; Project project = ..... ; key = project.getKey(); category = project.getCategory(); String ruta = "C:\\JIRA\\JIRA-Proyectos\\" + category + "\\"; ..... GenerateExcelExterno gee = new GenerateExcelExterno(jsonFileProject, jsonFileIssues, key, ruta, excelFile); gee.execute(); ..... } } ..... ..... } GenerateExcel class: where it's the importante method to generate the files I know that I've to add SwingWorker to the GenerateExcel class to unfreeze the GUI, but I can't get it! The method CREATES the documents, so the doInBackground works, but the progress bar in the panel continues freezed... public class GenerateExcel extends SwingWorker&lt;Integer, Void&gt; { String jsonFileProject, jsonFileIssues, key, ruta, excelFile; public GenerateExcel(String jsonFileProject, String jsonFileIssues, String key, String ruta, String excelFile) { super(); this.jsonFileProject = jsonFileProject; this.jsonFileIssues = jsonFileIssues; this.key = key; this.ruta = ruta; this.excelFile = excelFile; } public static void generateExcel(String jsonFileProject, String jsonFileIssues, String key, String ruta, String excelFile) { ..... ..... ..... } @Override protected Integer doInBackground() throws Exception { // TODO Auto-generated method stub generateExcelExterno(jsonFileProject, jsonFileIssues, key, ruta, …
has comment: http://stackoverflow.com/comment/40766218
has title: How to use SwingWorker to avoid freeze GUI
tagged with: freeze
linked to: http://stackoverflow.com/q/26005435
has comment: http://stackoverflow.com/comment/40767302
score: 0
tagged with: multithreading

http://stackoverflow.com/comment/40717188
comment on: http://stackoverflow.com/a/25999304
has text: Thanks! However, now that I have both running, when I kill the application through Ctrl+C the first process that I started never gets killed along with it. Do I have to catch the KeyboardInterruption?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/67566412
type: AnswerComment
type: Comment
has text: Thanks for your suggestion, really great
comment on: http://stackoverflow.com/a/40144272
score: 1

http://stackoverflow.com/comment/40568311
type: QuestionComment
has text: @LalitKumarB, thanks, updated with edit comments
comment on: http://stackoverflow.com/q/25916460
score: 0
type: Comment

http://stackoverflow.com/q/25891737
has answer: http://stackoverflow.com/a/49458983
answer count: 3
downvote count: 0
tagged with: log4j
has title: Getting Exception org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25894425
has comment: http://stackoverflow.com/comment/40522216
score: 49
tagged with: java
has answer: http://stackoverflow.com/a/78185308
has comment: http://stackoverflow.com/comment/97710435
upvote count: 49
type: Question
has body: My code is very simple using apache-log4j-2.0.2: import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; public class Log4jtest { static Logger log =Logger.getLogger(Log4jtest.class); public static void main(String[] args) { BasicConfigurator.configure(); log.debug("This is debug message"); } } But I'm getting exception like: Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext`` at org.apache.log4j.Logger.getLogger(Logger.java:41) at Log4jtest.&lt;clinit&gt;(Log4jtest.java:11) Why is the exception coming from a simple program?

http://stackoverflow.com/q/25881659
has body: Trying to preserve my string formatting. When I open my .txt file, everything just gets written to one line. String page = t.toString(); //this is my formatting String String fileName = t.getSymbol(); //just helps me name the file (not important) File file = new File("C:/Users/user1234212/desktop/folder1" + fileName + ".txt"); //not important here file.getParentFile().mkdirs(); // also not important FileWriter fw = new FileWriter(file.getAbsoluteFile()); //why does this reformat page ? BufferedWriter bw = new BufferedWriter(fw); bw.write(page); bw.close(); RESULT SHOULD BE: title: other info: Name: joe john title: person Summary... Joe john is a person. Question... no question Answer... ^ This is the String "page"
has comment: http://stackoverflow.com/comment/40534195
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40533938
tagged with: filewriter
has comment: http://stackoverflow.com/comment/40504781
has answer: http://stackoverflow.com/a/25881714
linked to: http://stackoverflow.com/q/3307747
has comment: http://stackoverflow.com/comment/40504554
type: Question
has comment: http://stackoverflow.com/comment/40534163
has comment: http://stackoverflow.com/comment/40534718
has comment: http://stackoverflow.com/comment/40504892
tagged with: java
linked to: http://stackoverflow.com/q/4066958
tagged with: formatting
linked to: http://stackoverflow.com/q/9260126
has comment: http://stackoverflow.com/comment/40504550
has comment: http://stackoverflow.com/comment/40504701
upvote count: 1
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40504563
has comment: http://stackoverflow.com/comment/40534311
favorite count: 0
has comment: http://stackoverflow.com/comment/40504605
score: 0
has title: Keeping String formatting while writting to a file JAVA

http://stackoverflow.com/a/26013598
score: 1
upvote count: 1
has body: If you read the warning carefully, you learn that it is only about javax.* types which probably you do not want to weave anyway. If so, you can safely ignore the warning. If anything else is wrong with your aspects, please show some code and explain what is not working. Ideally, provide an SSCCE, otherwise nobody will be able to help you.
answers question: http://stackoverflow.com/q/25974584
downvote count: 0
type: Answer

http://stackoverflow.com/comment/120186232
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25891232
score: 0
has text: did you find any solution for this?

http://stackoverflow.com/q/25931108
accepted answer: http://stackoverflow.com/a/25970807
has comment: http://stackoverflow.com/comment/40636484
type: Question
tagged with: javascript
score: 0
has title: Code inserting into database twice
answer count: 1
has answer: http://stackoverflow.com/a/25970807
tagged with: alloy-ui
type: AnsweredQuestion
tagged with: liferay-aui
has body: I have the form &lt;aui:form action="&lt;%= editURL %&gt;" method="POST" name="fm"&gt; &lt;aui:fieldset&gt; &lt;aui:input name="name" /&gt; &lt;aui:input name="url" /&gt; &lt;aui:input name="address" /&gt; &lt;/aui:fieldset&gt; &lt;aui:button-row&gt; &lt;aui:button type="submit" /&gt; &lt;aui:button name="cancel" value="Cancel"/&gt; &lt;/aui:button-row&gt; &lt;/aui:form&gt; and this piece of javascript code which is inserting into database twice I don't know why. &lt;aui:script use="aui-base,aui-form-validator,aui-io-request"&gt; AUI().use('aui-base','aui-form-validator',function(A){ var rules = { &lt;portlet:namespace/&gt;name: { required: true }, &lt;portlet:namespace/&gt;url: { url: true }, &lt;portlet:namespace/&gt;address: { required: true }, }; var fieldStrings = { &lt;portlet:namespace/&gt;name: { required: 'The Name field is required.' }, &lt;portlet:namespace/&gt;address: { required: 'The Address field is required.' }, }; alert("validator"); new A.FormValidator({ boundingBox: '#&lt;portlet:namespace/&gt;fm', fieldStrings: fieldStrings, rules: rules, showAllMessages:true, on: { validateField: function(event) { }, validField: function(event) { }, errorField: function(event) { }, submitError: function(event) { alert("submitError"); event.preventDefault(); //prevent form submit }, submit: function(event) { alert("Submit"); var A = AUI(); var url = '&lt;%=editURL.toString()%&gt;'; A.io.request( url, { method: 'POST', form: {id: '&lt;portlet:namespace/&gt;fm'}, on: { success: function() { alert("inside success");// not getting this alert. Liferay.Util.getOpener().refreshPortlet(); Liferay.Util.getOpener().closePopup('popupId'); } } } ); } } }); }); &lt;/aui:script&gt; However if I add the following piece of code, which is redundant because it is already present inside the submit block of above code and is not triggered any way because I do not have any save button in the form, then the value is inserted only once. &lt;aui:script use="aui-base,aui-io-request"&gt; …
tagged with: java

http://stackoverflow.com/comment/40595779
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25927885
has text: For future reference, whenever posting a Swing MCVE, make sure you call `frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)`, so that we don't end up with a million background programs (like I just did right now :-), when testing
score: 1

http://stackoverflow.com/comment/40671526
comment on: http://stackoverflow.com/a/25972433
score: 0
has text: I followed those instructions but when I try to add the .jar files I can't seem them in Eclipse. I've restarted Eclipse already. ~~EDIT~~ Nevermind, I figured it out.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40636746
score: 0
type: Comment
type: QuestionComment
has text: I have to be able to use any other strings like "John went to the store", and the expected output be "John \n went \n to \n the \n store". I could use substring method to print the words, but it wouldn't be applicable to other strings.
comment on: http://stackoverflow.com/q/25955669

http://stackoverflow.com/comment/40899940
type: AnswerComment
type: Comment
has text: In order to compile this code in Eclipse I had to include jsch.jar (for the com.jcraft.jsch.Session) However this time when I run the program (which is an Eclipse plugin that depends on jgit plugin), I got the following error. java.lang.LinkageError: loader constraint violation: loader previously initiated loading for a different type with name "com/jcraft/jsch/Session" Any ideas?
comment on: http://stackoverflow.com/a/25952811
score: 0

http://stackoverflow.com/comment/40568630
type: QuestionComment
comment on: http://stackoverflow.com/q/25916099
has text: You want `"content://sms/inbox"` for the URI, and you shouldn't be using constants for the column indices. Let me run a test, and I'll post an answer.
score: 1
type: Comment

http://stackoverflow.com/comment/40666063
type: AnswerComment
has text: Glad you found what you needed. User sc0p answer also provided some good information regarding risk/implementation approaches.
type: Comment
comment on: http://stackoverflow.com/a/25964758
score: 0

http://stackoverflow.com/comment/40605244
score: 1
comment on: http://stackoverflow.com/a/25935780
type: AnswerComment
has text: as part and product are foreignkeys it should go to the original tables to get the entire object or row. You only have productid and partid in your product_part table, right?Keeping that aside, Also, you are passing partId and productId as argumetnts which are integers,if I'm correct. how can you check equals on type Part to type Int? so that's why you have to access part.part which is an int for partId to match.Hope you got it.
type: Comment

http://stackoverflow.com/a/25911669
type: Answer
has body: The problem was : log4j.additivity.appender.appenderProcesoWREG=false I have changed it for: log4j.appender.appenderProcesoWreg = org.apache.log4j.DailyRollingFileAppender log4j.appender.appenderProcesoWreg.File = C\:\\OEGAM_FILES\\FICHEROS_LOGS\\PROCESO_WREG\\LOCAL\\procesoWreg.log log4j.appender.appenderProcesoWreg.layout = org.apache.log4j.PatternLayout log4j.appender.appenderProcesoWreg.layout.ConversionPattern = %d{dd/MM HH:mm:ss} %-5p ([%-30F]:%-30M) = %m %n log4j.logger.ProcesoWreg = INFO,appenderProcesoWreg log4j.additivity.PocesoWreg = false And it works perfect
upvote count: 2
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25911236

http://stackoverflow.com/q/25998423
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/43922197
accepted answer: http://stackoverflow.com/a/29935013
possible better answer: http://stackoverflow.com/a/43922197
score: 0
has body: I need to get some details about a VirtualMachine like the VM Name, the DNS Name, the Resourcepool and the Host via the vShpere API. I found a way to search for the VM but I don't know how I can get this details. Has anyone done this? Thanke you Stephan
tagged with: vsphere
has answer: http://stackoverflow.com/a/29935013
has title: vSphere WebServervice API get VirtualMachine Details
tagged with: web-services
type: AnsweredQuestion
tagged with: vmware

http://stackoverflow.com/comment/40601062
type: Comment
has text: If you can edit your answer in some way, I can stop my downvote
type: AnswerComment
comment on: http://stackoverflow.com/a/25934930
score: 0

http://stackoverflow.com/comment/40619531
has text: Take a look at http://stackoverflow.com/questions/4584541/check-if-a-class-is-subclass-of-another-class-in-java
comment on: http://stackoverflow.com/q/25945288
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25882631
possible better answer: http://stackoverflow.com/a/25882645
has title: Difference between null!=variable and variable!=null
has answer: http://stackoverflow.com/a/25882645
tagged with: compare
has answer: http://stackoverflow.com/a/25882898
has comment: http://stackoverflow.com/comment/40506165
favorite count: 0
has comment: http://stackoverflow.com/comment/40506177
has answer: http://stackoverflow.com/a/25882671
type: AnsweredQuestion
has body: What is the difference between null!=variable and variable!=null Which method is perfect to use? if ((null != value1) || (null != value2) || (null != value3)) { ....... ....... ....... } or if ((value1 != null) || (value2 != null) || (value3 != null)) { ....... ....... ....... } Please suggest the best one and the logical change between these?
has answer: http://stackoverflow.com/a/25882789
score: 7
tagged with: java
upvote count: 7
has comment: http://stackoverflow.com/comment/40506129
accepted answer: http://stackoverflow.com/a/25882671
type: Question
tagged with: null
has answer: http://stackoverflow.com/a/25882743
downvote count: 0
has answer: http://stackoverflow.com/a/25901446
answer count: 6
tagged with: comparison

http://stackoverflow.com/comment/40664692
has text: Added beanRefContext xml //beanRefContext.xml to main thread
score: 0
comment on: http://stackoverflow.com/q/25966888
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40599484
type: Comment
type: QuestionComment
has text: 1.4??? You know that is not supported for many years now, right?
comment on: http://stackoverflow.com/q/25933314
score: 0

http://stackoverflow.com/comment/40630052
type: Comment
comment on: http://stackoverflow.com/a/25952119
has text: @emeraldjava I'm not sure what you want me to do with my Account class? It's abstract now since I have abstract methods. How do I make it an interface instead?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26020895
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26020854
has body: You have: //Making our variables equivlent to these equations. if (a &gt; 0 || b &gt; 0 || c &gt; 0) { This means: "If any of a, b and c are positive" You seem to want to say: // If a, b and c are all positive if (a &gt; 0 &amp;&amp; b &gt; 0 &amp;&amp; c &gt; 0) { Or possibly what you want is: // If a, b and c are all non-negative if (a &gt;= 0 &amp;&amp; b &gt;= 0 &amp;&amp; c &gt;= 0) { and then your else clause can just have: // otherwise, a, b or c must be negative else { ... http://en.wikipedia.org/wiki/Logical_conjunction

http://stackoverflow.com/comment/40617799
type: Comment
comment on: http://stackoverflow.com/a/25944073
has text: Your test is fine, but no. There are exactly two `\n` in your text, which means two terminated lines and nothing more. The common understanding is that an empty line at EOF looks like `\n\n` (e.g., the whole text would be `a\nb\n\n`).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40745175
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25999028
type: Comment
has text: That sounds reasonable, considering that the GC usually runs in its own thread. However, if this is really true, then what are ReferenceQueues really good for? Did the authors of the ReferenceQueue class really not consider this?

http://stackoverflow.com/q/26004410
tagged with: sqlite
answer count: 1
has answer: http://stackoverflow.com/a/26017831
has comment: http://stackoverflow.com/comment/40747039
has body: So my issue is quite interesting. I have searched for an answer and unfortunately nothing helps. Ive been developing an app and have run into a small issue. Today, a colleague of mine mentioned that the app should allow users to select a specific record from the database and then edit it. So I added the following code: _dbw.update(TABLE_CHRG_DATA, values, COLUMN_KEY + "=?", new String[] {recordNum}); The issue is that instead of updating the record, it adds a new record, which I had thought should not happen with update(). Anyway, I am wondering what the hell is going on here and would very much appreciate some assistance. I have tried everything I can think of, but the code continues to add a new record, rather than editing the existing record. I think I just need a second opinion, heh., TIA Brad.
has comment: http://stackoverflow.com/comment/40726244
tagged with: android
has comment: http://stackoverflow.com/comment/40746913
has comment: http://stackoverflow.com/comment/40748535
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26017831
type: Question
has comment: http://stackoverflow.com/comment/40726559
has comment: http://stackoverflow.com/comment/40748277
has title: Android - SQLite - update()
has comment: http://stackoverflow.com/comment/40726376
tagged with: sql-update

http://stackoverflow.com/q/25985295
answer count: 1
tagged with: jvm
favorite count: 0
has body: How exactly does the JVM use a stack to run a program? I have been told that each line of code is added into a stack... but if a stack is a LIFO data-structure... wouldn't that mean that your program is run backwards? Or have I been told wrong? Edit: package test; public class Testing { public static void main(String args[]) { method2(); } public static void method() { System.out.println(MyErrorHere); } public static void method2() { method(); } } Returns the following stack trace: Exception in thread "main" java.lang.Error: Unresolved compilation problem: MyErrorHere cannot be resolved to a variable at test.Testing.method(Testing.java:11) at test.Testing.method2(Testing.java:14) at test.Testing.main(Testing.java:7) Each method called is added into a stack created in the main method?
has comment: http://stackoverflow.com/comment/40691584
accepted answer: http://stackoverflow.com/a/25985347
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40691576
downvote count: 2
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25985347
has title: How does the JVM Stack Work?

http://stackoverflow.com/q/25982237
upvote count: 1
tagged with: methods
type: Question
tagged with: arrays
has body: I would like to use (For a string array) public void addFirst(String Element) { } and public void addLast(String Element){ } I know the add I would use public void add(int index, String element) { int len = names.length; if (index &lt; len) names[index] = element; else { names = Arrays.copyOf(names, len + (index - len + 1)); names[index] = element; } } would I just change index to 0 to element?
accepted answer: http://stackoverflow.com/a/25982845
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/25982845
type: AnsweredQuestion
has title: Using addFirst and addLast methods with StringBuilder in java?
score: 1
tagged with: java

http://stackoverflow.com/comment/40540158
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25901442
has text: It really depends where the coordinates are coming from. It seems like you've already figured out how to solve the problem, though - are you just looking for an implementation?
score: 0

jdialog
type: Tag
tag name: jdialog
tags question: http://stackoverflow.com/q/26021966

http://stackoverflow.com/q/25997559
tagged with: qtp
tagged with: regex
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/25997780
score: 1
tagged with: java
has title: Regular expressions in VBScript v/s Regular expressions in Java
tagged with: vbscript
has body: While doing a feasibility analysis of a GUI application, we are comparing QTP (VBScript) and Selenium (Java) tools. Selenium being a open source tool does have the advantage when it comes to cost. The GUI application under test has dynamic set of web elements whose properties keep changing. Hence, we are using regular expressions to address that issue. My question is - 1. Is using Regular expression in QTP (VBScript) any different from using Regular expression in Selenium (Java)? 2. Is there a good open source tool which can be used to create regular expressions?
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25998155

http://stackoverflow.com/a/25898258
downvote count: 0
score: 1
upvote count: 1
has body: You have to match the same type provided in the switch statement in each case statement. In your case, the value is a String, so each case statement should be of type string. Currently I'm not sure what type SUMMER, FALL, etc. are. Edit: I see SUMMER, FALL, etc. are of type Season, so, first convert currentSeason to an enum, and switch on that converted value.
type: Answer
answers question: http://stackoverflow.com/q/25898214

http://stackoverflow.com/comment/40534391
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25898030
has text: It's not that you should put the method somewhere else, but you shouldn't have it draw a polygon that doesn't exist (yet).

http://stackoverflow.com/q/25944134
tagged with: codenameone
tagged with: netbeans-7
linked to: http://stackoverflow.com/q/25940663
has comment: http://stackoverflow.com/comment/40617984
answer count: 0
type: UnansweredQuestion
has body: After building an interface using codename one's designer, I started coding into NetBeans and it is highlighting showing an error on all the variable names I gave the input objects I created with the designer. What could I be doing wrong? "NumOne" and "NumTwo" are the names I assigned to the text fields on the designer. NetBeans keeps saying they are undefined variables Here is my code: @Override protected void onMain_BtnAction(Component c, ActionEvent event) { String num1 = NumOne.getText(); String num2 = NumTwo.getText(); calc(num1,num2); }
has comment: http://stackoverflow.com/comment/40621871
has title: Variable names assigned to input/output objects in codename one designer are not being recognised in NetBeans
tagged with: java
type: Question
score: 0

http://stackoverflow.com/q/26031187
score: 3
downvote count: 0
tagged with: scala
tagged with: java
tagged with: maven
type: Question
tagged with: sbt
has answer: http://stackoverflow.com/a/26032052
upvote count: 3
tagged with: intellij-idea
answer count: 1
has body: I have opened several projects in Intellij Idea. A process explorer tool indicates that idea64.exe process uses ~2Gb as private Bytes and 3,5Gb as virtual size. When I closed several big sbt projects, but memory usage stayed the same. Is it a bug? Can I manually run somethink like "refresh" to free memory usage from closed projects?
favorite count: 0
type: UnansweredQuestion
has title: How Intellij idea reduce memory after project was closed?

http://stackoverflow.com/comment/40628936
comment on: http://stackoverflow.com/q/25951526
score: 0
type: QuestionComment
has text: Google "JDBC tutorial"
type: Comment

http://stackoverflow.com/a/25902347
type: Answer
has body: It seems like you're using a pretty unorthodox method, but the easiest solution is to simply use an array of integers: int[] arr = new int[4]; int c = 0; while (c &lt;= 4) { // loop until 4 values have been given System.out.print("Enter the number of Item " + (c + 1) + " you would like to purchase: "); arr[c] = input.nextInt(); c++; } Printing c + 1 makes the output human readable, while keeping your array accession zero-indexed. I removed x from the loop condition, as it was not being used.
answers question: http://stackoverflow.com/q/25902204
has comment: http://stackoverflow.com/comment/40541797
score: 0

http://stackoverflow.com/a/25962568
type: Answer
accepted answer of: http://stackoverflow.com/q/25961574
score: 1
answers question: http://stackoverflow.com/q/25961574
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: try add a newline to the string you sent to server , something like : out.write(code+"\n"); out.flush(); and as EJP said above put the out.write inside the try / catch

http://stackoverflow.com/q/25974300
has comment: http://stackoverflow.com/comment/40671225
tagged with: http://stackoverflow.com/tag/c
has title: On what factors JVM dependent on Operating system
score: 0
upvote count: 1
tagged with: jvm
favorite count: 0
has body: We know that Java is platform independent but JVM is platform dependent. Byte Code is converted into machine code by Java Interpreter. I want to know on which factors jvm is dependent on uderlying operating system. I also want to know what C language does to source code that the compiled code can not run in another operating system .
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40671286
has comment: http://stackoverflow.com/comment/40670762
answer count: 0
has comment: http://stackoverflow.com/comment/40671149
has comment: http://stackoverflow.com/comment/40671250
tagged with: java
has comment: http://stackoverflow.com/comment/40670549
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40671477

http://stackoverflow.com/q/26015982
type: UnansweredQuestion
has body: I was trying to use the annotation @FieldMatch in a web application with Spring Framework. These are the jars i added but Eclipse tells me "FieldMatch cannot be resolved to a type"; I thought I needed Hibernate jars but I was wrong. What jar i need?
has answer: http://stackoverflow.com/a/26016034
type: Question
tagged with: spring
has title: @FieldMatch cannot be resolved to a type (Spring Framework)
linked to: http://stackoverflow.com/q/1972933
answer count: 1
score: 0
tagged with: java
tagged with: jsp

http://stackoverflow.com/q/25932063
has comment: http://stackoverflow.com/comment/40595730
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25933063
has comment: http://stackoverflow.com/comment/40597016
has body: Ok I'm sure I'm doing something wrong here. result = [] for (aMp in arMap) { println("0 " + result) println("1 " + aMp) println("2 " + delegate.findSingleMap(aMp)) result.addAll(delegate.findSingleMap(aMp)) println "3 " + result } return result The println result are the following: (I have 2 element in arMap, so it print the four value 2 times) 0 [] 1 [ID:XXX, Type:4] 2 First:21/Nov/2013, Type:4, error code:SXR07, ID:XXX, Test ID:5 3 First:21/Nov/2013, Type:4, error code:SXR07, ID:XXX, Test ID:5 0 First:21/Nov/2013, Type:4, error code:SXR07, ID:XXX, Test ID:5 1 [ID:YYY, Type:4] 2 First:12/Oct/2012, Type:4, error code:SXR07, ID:YYY, Test ID:6 3 First:12/Oct/2012, Type:4, error code:SXR07, ID:YYY, Test ID:6 As you can see the findSingleMap function work properly, but the second time I use the AddAll, my result array loose the value XXX. What am I doing wrong?
score: 0
tagged with: groovy
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/40597107
has comment: http://stackoverflow.com/comment/40596821
has comment: http://stackoverflow.com/comment/40595746
has title: Groovy Array.addAll method remove the elements from original array
has answer: http://stackoverflow.com/a/25933063
type: AnsweredQuestion

http://stackoverflow.com/comment/40606747
type: Comment
has text: Wish I could accept answers. Although answer below is a very original solution, this was technically what I asked for although I will experiment with double-click solution.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25919008

http://stackoverflow.com/q/25942198
type: AnsweredQuestion
tagged with: stack
downvote count: 2
has answer: http://stackoverflow.com/a/25942223
type: Question
has comment: http://stackoverflow.com/comment/40614921
score: -2
has comment: http://stackoverflow.com/comment/40615548
tagged with: java
tagged with: char
has title: The character returned is not the same as stored.
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40614729
accepted answer: http://stackoverflow.com/a/25942223
has comment: http://stackoverflow.com/comment/40616834
favorite count: 0
has comment: http://stackoverflow.com/comment/40614824
has body: When I use the infix as 73+2*, the characters are not stored in their current form. it prints other values. It should be printing the first operand as 7, but something else is printed. public char postfixOperation(String infix) { operatorStack.reset(); int firstOperand=0; int secondOperand=0; for(int j=0;j&lt;infix.length();j++){ // loop until the end of the line for a string (expression) // Check for numbers if( infix.charAt(j) =='0' || infix.charAt(j) =='1' || infix.charAt(j) =='2'|| infix.charAt(j) =='3'|| infix.charAt(j) =='4'|| infix.charAt(j) =='5'|| infix.charAt(j) =='6'|| infix.charAt(j) =='7'|| infix.charAt(j) =='8'|| infix.charAt(j) =='9' ){ operatorStack.push(infix.charAt(j)); } //check for '+' else if( infix.charAt(j)=='+'){ firstOperand = operatorStack.pop(); // pop first operand System.out.println(firstOperand); secondOperand = (int) operatorStack.pop(); // pop second operand operatorStack.push((char) (firstOperand + secondOperand)); } //check for '-' else if( infix.charAt(j)=='-'){ firstOperand = (int) operatorStack.pop(); // pop first operand secondOperand = (int) operatorStack.pop(); // pop second operand operatorStack.push((char) (firstOperand - secondOperand)); } //check for '*' else if( infix.charAt(j)=='*'){ firstOperand = (int) operatorStack.pop(); // pop first operand secondOperand = (int) operatorStack.pop(); // pop second operand operatorStack.push((char) (firstOperand * secondOperand)); } //check for '/' else if( infix.charAt(j)=='/'){ firstOperand = (int) operatorStack.pop(); // pop first operand secondOperand = (int) operatorStack.pop(); // pop second operand operatorStack.push((char) (firstOperand / secondOperand)); } } return operatorStack.pop(); }

http://stackoverflow.com/comment/40768823
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26027778
has text: you test `array[i].length`, yet you access `array[j]`

http://stackoverflow.com/comment/40703349
type: Comment
has text: About overlapping transactions - this is just a theoretical question to help me understand. Thanks!
comment on: http://stackoverflow.com/a/25991097
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40714757
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25998403
has text: Usually setters take an argument, in your case it would be an `HtmlForm`. Your setter seems unneeded; its logic should probably be in the getter.

http://stackoverflow.com/a/26034058
has comment: http://stackoverflow.com/comment/40779849
has comment: http://stackoverflow.com/comment/40779902
type: Answer
has body: The best way is to use a map with the name of the player as a key. In that way you can get the list easily without a loop Map&lt;String, List&lt;Players&gt;&gt; players = new HashMap&lt;String,List&lt;Players&gt;&gt;(); players.put("player1", new SomeObject()); players.put("player2", new SomeObject()); .... after that you do that: List&lt;Players&gt; player1 = players.get("player1");
answers question: http://stackoverflow.com/q/26033993
score: 0

http://stackoverflow.com/a/25911036
has comment: http://stackoverflow.com/comment/40558358
has comment: http://stackoverflow.com/comment/40559474
type: Answer
has body: You could try fileArr.removeRange(i, i+sizeOfToReplace); fileArr.addAll(i, replacing);
upvote count: 4
answers question: http://stackoverflow.com/q/25910797
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/25910797

http://stackoverflow.com/comment/40651048
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25956767
score: 0
has text: Add a snippet of HTML.

http://stackoverflow.com/comment/40692836
has text: @HovercraftFullOfEels. No, I just want to capture it when it's typed and tell the user what kind of key event has been captured.
score: 0
comment on: http://stackoverflow.com/q/25986058
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25951163
type: Answer
answers question: http://stackoverflow.com/q/25950676
has body: Here is my custom adapter. I can re-size images by setting params to imageView. Hope this will help you! p.s The worst thing is that in this way you have to create your view each time! It's more slowly than using viewHolder. public class Adapter extends BaseAdapter { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); Activity activity; public Adapter(Activity activity) { this.activity = activity; list.add("Item 1"); list.add("Item 2"); list.add("Item 3"); list.add("Item 4"); list.add("Item 5"); list.add("Item 6"); } @Override public int getCount() { return list.size(); } @Override public Object getItem(int i) { return list.get(i); } @Override public long getItemId(int i) { return 0; } @Override public View getView(int i, View convertView, ViewGroup viewGroup) { LayoutInflater inflater = activity.getLayoutInflater(); convertView = inflater.inflate(R.layout.adapter,null); ImageView imageView = (ImageView) convertView.findViewById(R.id.imageView); TextView textView = (TextView) convertView.findViewById(R.id.textView); textView.setText(list.get(i)); //Condition if (i == 5) { setLayoutParams(imageView,40,40); } else { setLayoutParams(imageView,70,70); } imageView.setImageDrawable(activity.getResources().getDrawable(R.drawable.ic_launcher)); return convertView; } private View setLayoutParams(View view, int width, int height) { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width,height); view.setLayoutParams(params); return view; } }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40629742
upvote count: 1
has comment: http://stackoverflow.com/comment/40629625

http://stackoverflow.com/comment/40623386
comment on: http://stackoverflow.com/a/25937881
score: 0
type: Comment
has text: Thank you for the link. It was useful. But I am yet to come up with a final regX. The problem is that I cannot modify the method. I have to come up with a regX that with capture one name at a time.
type: AnswerComment

http://stackoverflow.com/q/25910498
has title: How to detect java installation from a batch program
type: Question
has answer: http://stackoverflow.com/a/25910817
has body: I want to run a jar file on a client machine using batch script. But the problem is its not clear where is the java installed. There are 3-4 fixed paths where java.exe can exist. How to write a batch script to find where java is installed on any of those predetermined locations and then run a command to execute a jar file. Assume java is not set in the environment variables and no access to windows registry.
tagged with: batch-file
tagged with: windows
answer count: 1
tagged with: jvm
type: UnansweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40556513

http://stackoverflow.com/q/25985327
answer count: 0
tagged with: java
has title: class not found exception using netbeans and command prompt
type: Question
has comment: http://stackoverflow.com/comment/40691571
has comment: http://stackoverflow.com/comment/40693128
score: 0
type: UnansweredQuestion
has body: I'm having a rather annoying problem in my Java application which was put together in Netbeans. When I build the project it tells me everything is fine. I compile it in command prompt and it tells me everything is fine. When I run the .jar locally on my computer (from anywhere including external storage) the application opens just fine. When I open it on another computer or from command prompt it tells me there was a class not found exception. I have done everything from editing the manifest to sacrificing a blank text document named "virgin" to invoke Boolius, the god of computers. Nothing is working out. I have even made a second test app inside Netbeans with a main class that opens a JFram and NOTHING ELSE. It has the "public static void main(string[] args)" line there and accounted for. Same exact problem. I have made all my constructors public. I have made sure I'm using the latest java jdk. I have ensured that my main class is in fact the main class. I have read through all the manuals and tutorials the internet has to offer one after the other with no avail. What can I do? What can I try?
has comment: http://stackoverflow.com/comment/40691715
tagged with: netbeans

http://stackoverflow.com/q/25889377
has comment: http://stackoverflow.com/comment/40520851
possible better answer: http://stackoverflow.com/a/36455661
upvote count: 3
tagged with: refactoring
tagged with: java
has answer: http://stackoverflow.com/a/36455661
accepted answer: http://stackoverflow.com/a/25896173
type: Question
has comment: http://stackoverflow.com/comment/40517713
has body: In order to implement a feature in a project I'm working on, I've had to throw a checked exception from a method which is used, in cascade, by hundreds of other methods throughout tens of other classes in the whole project. Consequently, I have got to do some heavy refactoring which Intellij assists me in doing with pop-ups like this one: Now, while this intellij feature is very helpful, having to go through the whole codebase is still taking a (to me) unbearable amount of time. The task is actually very repetitive: Go through all the "unreported exception XX; must be caught or declared to be thrown" errors. Make the pop up emerge. If the two options shown in the picture are both present, then choose the first one. If only "Surround with try/catch" is present, use that one and substitute the e.printStackTrace() call that gets automatically emitted with code of my own. Repeat from point 1 until no more errors are reported. So, the question is: is there any way to automate this process in IntelliJ?
answer count: 2
tagged with: automation
tagged with: intellij-idea
downvote count: 0
has comment: http://stackoverflow.com/comment/40517901
tagged with: batch-processing
favorite count: 0
has answer: http://stackoverflow.com/a/25896173
has title: Is there a way to automate repetitive refactoring operations in Intellij-IDEA?
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/17033585

http://stackoverflow.com/a/26014536
has comment: http://stackoverflow.com/comment/40814877
has comment: http://stackoverflow.com/comment/40814735
has body: Download the commons-discovery.jar and add it to the classspath.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26014448
upvote count: 1
has comment: http://stackoverflow.com/comment/40887754

http://stackoverflow.com/comment/40623830
score: 0
type: AnswerComment
has text: forgive me for the question sir because im new to netbeans, i just want to know where to insert this int rows to my code above because this is a executeUpdate.
type: Comment
comment on: http://stackoverflow.com/a/25948135

http://stackoverflow.com/comment/40694695
score: 0
type: Comment
type: QuestionComment
has text: @ihaveacode I posted my answer just lemme know what you think about it
comment on: http://stackoverflow.com/q/25986904

http://stackoverflow.com/q/25938462
has answer: http://stackoverflow.com/a/25938569
type: Question
has title: spring mvc - preserve http header during redirect
has body: I am trying to add a http header and redirecting to a external url. But somehow, the header value is read null on the external url. I know we can pass attributes, but what I need is a http header @RequestMapping("/sso") public String sso(@RequestParam("username") final String username, @RequestParam("password") final String password, @RequestParam("TARGET") final String TARGET, HttpServletResponse response, Model model) { // validate user // set response token response.addHeader("token", "abcd1234xyz56sa"); // return "success"; return "redirect:" + TARGET; }
tagged with: servlets
upvote count: 3
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40657993
tagged with: spring
accepted answer: http://stackoverflow.com/a/25938569
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/40543156
has text: I think you need provide more information. I can't find anything just from the code you post.
type: AnswerComment
comment on: http://stackoverflow.com/a/25902813
type: Comment
score: 0

http://stackoverflow.com/comment/40608442
comment on: http://stackoverflow.com/q/25939030
score: 1
has text: Have you heard of array.length?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25957509
answer count: 1
has comment: http://stackoverflow.com/comment/40640040
type: UnansweredQuestion
tagged with: oop
has answer: http://stackoverflow.com/a/25957575
tagged with: java
has body: I am learning OOP concepts and this is in continuation of my previous question. Just for practice, I am designing a deck of cards. I have two patterns in minds public interface ISuit { String getLogo(); String getName(); } public class Card { ISuit suit; Integer n; public Card(ISuit suit, Integer n) { this.suit = suit; this.n = n; } void setSuit(ISuit suit){ this.suit = suit; } void display(){ System.out.println(suit.getName()+","+n); } } Second pattern public interface Icard&lt;T extends ISuit&gt; { T getSuit(); String getNumber(); } public class Queen&lt;E extends ISuit&gt; implements Icard&lt;E&gt; { Class&lt;E&gt; clazz; public Queen(Class&lt;E&gt; clazz) { this.clazz = clazz; } @Override public String getNumber() { return "12"; } @Override public E getSuit() { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } return null; } } Obviously, the first one is more intuitive and straight-forward. Over there, I will 52 objects of cards with right suit, number as parameter. In the second design, I will create 13 classes for each index of cards and then instantiate them with correct suits. In future, if there is a new index, I can create a new class extending Icard. As a newbie, I can't figure out if there are any disadvantages of the second design or if I am violating any design principle. Could somebody please help me with this?
type: Question
has title: Which of these two deck of card design pattern is more stable/ preferred?
score: 0
has comment: http://stackoverflow.com/comment/40639989

http://stackoverflow.com/q/25922158
tagged with: android
has comment: http://stackoverflow.com/comment/40579491
has comment: http://stackoverflow.com/comment/40579634
tagged with: java
has comment: http://stackoverflow.com/comment/40579057
type: Question
has comment: http://stackoverflow.com/comment/40578830
tagged with: android-arrayadapter
score: 0
tagged with: sqlite
answer count: 1
has answer: http://stackoverflow.com/a/25922632
has comment: http://stackoverflow.com/comment/40579526
has title: How to set the view of arrayadapter in listview
has body: I am trying to do the following: Read data from sqlite database Set those data in a listview So I implemented a query to retrieve all the users in the database SQLController.java public List&lt;User&gt; getAllUsers() { List&lt;User&gt; UserList = new ArrayList&lt;User&gt;(); // Select All Query String selectQuery = "SELECT * FROM " + DBHelper.TABLE_USER; Cursor cursor = database.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { User User = new User(); User.set_id(Integer.parseInt(cursor.getString(0))); User.setFname(cursor.getString(1)); User.setLname(cursor.getString(2)); User.setSex(cursor.getString(3)); User.setAge(cursor.getString(4)); // Adding User to list UserList.add(User); } while (cursor.moveToNext()); } // return User list return UserList; } Then I write the code below in the MainActivity.java that extends Acticity UserList = (ListView) findViewById(R.id.memberList_id); List&lt;User&gt; Users = dbcon.getAllUsers(); ArrayAdapter&lt;User&gt; adapter = ArrayAdapter(this, R.layout.user, Users); UserList.setAdapter(adapter); Now I am 100% confused of what I should do next. I know I have to implement the getView ()but when I did it, too much errors appeared. So the question is, whats next? And what's wrong?
type: UnansweredQuestion

http://stackoverflow.com/comment/40705711
type: Comment
has text: Point 1 is actually what I have been working on since I asked the question. It works, although is a little obtuse so I asked the question to see if there is a more conventional way really.
type: AnswerComment
comment on: http://stackoverflow.com/a/25993400
score: 0

http://stackoverflow.com/q/25887715
has body: I am using an HotSpot JVM 1.6.0_45 on Solaris. Here are my options concerning Heap: -Xms8G -Xmx8G -XX:MaxTenuringThreshold=14 -XX:NewSize=2184M -XX:MaxNewSize=2184M -XX:SurvivorRatio=1 With that settings I expect that my Eden size and 2 Survivors will all have the same size of 728M. Following observation into VisualVM/VisualGC, it is what we get. Here an extract of my verbose gc logs: 2014-09-16T16:42:15.357+0200: 6.796: [GC 6.796: [ParNew Desired survivor size 381681664 bytes, new threshold 14 (max 14) - age 1: 16125960 bytes, 16125960 total - age 2: 16259512 bytes, 32385472 total - age 3: 2435240 bytes, 34820712 total - age 4: 17179320 bytes, 52000032 total - age 5: 43986952 bytes, 95986984 total - age 6: 20858328 bytes, 116845312 total - age 7: 31571664 bytes, 148416976 total - age 8: 41614872 bytes, 190031848 total - age 9: 33191568 bytes, 223223416 total - age 10: 22887432 bytes, 246110848 total - age 11: 168 bytes, 246111016 total - age 12: 184 bytes, 246111200 total : 1006811K-&gt;407353K(1490944K), 0.3248414 secs] 1006811K-&gt;407353K(7643136K), 0.3252604 secs] [Times: user=3.70 sys=0.04, real=0.33 secs] 2014-09-16T16:42:24.650+0200: 16.089: [GC 16.089: [ParNew Desired survivor size 381681664 bytes, new threshold 14 (max 14) - age 1: 21959968 bytes, 21959968 total - age 2: 11169584 bytes, 33129552 total - age 3: 15663128 bytes, 48792680 total - age 4: 2435168 bytes, 51227848 total - age 5: 17177584 bytes, 68405432 total - age 6: 43976040 bytes, 112381472 total - age 7: 20246264 bytes, 132627736 total - age 8: 31478896 bytes, 164106632 total - age 9: 41613872 bytes, 205720504 total - age 10: 33190832 bytes, 238911336 total - age 11: 22889304 bytes, 261800640 total - age 12: 168 bytes, 261800808 total - age 13: 184 bytes, 261800992 total : 1152825K-&gt;302652K(1490944K), 0.3356240 secs] 1152825K-&gt;302652K(7643136K), 0.3360389 secs] [Times: user=3.96 sys=0.03, real=0.34 secs] Why the desired survivor size is equals to "Survivor space size/2" ? I understand th…
score: 4
has answer: http://stackoverflow.com/a/27644417
upvote count: 4
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/26872925
possible better answer: http://stackoverflow.com/a/27644417
tagged with: jvm
favorite count: 0
has title: Java GC: How is "Desired Survivor Size" calculated?
tagged with: garbage-collection
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26872925
type: Question

http://stackoverflow.com/comment/40753177
has text: Please could you give a brief outline of the correct way to do it?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26019531

http://stackoverflow.com/a/26022006
score: -1
answers question: http://stackoverflow.com/q/26021948
type: Answer
has body: first learn some math, do it on paper then lets try to do it in java http://www.mathsisfun.com/money/compound-interest.html
downvote count: 1
upvote count: 0

http://stackoverflow.com/comment/40526861
type: Comment
has text: I have a question, where would I pass the context? "new MyTask(this).execute();" Inside the event listener that is causing the causing the background task to be run?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25894178

http://stackoverflow.com/comment/40738818
type: AnswerComment
score: 0
type: Comment
has text: @karthik you can see my edit.
comment on: http://stackoverflow.com/a/26011203

http://stackoverflow.com/a/26020118
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26020036
has body: Static methods can always call instance methods - so long as they have a reference to an instance on which to call the method. For example: public static void main(String[] args) { String foo = "hello"; System.out.println(foo.length()); } length() is an instance method on String, main is a static method, but I'm still fine to call it... because foo provides a reference. The only difference between static methods and instance methods in this regard is that an instance method implicitly has a reference to the type in which the method is declared - this.

http://stackoverflow.com/comment/40601141
type: AnswerComment
has text: In which library I can find setValue() function? Currently, I'm using like this webs.findElement(By.xpath("//xpath")).sendKeys(String); where 'webs' is the webdriver object. How can I replace this sendkeys() with setValue? I don't find any function like setValue() in WebDriver library.
comment on: http://stackoverflow.com/a/25916190
score: 0
type: Comment

http://stackoverflow.com/comment/138227714
has text: (Mar2024) import org.opencv.imgcodecs and import org.opencv.videoio doesnt exist anymore. What are they replaced by?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25890446

http://stackoverflow.com/q/26024762
has comment: http://stackoverflow.com/comment/40763058
tagged with: interface
has title: Extending comparables with java generics and interfaces
has comment: http://stackoverflow.com/comment/40771148
tagged with: java
type: Question
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/26024789
accepted answer: http://stackoverflow.com/a/26024789
answer count: 1
tagged with: generics
has body: So I'm creating an implementation of a priority queue using generics. I have this interface which I am trying to implement in my PriorityQueue class: public interface PriorityQueueInterface&lt;Item extends Comparable&lt;Item&gt;&gt; { } but I'm not sure what the proper syntax is to correctly implement the PriorityQueueInterface. Here is what I currently have: public class PriorityQueue&lt;Item extends Comparable&lt;Item&gt;&gt; implements PriorityQueueInterface&lt;Item extends Comparable&lt;Item&gt;&gt;{ } but it's throwing multiple errors. What would be the correct way to implement the interface? Any help would be appreciated.

http://stackoverflow.com/q/25993902
accepted answer: http://stackoverflow.com/a/25993947
favorite count: 0
tagged with: get
type: AnsweredQuestion
tagged with: set
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/25993947
upvote count: 5
tagged with: java
has title: Get/Set from C# to Java
has comment: http://stackoverflow.com/comment/40708589
score: 5
has body: I'm working on a project to translate a c# project to Java. I have the following Get/Set block in C# public Unit[] Units { get { Unit[] units_aux = new Unit[this.list_units.Count]; this.list_units.CopyTo(units_aux); return units_aux; } set { if (value == null) return; Unit[] units_aux = (Unit[])value; this.list_units.Clear(); foreach (Unit u in units_aux) this.lista_units.Add(u); } } I want to translate this to Java, but I have not been successful in translating it with no syntax errors. I'm very new to Java, so maybe this is a basic question, but i haven't found any information on how to do this that won't produce errors. Thanks for your help
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26032562
has comment: http://stackoverflow.com/comment/40777135
has body: I have a many string wich are really randomly sized like : 5 chars to 12000 randomly. Eg: String 1 : A,b,C,d String 2 :23,343,342,4535,4535,453,234, String 3 : ,asdsfdfdasgfdsfsf,dsfdsfdsfdsfsdfdf,sdsfdsfdsfsdf, &lt;- and this around another 1000 times. I want to upload them to my database by their ID. So my problem is that the oracle database varchar can conatians only 4k bytes. Edit: So if the string bigger than 4k. I want a String[] where each element maximum 4000k characters lets count 3900. ( And ofc if i go throught the array I get back the same String, and each array element last "word" is a whole word not sliced) So my idea is simply if the string.lenth &lt;1000 then go. else split it by ~4000 stocks but only split after coma. My solution so far ( without coma care) for (My_type type: types) { String[] tokens = Iterables.toArray( Splitter .fixedLength(4000) .split(type.area), String.class ); how can I replace this function to get an "good array"?
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26033261
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: split
answer count: 2
tagged with: arrays
has title: Java Split string into array, by size and only split after delimiters
has answer: http://stackoverflow.com/a/26033261
has comment: http://stackoverflow.com/comment/40778370
upvote count: 1
has answer: http://stackoverflow.com/a/26033254
accepted answer: http://stackoverflow.com/a/26033254
tagged with: string

http://stackoverflow.com/a/25929971
downvote count: 0
answers question: http://stackoverflow.com/q/25929819
type: Answer
upvote count: 2
score: 2
has body: use mongodb $push to insert or update into an existing arraylist

http://stackoverflow.com/q/25985933
tagged with: variables
has answer: http://stackoverflow.com/a/25985986
favorite count: 0
possible better answer: http://stackoverflow.com/a/25985986
type: AnsweredQuestion
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/25985969
has body: I am new to object oriented programming and I am trying to declare and initialize left, but I don't know how to do it. I tried left = new Counter(4, left.mod); But it Netbeans is saying that incompatible types: int cannot be converted to Number This is not the real program. public class Number{ private int mod; public Number(int modulus, Number left) { mod = modulus; //how to declare left? }
score: 1
upvote count: 1
has title: Declare and initialize in a method that has the same name as the class and data type
type: Question
tagged with: java
tagged with: class
answer count: 2
has answer: http://stackoverflow.com/a/25985969
downvote count: 0

http://stackoverflow.com/comment/40705243
type: Comment
has text: I require 15 points of reputation :) But I'll do this when I can.
comment on: http://stackoverflow.com/a/25992861
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40777116
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26031347
has text: are you trying to read some *Third party* data folder??

http://stackoverflow.com/comment/40779634
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26033706
has text: There is no **input** result in your configuration.

oauth-2.0
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/26004443
type: Tag
tags question: http://stackoverflow.com/q/25959816
tags question: http://stackoverflow.com/q/26013251
tags question: http://stackoverflow.com/q/25970000

http://stackoverflow.com/comment/40603623
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25926376
score: 0
has text: Your question seems to essentially be "what is a ClassNotFoundException and how do I fix it?". This is covered by the existing question [What is the difference between NoClassDefFoundError and ClassNotFoundException?](http://stackoverflow.com/questions/1457863/what-is-the-difference-between-noclassdeffounderror-and-classnotfoundexception)

http://stackoverflow.com/comment/40595859
type: Comment
has text: Explicitly set it to false won't hurt ;) Little future-proof precaution.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25931227

wcf
type: Tag
tag name: wcf
tags question: http://stackoverflow.com/q/26032158

http://stackoverflow.com/q/25951293
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40628492
downvote count: 5
answer count: 1
has body: Here is the question. How can you give the remainder without using modulo and division. Just only only subtraction method. Here is the question. Find the remainder when one positive integer is divided by another positive integer using successive subtraction. Input: Two positive integers A and B. Output: The Remainder of A/B
has answer: http://stackoverflow.com/a/25951348
favorite count: 0
type: AnsweredQuestion
has title: Java code that will give remainder using only subtraction and Not Modulo
has comment: http://stackoverflow.com/comment/40628662
tagged with: java
score: -4
accepted answer: http://stackoverflow.com/a/25951348

http://stackoverflow.com/a/25959877
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25959676
upvote count: 1
has body: Because you are manually laying out your components, you are needed to set layout to null (setLayout(null);) so before adding any component add this line in your code. fr.setLayout(null); Now you will get this :

http://stackoverflow.com/q/25944451
has comment: http://stackoverflow.com/comment/40618430
downvote count: 1
linked to: http://stackoverflow.com/q/19467202
has comment: http://stackoverflow.com/comment/40618411
has answer: http://stackoverflow.com/a/25945110
linked to: http://stackoverflow.com/q/25858770
linked to: http://stackoverflow.com/q/218384
tagged with: java
answer count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40618418
has comment: http://stackoverflow.com/comment/40618357
favorite count: 0
has answer: http://stackoverflow.com/a/25944470
type: Question
has body: This is the code that it is giving me the error for on the line with >>>>>>> I've already looked at this thread Exceptions but I still do not understand what I need to change :( I am a total beginner to programming. import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Scanner; public class manyVowels { public static final String wordList = "words.txt"; public static void main(String[] args) { Scanner fileIn = null; try { //locate and open file fileIn = new Scanner(new FileInputStream("words.txt")); } catch (FileNotFoundException e) { //if the file cannot be found, the program prints the message and quits System.out.println("File not found. "); System.exit(0); } String word = null; if (fileIn.hasNext()) //if there is another word continue { String finalWord = null; // defines the word with most consecutive vowels int maxVowels = 0;//sets initial value to 0 while (fileIn.hasNext()) { // for each word in the file int vowels = 0; /*error here--&gt;*/ for (int i = 0; i &lt; word.length() &amp;&amp; i &lt; word.length() - maxVowels + vowels; i++) { // for each character in the word, and exit early if the word is not long enough to beat maxVowels if (hasVowels(word.charAt(i))) { // consonants reset this to 0 vowels++; } else { // reached the end of the word so check if the count is higher than maxVowels if (vowels &gt; maxVowels) { maxVowels = vowels; finalWord = word; } vowels = 0; } } // comparing vowels to maxVowels if (vowels &gt; maxVowels) { maxVowels = vowels; finalWord = word; } } //seek vowels word = fileIn.next(); for (int i = 0; i &lt; word.length(); i++) { if ((word.charAt(i) == 'A') || (word.charAt(i) == 'E') || (word.charAt(i) == 'I') || (word.charAt(i) == 'O') || (word.charAt(i) == 'U') || (word.charAt(i) == 'a') || (word.charAt(i) == 'e') || (word.charAt(i) == 'i') || (word.charAt(i) == 'o') || (word.charAt(i) == 'u')) { //prints the final word with the most consecutive vowels System.out.println("The word with the most cons…
has answer: http://stackoverflow.com/a/25944497
has comment: http://stackoverflow.com/comment/40649637
has comment: http://stackoverflow.com/comment/40619305
score: 0
has title: Java Why do I get this error? Exception in thread "main" java.lang.NullPointerException
upvote count: 1

http://stackoverflow.com/comment/40532145
type: AnswerComment
has text: @chrisapotek no-one can answer until you answer some of the questions you've been asked in other comments, i.e. how sparse is the set, what's it for (there might be a better solution). Also some answers are for unknown reasons considering negative integers - please clarify the exact range intended.
type: Comment
comment on: http://stackoverflow.com/a/25896910
score: 2

http://stackoverflow.com/q/26006723
tagged with: jena
tagged with: java
score: -1
type: Question
has body: When I run this code in java I am getting error, I think the error occurred because of "String values". I am not sure about adding it but I got this idea from my previous question's answer which I asked in this site Query DBpedia to get abstract for different inputs public static void DbpediaResultSparql() { String values = "New York"; String service = "http://dbpedia.org/sparql"; String sparqlQueryString2 = "PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;"+ "PREFIX dbpedia-owl: &lt;http://dbpedia.org/ontology/&gt;"+ "PREFIX dbpedia: &lt;http://dbpedia.org/resource/&gt;"+ "SELECT DISTINCT ?abstract"+ "WHERE"+ "{ _:b0 rdfs:label ?name ."+ "_:b0 dbpedia-owl:abstract ?abstract"+ "FILTER langMatches(lang(?abstract), 'en')"+ "?name { " + values +" @en }"+ "}" ; Query query = QueryFactory.create(sparqlQueryString2); ARQ.getContext().setTrue(ARQ.useSAX); // Executing SPARQL Query and pointing to the DBpedia SPARQL Endpoint QueryExecution qexec = QueryExecutionFactory.sparqlService( "http://DBpedia.org/sparql", query); // Retrieving the SPARQL Query results ResultSet results = qexec.execSelect(); // Iterating over the SPARQL Query results while (results.hasNext()) { QuerySolution soln = results.nextSolution(); // Printing DBpedia entries' abstract. System.out.println(soln.get("?abstract")); } qexec.close(); }
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40730994
tagged with: dbpedia
accepted answer: http://stackoverflow.com/a/26007119
linked to: http://stackoverflow.com/q/16737653
tagged with: sparql
upvote count: 0
tagged with: http://stackoverflow.com/tag/rdf
linked to: http://stackoverflow.com/q/15663510
has answer: http://stackoverflow.com/a/26007119
linked to: http://stackoverflow.com/q/25920496
downvote count: 1
type: AnsweredQuestion
has title: Query DBpedia with Sparql using VALUES

http://stackoverflow.com/q/25976098
answer count: 2
has title: Using a processor without to endpoint
favorite count: 0
has body: Pretty new to Camel. I need to wiretap a processing pipeline, and inspect the events flowing inside, and sending statsd metrics. The code would look like something like this: Processor statsdProcessor = new StatsDProcessor(); ... from("disruptor:wiretap").process(statsdProcessor); The disruptor:wiretap is already wired to the main pipeline. I am wondering what is the implication of using prossor without to() endpoint? Will the exchanges sit in the memory because no where to go until timeout, or overwritten because buffer is full?
possible better answer: http://stackoverflow.com/a/25977112
has answer: http://stackoverflow.com/a/25977112
accepted answer: http://stackoverflow.com/a/25979250
type: AnsweredQuestion
downvote count: 1
type: Question
score: 3
tagged with: java
tagged with: apache-camel
upvote count: 4
has answer: http://stackoverflow.com/a/25979250

http://stackoverflow.com/a/38475273
downvote count: 0
answers question: http://stackoverflow.com/q/25895076
has body: Solution for this would be to use an interceptor e.g. private Interceptor interceptor = new Interceptor() { @Override public okhttp3.Response intercept(Chain chain) throws IOException { okhttp3.Response response = chain.proceed(chain.request()); locationHistory.add(response.header("Location")); return response; } }; Add the interceptor to your HttpClient and add that to Retrofit(using 2.0 for this example) public void request(String url) { OkHttpClient.Builder client = new OkHttpClient.Builder(); client.followRedirects(true); client.addNetworkInterceptor(interceptor); OkHttpClient httpClient = client.build(); Retrofit retrofit = new Retrofit.Builder() .baseUrl(url) .addConverterFactory(GsonConverterFactory.create()) .client(httpClient) .build(); } Now you have full access the the entire redirect history.
has comment: http://stackoverflow.com/comment/67700968
type: Answer
has comment: http://stackoverflow.com/comment/67700836
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/118364971
has comment: http://stackoverflow.com/comment/67706157

http://stackoverflow.com/comment/40539541
score: 0
type: Comment
type: QuestionComment
has text: @Vulcan Did that just now. Didn't help in the slightest.
comment on: http://stackoverflow.com/q/25901014

http://stackoverflow.com/a/25945635
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25945594
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25945594
type: Answer
score: 3
downvote count: 0
has body: You need to delete &lt;T&gt; from the declaration of your add and remove method because by writing something like public &lt;T&gt; void add (T x) you are saving that variable x can be of any type T and that fine but the problem comes when you are trying to make the assignment inside this method this.current.value=x; You have incompatible type , the type of current is different then type of x, Why? because T used in declaration of current is different from T used in declaration of x that's why you get the error. Delete &lt;T&gt; and it should work like this public void add(T x) { this.current.value=x; this.current.next=null; last.next=this.current; last=this.current; if(no==0) head=this.current; no++; } public T remove() { node&lt;T&gt; y=head; while(y.next.next!=null) { y=y.next; } T z =y.next.value; y.next=null; last=y; return z; } Also in the declaration of static variables static node&lt;T&gt; head,last; you have compilarion error because LinkedList.this cannot be referenced from static context
has comment: http://stackoverflow.com/comment/40620013

http://stackoverflow.com/comment/40747777
comment on: http://stackoverflow.com/q/26016728
type: Comment
type: QuestionComment
score: 3
has text: `SimpleDateFormat` has a `parse()` method too

http://stackoverflow.com/q/25945630
has title: Adding specific data to specific row in JTable
answer count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/40620086
has comment: http://stackoverflow.com/comment/40620102
tagged with: java
type: Question
has body: I have a list of data that is basically filled with the computations of 9 different mathematical functions (n log n, n, n*n, etc) for the values 1 through 12. I am trying to have all of the results of the computations for the value of 1 in a single column, a single column for the results for the value of 2, etc until 12. How can I do this using JTable? What I have so far is: JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String col[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }; DefaultTableModel tableModel = new DefaultTableModel(col, 0); JTable table = new JTable(tableModel); for (Pair&lt;String,Double&gt; pair : val1) { if (pair.getX().contains("(1)")) { Object[] objs = {pair.getX() + "" + pair.getY()}; tableModel.addRow(objs); } if (pair.getX().contains("(2)")) { Object[] test = {pair.getX() + "" + pair.getY()}; tableModel.addRow(test); } } JScrollPane scrollPane = new JScrollPane(table); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(900,300); frame.setVisible(true); When I do tableModel.addRow(test), this continues adding the results in the first column. How do I get it to move that data into the second column?
has comment: http://stackoverflow.com/comment/40620005
tagged with: jtable
score: 0

http://stackoverflow.com/a/25912796
has comment: http://stackoverflow.com/comment/62354033
type: AcceptedAnswer
has body: Your methods seem to override some important initialization made in parent JerseyTest. Try to name them differently. E.g.: @Before public void setUpChild() { } @After public void tearDownChild() { }
upvote count: 37
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/62381180
score: 37
accepted answer of: http://stackoverflow.com/q/25906976
has comment: http://stackoverflow.com/comment/71850590
answers question: http://stackoverflow.com/q/25906976

http://stackoverflow.com/a/26101174
has comment: http://stackoverflow.com/comment/74397436
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/74620979
score: -3
type: Answer
has body: You can access the ID of the document using the path: //Get ID of the Document StringBuffer propertyNames = new StringBuffer(); propertyNames.append(PropertyNames.ID); propertyNames.append(" "); propertyNames.append(PropertyNames.PATH_NAME); PropertyFilter pf=new PropertyFilter(); FilterElement felement= new FilterElement(Integer.valueOf(0),Long.valueOf(0),Boolean.TRUE,propertyNames.toString(),Integer.valueOf(0)); pf.addIncludeProperty(felement); Document document = Factory.Document.fetchInstance(os, ruta, pf ); idDocument = document.get_Id().toString(); and in the idDocument string you have it. Hope it helps.
answers question: http://stackoverflow.com/q/25908086
downvote count: 3
accepted answer of: http://stackoverflow.com/q/25908086

http://stackoverflow.com/comment/76740379
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26006646
has text: Custom Log4j2 appenders: yes. Custom log4j 1.2 appenders: no. This is an API adapter, the implementation has changed. You'll need to port custom extensions to Log4j2.

http://stackoverflow.com/q/25876601
answer count: 1
accepted answer: http://stackoverflow.com/a/25877191
has title: Spring MVC Form Processing
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
has body: First of all: I'm a beginner in Spring and this is my first try to implement an web application with Spring MVC. Here is what I've done yet: Entities: @Entity @Table(name = "coins") public class Coin { @Id @GeneratedValue private Integer id; @OneToOne private Country country; private double value; private int year; } @Entity @Table(name = "countries") public class Country { @Id @GeneratedValue private Integer id; private String name; } Controller: @Controller public class CoinViewController { @Autowired private CoinService service; @Autowired private CountryService countryService; @ModelAttribute("countries") public List<Country> frequencies() { return countryService.get(); } @RequestMapping(value = "/coins/add", method = RequestMethod.GET) public String addCoin(Model model) { model.addAttribute("coin", new Coin()); return "coins/add"; } @RequestMapping(value = "/coins/add", method = RequestMethod.POST) public String addCoinResult(@ModelAttribute("coin") Coin coin, BindingResult result) { // TODO: POST HANDLING return "/coins/add"; } } JSP: <form:form action="add" method="POST" modelAttribute="coin"> Country: <form:select path="country" class="form-control" > <form:option value="" label="-- Choose one--" /> <form:options items="${countries}" itemValue="id" itemLabel="name" /> </form:select> Value: <form:input path="value" class="form-control" /> Year: <form:input path="year" class="form-control" /> Erstellen </form:form> But when I try to save the input from the JSP I always get this: Field error in object 'coin' on field 'country': rejected value [1]; codes [typeMismatch.coin.country,typeMismatch.country,typeMismatch.Country,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [coin.country,country]; arguments []; default message [country]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'Country' for property 'country'; nested exception is java.lang.IllegalStateException:…
tagged with: jsp
has answer: http://stackoverflow.com/a/25877191
score: 0

http://stackoverflow.com/a/25961043
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25960752
has body: Just executing theFileName= new File(objectConetxActivity.getFilesDir(), fileName); alone will not create your file. You have to call theFileName.createNewFile();. And make sure that method returns true. That means the file was effectively created.
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25960752

http://stackoverflow.com/a/26024633
has comment: http://stackoverflow.com/comment/99534510
accepted answer of: http://stackoverflow.com/q/26024582
upvote count: 108
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/83829006
answers question: http://stackoverflow.com/q/26024582
has comment: http://stackoverflow.com/comment/83852990
type: Answer
has comment: http://stackoverflow.com/comment/125372614
has comment: http://stackoverflow.com/comment/88729859
has body: I just wanted to document this error on the internet. There was no much help or I didn't search properly. Answer : Go to the the path where the maven-metadata-local.xml is. Delete the project folder along with the xml and build the project. It worked for me!
has comment: http://stackoverflow.com/comment/94154834
score: 107
downvote count: 1
has comment: http://stackoverflow.com/comment/82843810
has comment: http://stackoverflow.com/comment/111567735

http://stackoverflow.com/q/25880954
possible better answer: http://stackoverflow.com/a/32756260
has answer: http://stackoverflow.com/a/26006007
tagged with: excel
linked to: http://stackoverflow.com/q/8168896
type: Question
tagged with: jakarta-ee
tagged with: java
has comment: http://stackoverflow.com/comment/40532292
has body: I have merged two excel files using the code specied here http://www.coderanch.com/t/614715/Web-Services/java/merge-excel-files this the block applying the styles for my merging cells if (styleMap != null) { if (oldCell.getSheet().getWorkbook() == newCell.getSheet().getWorkbook()) { newCell.setCellStyle(oldCell.getCellStyle()); } else { int stHashCode = oldCell.getCellStyle().hashCode(); XSSFCellStyle newCellStyle = styleMap.get(stHashCode); if (newCellStyle == null) { newCellStyle = newCell.getSheet().getWorkbook().createCellStyle(); newCellStyle.cloneStyleFrom(oldCell.getCellStyle()); styleMap.put(stHashCode, newCellStyle); } newCell.setCellStyle(newCellStyle); } } It all working as expected and going well in generating my XSSFWorkbook. Problem starting when I try to open it: I see below error and my error report contains below <?xml version="1.0" encoding="UTF-8" standalone="yes"?> error072840_01.xml Errors were detected in file 'XYZ.xlsx' Repaired Records: Format from /xl/styles.xml part (Styles) After all these my sheet opens up fine but without styles. I know there is a limitation on number of styles to be created and have counted the styles being created and I hardly see 4 created. I even know that this issue is with too many styles. Unfortunately, POI has support to optimise only HSSFWorkbook (Apache POI delete CellStyle from workbook) Any help in how to mitigate with this issue will be great.
accepted answer: http://stackoverflow.com/a/26006007
downvote count: 0
score: 6
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/32756260
has answer: http://stackoverflow.com/a/36291949
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40544681
has title: POI Excel Merging Causing "Repaired Records: Format from /xl/styles.xml part (Styles)"
tagged with: apache-poi

http://stackoverflow.com/q/25938772
type: Question
accepted answer: http://stackoverflow.com/a/25938873
answer count: 1
downvote count: 0
has body: We have a class that is serialized using java serialization. This class should be very rarely modified. I want to write a unit test that enforces this rule. When this field is modified it means a lot of changes, and version bumps to dependent yet separate applications that call ours using java serialization of this object. One thought is to just to use the automatically generated serialVersionUID. The problem with this is that it can be modified based on JVM changes (which would be annoying to figure out). Any other thoughts on how to approach this? Thankfully, the class is very flat. Or, in other words, the class doesn't have complex sub classes. It is just a collection of simple java objects like strings, ints, and arrays.
has title: How can I write a unit test to ensure a class definition is unmodified?
has answer: http://stackoverflow.com/a/25938873
tagged with: junit
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/40682391
score: 0
type: Comment
type: QuestionComment
has text: @KS7X that narrows down your issue: either `db` or `db.getConnection()` is null.
comment on: http://stackoverflow.com/q/25979974

http://stackoverflow.com/q/25999277
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40717138
has title: Loading Properties from a JAR file (java 1.6)
has comment: http://stackoverflow.com/comment/40717104
tagged with: java
has comment: http://stackoverflow.com/comment/40717053
has answer: http://stackoverflow.com/a/25999673
type: Question
has body: I manually inject a properties file inside a jar. How to load properties from a jar file before java 1.7 ? I tried many workarounds and nothing worked so far. There's plenty questions about it, but everything is focused on ClassLoader methods from java 1.7.
tagged with: jar
linked to: http://stackoverflow.com/q/2815404
has comment: http://stackoverflow.com/comment/40716727
score: 0
answer count: 2
tagged with: java-6
possible better answer: http://stackoverflow.com/a/25999317
has answer: http://stackoverflow.com/a/25999317
accepted answer: http://stackoverflow.com/a/25999673

http://stackoverflow.com/q/26016141
has title: Max concurrent http requests in http-kit's client?
tagged with: http-kit
tagged with: clojure
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26022669
upvote count: 1
has comment: http://stackoverflow.com/comment/40749834
type: Question
score: 1
tagged with: java
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26022669
favorite count: 0
has body: I'm using http-kit's client, with asynchronous callbacks. I wanted to know if there's a way to set a limit on the number of concurrent outgoing http requests, so that the waiting state for the callbacks doesn't cause an Out-Of-Memory exception. I'm asking because, at least in theory, there might be too many concurrent, incompleted requests, that consume memory. Since memory is a limited resource (think about running in a container such as Docker), this might be an issue. I know that increasing the available RAM is an option, but I'd like to know if there's a relevant limit that can be set.

http://stackoverflow.com/comment/40572022
type: QuestionComment
has text: The top bit is set. That makes the result print as negative, but it's still the right value. You don't have to change anything.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25918757

http://stackoverflow.com/a/26108114
has comment: http://stackoverflow.com/comment/41193123
accepted answer of: http://stackoverflow.com/q/25917828
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40984252
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40991365
answers question: http://stackoverflow.com/q/25917828
has body: Your logging indicates that you've made query request #3, then received the response for query request #2. If the listener is now expecting a response for 3, then it will throw an exception because it has received a message ID for message 2. If you are looping over the query call to do this, you could try specifying the instances as a list instead: addMatchingKey( new int[] { Tag.SeriesInstanceUID }, "uid1\\uid2\\uid3" );

http://stackoverflow.com/q/26001903
tagged with: java
type: Question
answer count: 2
has title: Check certain existing objects in Java
has comment: http://stackoverflow.com/comment/40721380
has comment: http://stackoverflow.com/comment/40721329
possible better answer: http://stackoverflow.com/a/26002485
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26002485
tagged with: class
has answer: http://stackoverflow.com/a/26002142
has comment: http://stackoverflow.com/comment/40721566
has comment: http://stackoverflow.com/comment/40721260
has comment: http://stackoverflow.com/comment/40721558
has comment: http://stackoverflow.com/comment/40721582
has comment: http://stackoverflow.com/comment/40721409
upvote count: 2
has comment: http://stackoverflow.com/comment/40721469
has body: I have a pretty simple problem with Java, but explaining it is not a simple as i expected. Basically, I want to check if any objects from a certain class exist. An example: I have a class Animal, and I have two subclasses, Cat and Dog. And when running the program, I want to know if any dogs or cats exist. I know I created a dog, OR a cat, but I don't know which. I could check all cats and dogs that I created in my previous code if they exist or not, but it's not only an ugly, but also a dumb solution. So, is there a nice way to know if there are any dogs or cats that currently exist? Thanks in advance!
accepted answer: http://stackoverflow.com/a/26002142
has comment: http://stackoverflow.com/comment/40721472
downvote count: 1
tagged with: object
type: AnsweredQuestion

language-features
tags question: http://stackoverflow.com/q/25934134
type: Tag
tags question: http://stackoverflow.com/q/25961256
tag name: language-features

http://stackoverflow.com/a/26047795
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: There are several options for automatically converting JSON data to Java objects. Some options are: Jackson - Annotate Java classes and fields to link them to the JSON schema. Google GSON - Can create simple toJson() and fromJson() methods to convert Java objects to JSON and vice-versa. Works with existing classes without modifying source code. JSON.org - Doesn't map the JSON directly to your Java classes, but provides parsing into JSONObject and JSONArray classes to make it simple work with JSON. More answers can be found in this question: How to parse JSON in Java EDIT All of the above require manually creating the Java objects, and then linking them to the JSON representation. If instead you want to automatically create the Java objects that correspond to the C# objects, I don't know of a way to do it automatically, however, the JSONSchema2POJO tool will generate Java POJOs from a sample of JSON, so that might save you some time.
has comment: http://stackoverflow.com/comment/40962002
answers question: http://stackoverflow.com/q/26032158

http://stackoverflow.com/comment/40543439
type: Comment
comment on: http://stackoverflow.com/a/25903192
type: AnswerComment
score: 0
has text: I like this, tell me (since I'm new to concurrency) is this an example of making it asynchronous?

http://stackoverflow.com/q/25874794
type: Question
tagged with: android
has body: I am following this tutorial and i cannot get the stage drawn to the screen (or the viewport/camera) set correctly. Given i'm rather new to stages and scenes the line below does not compile: stage.setViewport(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT,false); I changed it to: stage.setViewport(new ExtendViewport(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT)); //or stage.getViewport().update((int)VIRTUAL_SCREEN_WIDTH, (int)VIRTUAL_SCREEN_HEIGHT, false); No errors but no results either. I took the files (default.fnt, default.png, uiskin.atlas, uiskin.json and uiskin.png) from here which should be all of them afaik. Am i missing something?
has title: Assigning stage viewport?
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25875194
tagged with: libgdx
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/25875194

http://stackoverflow.com/a/25968835
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25968684
downvote count: 0
has body: I have written code using Math.round(8f * value/8f) which rounds of to nearest 1/8 th dollar No it doesn't. It rounds to the nearest integer. Try for example Math.round(((8f+1/8f) * value))/8f.

http://stackoverflow.com/q/26008549
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40733452
tagged with: stack
tagged with: java
has body: I am working on a program to help student learn all the presidents in order. I am using a stack. I want to create a stack with all of the presidents in order. Then the user will enter a president name and the program will compare there input with the top of the stack. I want to know if there is a way to fill my stack with Strings without using the .push method 44 times? Here is what I have so far in my main: package namepresidents; import java.util.Scanner; public class NamePresidents { public static void main(String[] args) { BoundedStackInterface&lt;String&gt; presidents; presidents = new ArrayStack&lt;String&gt;(41); presidents.push("George Washington"); String menu = "Would you like to study: \n" + "1. All the presidents \n" + "2. The first half \n" + "3. The second half \n" + "0. Exit \n"; Scanner in = new Scanner(System.in); int option = in.nextInt(); } } Here is my ArrayStack class for references: package namepresidents; public class ArrayStack&lt;T&gt; implements BoundedStackInterface&lt;T&gt; { protected final int DEFCAP= 43; protected T[] stack; //holds stack of elemets protected int topIndex = -1; public ArrayStack(){ // default constructor stack = (T[]) new Object[DEFCAP]; } public ArrayStack(int maxSize){ // constructor with user defined array size stack = (T[]) new Object[maxSize]; } public void push(T element){ //throws excption if the stack is full //otherwise places element on top of stack if (!isFull()) { topIndex++; stack[topIndex] = element; } else { throw new StackOverflowException("Push attempted on a full stack."); } } public boolean isFull(){ //returns true if the stack is full if (topIndex == stack.length-1) { return true; } else { return false; } } public boolean isEmpty(){ //returns true if the stack is empty if (topIndex == -1) { return true; } else { return false; } } public void pop(){ //throws excption if the stack is full //otherwise places element on top of stack if (!isEmpty()) { stack[topIndex] = null; topIndex--; } else { throw ne…
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26008694
has title: Is there a way to add multiple strings to a stack without using a push method each time
score: 0

http://stackoverflow.com/q/25998588
has comment: http://stackoverflow.com/comment/40715248
has comment: http://stackoverflow.com/comment/40715985
downvote count: 0
has comment: http://stackoverflow.com/comment/40716446
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40715478
has comment: http://stackoverflow.com/comment/40715184
has comment: http://stackoverflow.com/comment/40715267
has comment: http://stackoverflow.com/comment/40715398
has comment: http://stackoverflow.com/comment/40716427
type: Question
has comment: http://stackoverflow.com/comment/40716013
score: 3
has comment: http://stackoverflow.com/comment/40715157
tagged with: java
has comment: http://stackoverflow.com/comment/40715830
tagged with: servlets
upvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/40716063
has title: update text field using servlet
has answer: http://stackoverflow.com/a/26003698
favorite count: 0
has comment: http://stackoverflow.com/comment/40716281
has comment: http://stackoverflow.com/comment/40716249
has comment: http://stackoverflow.com/comment/40715285
has body: I'm a newbie in java and I'm trying to update textfield using servlet.Insert and delete are done but update not work.I'm just working with HTML and servlet. Here is my servlet ComputerController.java protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); ComputerDAO comDAO = new ComputerDAO(); //get Service String service = request.getParameter("service"); if (service == null || service == "") { service = "listAllComputer"; } if (service.equals("addComputer")) { //get parameter String name = request.getParameter("cname"); String quan = request.getParameter("quantity"); String price = request.getParameter("price"); String func = request.getParameter("functions"); //Check invalid here Computer com = new Computer(0, name, Integer.parseInt(quan), Double.parseDouble(price), func); //add into DB int n = comDAO.addComputer(com); if (n &gt; 0) { out.println("&lt;h1&gt; INSERTED&lt;/h1&gt;"); } } if (service.equalsIgnoreCase("listallcomputer")) { ArrayList&lt;Computer&gt; arr = comDAO.getAllComputer("select * from Computer"); if (arr.size() == 0) { out.println("&lt;h1&gt; NO RECORD FOUND &lt;/h1&gt;"); } else { out.println(" &lt;table width='100%' border='1'&gt;"); out.println("&lt;caption&gt;"); out.println(" &lt;h2&gt;Computer List&lt;/h2&gt;"); out.println(" &lt;/caption&gt;"); out.println("&lt;tr&gt;"); out.println(" &lt;th scope='col' width='5%'&gt;id&lt;/th&gt;"); out.println(" &lt;th scope='col'width='30%'&gt;Computer Name&lt;/th&gt;"); out.println(" &lt;th scope='col'width='10%'&gt;Quantity&lt;/th&gt;"); out.println(" &lt;th scope='col'width='15%'&gt;Price&lt;/th&gt;"); out.println(" &lt;th scope='col'width='30%'&gt;Functions&lt;/th&gt;"); out.println(" &lt;th scope='col' colspan=2 width='10%'&gt;Action&lt;/th&gt;"); out.println(" &lt;/tr&gt;"); for (int i = 0; i &lt; arr.size(); i++) { Computer com = arr.…

http://stackoverflow.com/q/25939514
has comment: http://stackoverflow.com/comment/40611176
type: AnsweredQuestion
has title: Splitting User Input of Characters into ArrayList
has answer: http://stackoverflow.com/a/25939628
has comment: http://stackoverflow.com/comment/40609500
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25939701
answer count: 3
has answer: http://stackoverflow.com/a/25939701
has body: I am currently working on a coding project for class where we must take a comma separated list of 2-10 characters (letters only) and produce all the possible words after cross checking with a given dictionary text file. The problem I am having is that though I can split the list and create an array, I know it would be much more useful to use an ArrayList instead and that is where I am running into the issue. Scanner input = new Scanner(System.in); String letters = input.nextLine(); input.close(); ArrayList&lt;Letters&gt; Letter = new ArrayList&lt;Letters&gt;(); letters.split(","); Letter.add(); Im not sure what I should put into the add function because I obviously don't want all the characters as one index of the ArrayList. I'm thinking maybe I should split the characters into separate string objects but I'm not sure how to accomplish that. Something makes me think of parsing from my intro class but still having trouble. Thanks in advance for any critique and help.
downvote count: 0
has comment: http://stackoverflow.com/comment/40609570
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/25939628
tagged with: arraylist
has answer: http://stackoverflow.com/a/25939781
tagged with: parsing
score: 2
upvote count: 2

http://stackoverflow.com/q/25932474
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25932608
has comment: http://stackoverflow.com/comment/40596530
upvote count: 0
answer count: 1
score: -1
has title: Making Http request to Server to email - Android
tagged with: android
tagged with: email
favorite count: 0
has body: I'm making an android application. My application has a quiz. When the user passes the quiz they are emailed a certificate. I am doing this by making a http request to a server and the email is sent through php. I got it to work with just the email body but I also want the user to be able to enter their email address (in the application) and the php file should get this from the code. Here is my code when I just had the email body (which worked) and sent it to myself new HttpPosting().execute("http://saf=fo.com/brEmail.php?emailBody="+ "HeyYOUUUUU"); Here is what I tried to add the email recipient (doesn't work) new HttpPosting().execute("http://sainfo.com/bredanSendEmail.php?emailBody=" + "HeyYOUUUUU"+"?emailTo="+"brendan@hotmail.com"); here is the php file on the server: &lt;?php $body = $_GET['emailBody']; $headers = 'From: IFA Safeguarding App &lt;welfare@irishfa.com&gt;'; $to = $_GET['emailTo']; $subject = "Email from IFA Safeguarding in Football App"; if (mail($to, $subject, $body, $headers)) { echo "1"; } else { echo "0"; } ?&gt; Any help is much appreciated
has answer: http://stackoverflow.com/a/25932608
has comment: http://stackoverflow.com/comment/40596860
tagged with: php
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40596549

http://stackoverflow.com/comment/40768646
type: Comment
comment on: http://stackoverflow.com/q/26027508
score: 0
has text: So far, I haven't encountered a version of JRE for Windows that stops this applet from running. I have various client machines ranging between versions 6 through 8. My go-to "golden version" for some legacy apps is 6.26 on Windows, but in this case it doesn't seem to matter which version I use on the Mac. Version 8 has gotten me further than all of the rest (even getting me past the oh-so-often-encountered "missing required permissions manifest attribute in main jar" error)
type: QuestionComment

http://stackoverflow.com/comment/40506648
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25882944
has text: The n lists are stored in a list, and each list is an ArrayList
score: 0

http://stackoverflow.com/comment/40755985
has text: I posted another question on it but it has been answered http://stackoverflow.com/questions/26001566/spark-datastax-java-api-select-statements/26020947#26020947. Thank you!
type: Comment
comment on: http://stackoverflow.com/a/25986867
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40513603
type: AnswerComment
has text: Matthew I need to paste to json a value from texfield, not paste something to textfield.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25886927

http://stackoverflow.com/a/25907268
has comment: http://stackoverflow.com/comment/40574262
type: Answer
accepted answer of: http://stackoverflow.com/q/25902310
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/25902310
has body: You can't do it like that. The way shiro works is that it checks the filters in the order they are configured. It first checks the first filter, if it can't authenticate, it will move on to the next. There is no exclusion pattern for that. You can write your own custom shiro filter that will deny authrorization on de rest url. I don't know how it will work in guice, but in shiro.ini you can do something like: [main] myfilter = UrlBasedAuthzFilter restFilter = YourRestFilterClass [urls] /rest/** = restFilter /** = myfilter And the filter class: public class UrlBasedAuthzFilter extends AuthorizationFilter { @Override public boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException { if (request.getServletContext().getContextPath().startsWith("/rest"){ return false; } return super.isAccessAllowed(request, response, mappedValue); } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40575222

http://stackoverflow.com/a/25983873
downvote count: 0
answers question: http://stackoverflow.com/q/25983425
has comment: http://stackoverflow.com/comment/40752068
type: Answer
has body: Your readFully call will use your system's default character encoding to transform byte buffer into String. This is NOT what you want to happen. You should use explicit character set in toString call. The encoding is usually specified in the HTTP request header. Here is an example of how to convert a UTF-8 encoded string return baos.toString( "UTF-8" ); Your second problem, is once you've consumed the InputString in readFully call, the letsDoThisAgain will not have anything to read, because the InputStream will be at the EOF.
upvote count: 1
has comment: http://stackoverflow.com/comment/40755795
score: 1

http://stackoverflow.com/a/25989034
accepted answer of: http://stackoverflow.com/q/25988211
answers question: http://stackoverflow.com/q/25988211
has comment: http://stackoverflow.com/comment/40698739
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Look at this loop: for (int i = 0; i &lt; xpathvaluesList.size();) { if (!xpathvaluesList.get(i).contains("_")) { xpathvaluesList.remove(xpathvaluesList.get(i)); System.out.println(xpathvaluesList); i = i + 1; } } When does i gets incremented? Only after an element containing an underscore has been removed. Otherwise you'll run in an endless loop or if all elements have underscores you'll end up with an empty list. Furthermore the condition is i &lt; xpathvaluesList.size(), but the size is changing as you remove elements from the list, and as i grows when you remove elements this means that you will never traverse the whole list and thus end up with elements remaining in the list which you don't need. To solve the problem with your current approach, use a different list to save the values you need. If you want to use the same List then use an Iterator and its remove method. public ArrayList&lt;String&gt; useXpathValues() throws IOException { ArrayList&lt;String&gt; xpathvaluesList = getMbunValues(); Iterator&lt;String&gt; iterator = xpathvaluesList.iterator(); while(iterator.hasNext()) { String next = iterator.next(); if (! next.contains("_")) { iterator.remove(); } } for (int i = 0; i &lt; xpathvaluesList.size(); i++) { System.out.println(xpathvaluesList.get(i)); } return xpathvaluesList; } this prints: XXX_PWD XXX_LOGIN But as M. Deinum suggested, you should better read the file line by line, parse each and build both lists in the same time.
score: 1
upvote count: 1

http://stackoverflow.com/comment/40631304
has text: What's bad is to not ask about what you do not now ... although you should've done some research yourself first and showed some effort ;)
type: Comment
comment on: http://stackoverflow.com/a/25952786
score: 0
type: AnswerComment

http://stackoverflow.com/a/25902970
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25902934
downvote count: 0
has comment: http://stackoverflow.com/comment/40543142
answers question: http://stackoverflow.com/q/25902934
has body: Rewrite your filter as below. public class GenericExtFilter implements FilenameFilter { private String[] exts; public GenericExtFilter(String... exts) { this.exts = exts; } @Override public boolean accept(File dir, String name) { for (String ext : exts) { if (name.endsWith(ext)) { return true; } } return false; } } Then you can initialize it with multiple extensions: new GenericExtFilter("mp4", "flv", "wmv");. The accept method will loop over the array, and if it finds a matching extension will return true, if not, false.
has comment: http://stackoverflow.com/comment/40543147
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/40550327
type: Comment
has text: Consider explaining what OP did wrong, how you fixed it and why you fixed it that way, to make your answer more useful for OP and future visitors. (Not my downvote btw)
type: AnswerComment
comment on: http://stackoverflow.com/a/25907170
score: 0

python
tags question: http://stackoverflow.com/q/25918514
tags question: http://stackoverflow.com/q/26033851
tags question: http://stackoverflow.com/q/25927804
tag name: python
tags question: http://stackoverflow.com/q/25960882
tags question: http://stackoverflow.com/q/25999265
tags question: http://stackoverflow.com/q/25976190
tags question: http://stackoverflow.com/q/25901320
tags question: http://stackoverflow.com/q/25891144
tags question: http://stackoverflow.com/q/25946168
type: Tag
tags question: http://stackoverflow.com/q/25887081
tags question: http://stackoverflow.com/q/26010587
tags question: http://stackoverflow.com/q/25956453
tags question: http://stackoverflow.com/q/25947611
tags question: http://stackoverflow.com/q/25945590
tags question: http://stackoverflow.com/q/25886830
tags question: http://stackoverflow.com/q/25918784
tags question: http://stackoverflow.com/q/25977758
tags question: http://stackoverflow.com/q/26012812

http://stackoverflow.com/a/58118775
answers question: http://stackoverflow.com/q/25970291
type: Answer
has comment: http://stackoverflow.com/comment/102626623
upvote count: 1
score: 1
downvote count: 0
has body: public long writeJSONFileToTable(String datasetName, String tableName, Path JSONPath, String location) throws IOException, InterruptedException, TimeoutException { LoadStatistics stats = null; try { //[START bigquery_load_from_file] TableId tableId = TableId.of(datasetName, tableName); //WriteChannelConfiguration writeChannelConfiguration = WriteChannelConfiguration.newBuilder(tableId).setFormatOptions(FormatOptions.csv()).build(); WriteChannelConfiguration writeChannelConfiguration = WriteChannelConfiguration.newBuilder(tableId).setFormatOptions(FormatOptions.json()).build(); // The location must be specified; other fields can be auto-detected. JobId jobId = JobId.newBuilder().setLocation(location).build(); TableDataWriteChannel writer = bigquery.writer(jobId, writeChannelConfiguration); // Write data to writer try (OutputStream stream = Channels.newOutputStream(writer)) { Files.copy(JSONPath, stream); } // Get load job Job job = writer.getJob(); job = job.waitFor(); stats = job.getStatistics(); System.out.println("State: " + job.getStatus().getState()); System.out.println(stats.getOutputRows()); // [END bigquery_load_from_file] } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return stats.getOutputRows(); }

http://stackoverflow.com/comment/40545750
has text: @Quincunx posting those as answers would be better imho, people might not read the comment section and I don't want to take credit for someone's answers so I won't edit :-)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25904400

http://stackoverflow.com/q/26024636
tagged with: java
has comment: http://stackoverflow.com/comment/40763229
score: 4
accepted answer: http://stackoverflow.com/a/26025048
type: Question
upvote count: 4
tagged with: mongodb
answer count: 2
possible better answer: http://stackoverflow.com/a/44536081
downvote count: 0
has answer: http://stackoverflow.com/a/44536081
favorite count: 0
has title: Realtime Application with Nodejs MongoDB and JAVA as a backend
has comment: http://stackoverflow.com/comment/40763049
has body: I am working on a web application that uses mongodb as the database. Data is inserted into this db via a Java Application and i want to somehow monitor/understand that the data is inserted from a nodejs application so that i can push some information to the clients via socket.io. I know this is quite easy when we remove Java part from the equation and carry out the insertion via nodejs. But this is not the case for me; so i need pointers on mongodb - nodejs push kind of a thing.. It would be very nice if the solution remains only with Java, Nodejs and mongodb. But if some other 3rd party framework or technology (like mq) must be included i would be happy to hear that.
has comment: http://stackoverflow.com/comment/40763396
has comment: http://stackoverflow.com/comment/40762899
has answer: http://stackoverflow.com/a/26025048
tagged with: node.js
type: AnsweredQuestion

http://stackoverflow.com/comment/40518692
comment on: http://stackoverflow.com/a/25889624
type: Comment
has text: no mine is jsf based web application. so according to your idea can i follow the first answer.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40614231
type: Comment
has text: This is the best answer I could come up with as well. I've abandoned the idea and I've fell back onto strongly worded comments. in the class. Hopefully they don't get ignored. Either way, thanks for the help. I think this would be the best approach, it is just more work than I'm willing to dedicate to the problem.
comment on: http://stackoverflow.com/a/25938873
type: AnswerComment
score: 0

weblogic-10.x
tag name: weblogic-10.x
type: Tag
tags question: http://stackoverflow.com/q/26012036
tags question: http://stackoverflow.com/q/26025727

http://stackoverflow.com/a/25920848
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25920585
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25920585
score: 3
has body: The way you are using sockets, there isn't a built-in break signal between each message you send... It all comes in on the same InputStream and gets read byte by byte. If you want to be able to differentiate between your writes, you either need to use a DataInput/OutputStream or use a transfer/object protocol (like XML or JSON) that marks this in the message. By the way, if you've got interest in Sockets beyond this test, you might want to look at some of the utilities I wrote way back for handling Sockets / InputStreams. Specifically, check out ServerSocketEx and DataFetcher

http://stackoverflow.com/a/27772826
answers question: http://stackoverflow.com/q/25878973
type: AcceptedAnswer
has body: Spring Webflow is built on spring web mvc, so the two can be used together. I have learned that the problem with this combination is that when there is something misconfigured, the only symptom is "nothing happens". I ultimately ended up looking at the debug logs for org.springframework.web and org.springframework.webflow, then tracing into the spring source code to diagnose configuration issues. The spring paradigm is aiming towards "convention over configuration". The problem I have had with it is that the conventions are not always well defined in a manner that someone already familiar with them can easily grasp. The final "gotcha" that I had to resolve is that the convention for spring webflow is to put the flow xml files in the same folder as the jsp's. In your example, you appear to be planning to switch between spring-webflow and unadorned web mvc behind the same view. Provided everything is correctly configured, for a given uri, whatever is in the webflow registry will trump whatever is in the UrlHandlerMapping (your annotations). This can create confusion if you're not aware of it.
accepted answer of: http://stackoverflow.com/q/25878973
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/40584487
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25925308
has text: is your count array an instance variable or static one?

http://stackoverflow.com/a/25951878
score: 0
has comment: http://stackoverflow.com/comment/40629447
has body: You need to specific proper flags for SimpleDateFormat. You have 2 options to specify timezone z and Z and to specify day name use E like this import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static void main(String[] args) throws ParseException { String date = "Sat Sep 20 23:39:04 IST 2014 "; SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd hh:mm:ss z yyyy"); System.out.println(sdf.parse(date)); } }
type: Answer
has comment: http://stackoverflow.com/comment/40629471
has comment: http://stackoverflow.com/comment/40629575
answers question: http://stackoverflow.com/q/25951782

http://stackoverflow.com/comment/40615552
comment on: http://stackoverflow.com/a/25941476
has text: Wow, I wonder who came up with that average, and what data set they used. Somehow, it reminds me of the joke about the statistician who sticks his head in the oven and his feet in the freezer, and declares himself to be, on average, comfortably warm.
type: AnswerComment
type: Comment
score: 5

http://stackoverflow.com/a/26160726
upvote count: 2
has body: Perhaps State Chart XML (SCXML) can help you. Currently it's a Working Draft specification published by W3C SCXML provides a generic state-machine based execution environment based on Harel State Tables. The apache foundations provides a java implementation that we(my company) are currently using to perform state-transitions on "jobs". Here is the Apache Commons SCXML implementation
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26015524

http://stackoverflow.com/a/25950687
has comment: http://stackoverflow.com/comment/42662529
type: Answer
has comment: http://stackoverflow.com/comment/42664287
answers question: http://stackoverflow.com/q/25934793
has body: It's pretty likely that if they used a different certificate, that they also used a different key pair. I.e., if you installed an updated certificate, your the signature over the .jar would not verify anymore. It's a warning. And it is an important one, Java 6 support has ended eons ago. Especially if you use security related applications, please upgrade to 7 or 8. If some care has been taken within the applications, they should not just run, they should run better on 7 and 8.
score: 0

http://stackoverflow.com/q/26017811
has comment: http://stackoverflow.com/comment/40751666
has comment: http://stackoverflow.com/comment/40750481
has comment: http://stackoverflow.com/comment/40750639
has comment: http://stackoverflow.com/comment/40750015
has answer: http://stackoverflow.com/a/26018329
type: Question
accepted answer: http://stackoverflow.com/a/26018323
has comment: http://stackoverflow.com/comment/40752334
has title: Is there a pre-existing class to define a sequence of operations on numbers in Java?
has comment: http://stackoverflow.com/comment/40750829
has answer: http://stackoverflow.com/a/26018551
score: 0
has comment: http://stackoverflow.com/comment/40752037
has comment: http://stackoverflow.com/comment/40752584
answer count: 3
has body: I'm developing a graphical user interface in Java and relying on the standard MVC design pattern in which I have a View which should provide an up-to-date representation of the state of the Model. I have an ObserverTextField class within the View which subclasses JTextField and registers itself as an observer of part of the Model. When this part of the Model changes, it calls this observer's notify method, passing the integer value. The class then sets its displayed text to the user. However, I would like to be able to control the representation of the number at run-time. I could pass a NumberFormat to the class, but that doesn't seem able to represent the value as, say, 1/1000th of its actual value. E.g. if the model stores the value of a current in milliamps, and I want it shown to the user in terms of amps, is there some kind of object I could construct and pass to the ObserverTextField to let it do that? Below is an example of the code using an instance of NumberFormat, which I would like to replace with something more powerful: public class ObserverTextField extends JTextField implements Observer { private static final long serialVersionUID = 1L; private NumberFormat formatter; @Override public void notify(Object value) { if(formatter == null) { setText(String.valueOf(value)); } else { setText(formatter.format((int)value)); } } public NumberFormat getFormat() { return formatter; } public void setFormat(NumberFormat formatter) { this.formatter = formatter; } } If there isn't such a thing, I could create my own, but I'd prefer to make sure something like that doesn't already exist in Java's standard library first.
has answer: http://stackoverflow.com/a/26018323
possible better answer: http://stackoverflow.com/a/26018329
has comment: http://stackoverflow.com/comment/40750353
has comment: http://stackoverflow.com/comment/40751849
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40750870
tagged with: java

graphics2d
tags question: http://stackoverflow.com/q/25874459
tag name: graphics2d
tags question: http://stackoverflow.com/q/25962764
type: Tag

http://stackoverflow.com/a/29946746
type: Answer
answers question: http://stackoverflow.com/q/25990494
has body: To complement Gary's answer: You can customize the evaluation context used when wiring beans (#{...}) by injecting a custom BeanExpressionResolver into the application context's bean factory. Subclass StandardBeanExpressionResolver and override customizeEvaluationContext() before refresh() ing the context. This can be achieved by writing a BeanFactoryPostProcessor like below: public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor { @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { beanFactory.setBeanExpressionResolver(new CustomBeanExpressionResolver()); } } The BeanFactoryPostProcessor will get picked up automatically by Spring if you register it as a bean.
score: 0

http://stackoverflow.com/comment/40630282
has text: Yes, It starts with 480 €, per developer per year.
comment on: http://stackoverflow.com/a/25947585
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40634582
type: QuestionComment
comment on: http://stackoverflow.com/q/25954233
score: 0
has text: What do you mean 'because "line" is not a string'? You declared line as a `String`, what else would it be?
type: Comment

http://stackoverflow.com/q/26018318
has body: I was wondering if it is possible to begin a chunk-encoded HTTP response while still receiving an HTTP request which is also chunk-encoded? It could be useful to do some processing on-the-fly on large amount of data. I've made some tests with AsyncHttpClient, Jetty and Servlet-3.0's AsyncContext, but it did not work well: I can process the request on-the-fly and append calculation to the response but everything is displayed only once the request has been entirely consumed. Do you have any idea? Thanks!
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26235262
type: Question
has title: Chunk-encoded HTTP response before POST HTTP chunk-encoded request complete
score: 0
tagged with: http
answer count: 1
tagged with: chunked-encoding
tagged with: java
has answer: http://stackoverflow.com/a/26235262

http://stackoverflow.com/q/25917489
type: Question
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/25929131
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 1
answer count: 1
tagged with: java
has title: Removing Nodes completely when a specific child element is found
has answer: http://stackoverflow.com/a/25929131
downvote count: 0
has body: I need to remove the node/nodes completely when a specific child element is found in nodes of XML For Instance, My XML is as follows: <?xml version="1.0"?> <booklist> THEORY OF DYNAMICS JOHN 09786 ABCD STACEY 765 ABCD BTYSON 34974 ABCD CTYSON 09534 INTRODUCING JAVA CHARLES 1234 ABCD TYSON 34534 So,When i search for book tag ='ABCD' my result should be as follows: OUTPUT XML: <?xml version="1.0"?> <booklist> THEORY OF DYNAMICS JOHN 09786 INTRODUCING JAVA CHARLES 1234 The code which i tried is as follows: try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); Document doc = docBuilder.parse(new File(FILENAME)); NodeList list = doc.getElementsByTagName("*"); for (int i = 0; i <list.getLength(); i++) { Node node = (Node) list.item(i); // Searching through entire file if (node.getNodeName().equalsIgnoreCase("book")) { NodeList childList = node.getChildNodes(); // Looking thhrough all children nodes for (int x = 0; x < childList.getLength(); x++) { Node child = (Node) childList.item(x); // To search only "book" children if (child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equalsIgnoreCase("name") && child.getTextContent().toUpperCase().equalsIgnoreCase("abcd".toUpperCase())) { // Delete node here node.getParentNode().removeChild(node); } } } } try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMParser parser = new DOMParser(); parser.parse(FILENAME); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(NEWFILE)); transformer.transform(source, result); } catch (IOException io) { io.printStackTrace(); } } catch (ParserConfigurationException pce) { pce.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } catch (SAXException saxe) { saxe.printStackTrace(); } I'm unable to delete all the book nodes which has child element as "abcd" , Inst…

http://stackoverflow.com/comment/40568411
has text: please pay attention to @Aritra and her comments. You should never have to mock a Java String under any circumstances -- ever. Just use a real string.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/25915490

http://stackoverflow.com/comment/40586439
has text: Have you written something in `onPause` of activity which might cause this?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25926770
score: 0

http://stackoverflow.com/comment/40543902
comment on: http://stackoverflow.com/q/25903489
type: Comment
type: QuestionComment
score: 2
has text: nope,it should be ||null|| to be ||||

http://stackoverflow.com/q/25876632
has comment: http://stackoverflow.com/comment/40517892
has answer: http://stackoverflow.com/a/36482633
has answer: http://stackoverflow.com/a/25877001
score: 5
tagged with: encoding
has comment: http://stackoverflow.com/comment/40495276
has comment: http://stackoverflow.com/comment/40495631
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/40496137
answer count: 3
has comment: http://stackoverflow.com/comment/40525679
accepted answer: http://stackoverflow.com/a/25876711
upvote count: 5
possible better answer: http://stackoverflow.com/a/25877001
has comment: http://stackoverflow.com/comment/40495467
has answer: http://stackoverflow.com/a/25876711
has body: I need to create a hash from a String containing users password. To create the hash, I use a byte array which I get by calling String.getBytes(). But when I call this method with specified encoding, (such as UTF-8) on a platform where this is not the default encoding, the non-ASCII characters get replaced by a default character (if I understand the behaviour of getBytes() correctly) and therefore on such platform, I will get a different byte array, and eventually a different hash. Since Strings are internally stored in UTF-16, will calling String.getBytes("UTF-16") guarantee me that I get the same byte array on every platform, regardless of its default encoding?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40495690
has title: Will String.getBytes("UTF-16") return the same result on all platforms?
has comment: http://stackoverflow.com/comment/40495428
tagged with: java
has comment: http://stackoverflow.com/comment/40495149
type: Question

http://stackoverflow.com/comment/40783115
has text: I'll add it as an answer for others :)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26033192

http://stackoverflow.com/q/25952082
has answer: http://stackoverflow.com/a/25952302
accepted answer: http://stackoverflow.com/a/25952302
answer count: 1
has comment: http://stackoverflow.com/comment/40630098
downvote count: 1
upvote count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/40629858
has body: All tutorials i see on creating dynamic web application are using eclipse IDE. I want to try to make a web application skeleton without eclipse's help because i don't want to be dependent on it. I want to understand it fully without any automatically generated files by eclipse. So are there tutorials out there you can share with me?
tagged with: web-applications
has title: How to create dynamic web application without eclipse?
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40629994
type: Question